1.0.0 • Published 5 years ago

aho-corasick-search v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

aho-corasick-search

Aho-Corasick for search string

Example

var ahoCorasick = require('aho-corasick-search')

var acSearch = new ahoCorasick();

acSearch.add('1234')
acSearch.add('23')
acSearch.build()
var res = acSearch.search('1234')
console.log(res)

output

[ '23', '1234' ]

Install

npm install aho-corasick-search

Constructor

var acSearch = new ahoCorasick();

Method

acSearch.add(keyword)

put the keyword to the trie

acSearch.build()

build the aho-corasick automaton on the trie

acSearch.search(str)

search all keywords appearing in the str

Return an array containing all appeared keywords