AhoCorasick class

Pattern Matching algorithm that searches for all occurences of any word in the word list.

Constructors

AhoCorasick.fromWordList(List<String> patterns, { bool separateBySpaces: false })
initialize the aho corasick algorithm with a given list of words this will create the state machine. If you want to force that recognized words are either at the beginning / end or are surounded by spaces set separateBySpaces to true
factory

Properties

separateBySpaces → bool
specifies whether patterns must be separated by spaces or if they can found anywhere
final
stateMachine StateMachine<WordState, String>
state machine used to find words in an input text
final
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

firstMatch(String input, { bool longest: false }) Match
returns the first match or null if none was found optionally you can specify longest: true to search for the longest match at a specific position. If you have the words ['abc', 'abcd'] and your text is 'abcd' the longest parameter will not fire when it finds 'abc' but after it checked enough positions to find all possible longer words and then return 'abcd'
matches(String input) → List<Match>
returns all matches found. If none were found it returns []
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited