cs
compromise-scan
npm i compromise-scan
cs

compromise-scan

modest natural-language processing

by spencer kelly

0.1.2 (see all)License:MITTypeScript:Built-In
npm i compromise-scan
Readme
a plugin for compromise

npm install compromise-scan

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

No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate