aca
The Aho–Corasick algorithm (aca) is a string searching algorithm.
$ npm i aca
const aca = ;
aca.find(keywords: array, text: string, [charset: string])
Search for keywords in text strings.
charset (optional, Unicode or ASCII, defaults to Unicode)
aca // => { matches, positions, count }
Example
var keywords = "h" "he" "she" "hers" "his";var text = "ahishers"; var result = aca; resultmatches //keyword:positions "h":14"his":1"she":3"he":4"hers":4 resultpositions //position:keywords 1"h""his"3"she"4"h""he""hers"resultcount //keyword:count "h":2"his":1"he":1"she":1"hers":1
aca.dict(keywords: string|buffer, text: string|buffer, [charset: string])
Coming soon.
keywords.txt one keyword per single line.
hhisshehehers
text.txt
ahishers
Command line
Coming soon.
$ aca -v
Aho–Corasick algorithm wiki!