mganss / ahocorasick Goto Github PK
View Code? Open in Web Editor NEWAho-Corasick multi-string search for .NET and SQL Server.
License: MIT License
Aho-Corasick multi-string search for .NET and SQL Server.
License: MIT License
Hey
I was trying out the library for a project that I'm doing and I saw that is has a large memory traffic when searching for a long keyword in a large text.
It boils down to the the Line 177 https://github.com/mganss/AhoCorasick/blob/master/AhoCorasick/AhoCorasick.cs#L177 where you call the Match function which itself returns an IEnumerable.
Due to the amount of times this gets executed, a lot of Enumerators get created.
I was able to fix this by copying the code of the Match function inside the Search function. This gets rid of the Enumerator creation and the allocations are gone.
Hope this helps
Did you benchmark how long it will take to create the trie tree if there are many words (eg. 5000words)? This algorithm is useful in dirty/censorship words matching. But usually, the words list can be very long and dynamic (maintainable).
Hey,
I am using your in a project and am currently implementing an algorithm where we only care for getting any one match.
For example, if we have search patterns "aa, ab, abc"
and the input string is "aab"
, then I would only like to know if there is a match and I do not care if it is either "aa"
or "ab"
. So essentially just the search function, which returns its first match. I think this can be a major performance improvement for my case. Could you let me know if you are willing to include this in your library? I can see why you would not like this, as it kind of goes against the main idea of the AhoCorasick algorithm, but it would be nice to have for me.
Do you think it would be easy to add wildcard matching to this? Any tips how it might be achieved?
Thinking * for any number of characters, and ? For a single character.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.