-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add method to output all matched substrings #5
Comments
|
IMO finding all the matching substrings and their locations is a fundamental feature of the Aho Corasick algorithm and a requirement for many use cases. |
Push new version with the "Search" feature. You can try it using |
This var ac = new AhoCorasickTree(new[] { "a", "ab", "bab", "bc", "bca", "c", "caa" });
var m = ac.Search("abccab").ToList(); finds only "a", "ab", "bc", "a", "ab". Should find "a", "ab", "bc", "c", "c", "a", "ab". This is the example from Wikipedia. |
Pushed the fix with |
Something like this:
where the key is the matched pattern and the value is the start index into the searched string.
I tried adding this method assuming that IsFinished means a node is in the dictionary ("blue node" as in the description on Wikipedia). But that doesn't seem to be the case so I gave up 😢
The text was updated successfully, but these errors were encountered: