compromise-scan
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published
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

Readme

Keywords

none

Package Sidebar

Install

npm i compromise-scan

Weekly Downloads

13

Version

0.1.2

License

MIT

Unpacked Size

23.8 kB

Total Files

7

Last publish

Collaborators

  • spencermountain