0.1.2 • Published 3 years ago

compromise-scan v0.1.2

Weekly downloads
95
License
MIT
Repository
github
Last release
3 years ago

a very-fast lookup for compromise documents, when you have a lot of terms to look up.

const nlp = require('compromise')
nlp.extend(require('compromise-scan'))

// create a compressed lookup trie
let trie = nlp.buildTrie(['two three four', 'three'])
// create a document
let doc = nlp('one two three four five.')
// throw it at a document
let m = doc.scan(trie)
m.debug()

// throw it at other documents
nlp('three four five six.').scan(trie)
nlp('one two. seven eight nine.').scan(trie)

compared to our typical lookup function, it's outrageously fast.

based on BrunoRB/ahocorasick by Bruno Roberto Búrigo.

MIT