aho_corasick 2.0.0 aho_corasick: ^2.0.0 copied to clipboard
Pattern Matching implementation of aho_corasick using a state machine to find all matches in a text for a large number of words.
example/aho_corasick_example.dart
import 'package:aho_corasick/aho_corasick.dart';
void main() {
final aho = AhoCorasick.fromWordList(['abc', 'bcd', 'bcde']);
final results = aho.matches('search in abcd');
print(results
.map((match) => 'found ${match.word} at ${match.startIndex}')
.join('\n'));
final longest = aho.firstMatch('bcde', longest: true);
print(longest?.word ?? 'no match found');
}