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 truefactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- 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
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 nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited