(formerly nlp_compromise)
npm install compromise
inspect and play with english text.
let r = nlp('I look just like buddy holly.')
r.sentences().toPastTense()
r.out('text')
200k
one javascript file
|
|
🙏
npm install compromise
|
IE9+
caniuse, youbetcha
|
no training, configuration, or prolog
the idea is, reach-in to a part of the text, and change it:
r = nlp('john is really nice. sara sings loudly.')
r.match('#Person').toUpperCase()
or pluck-out some parts,
r.remove('#Adverb')
r.replace('is nice', 'is bad')
or just be downright fancy
r.sentences().toNegative()
or grab specific parts, and analyze-the-heck out of them:
r = nlp(chomskyFanFic)
r.places().sort('freq').unique().data()
🤗 🤗 🤗 🤗 🤗 🤗 🤗 🤗 🤗 🤗
Part-of-Speech Tagging | Named-Entity Recognition | Verb Conjugation | Inflection/Pluralization |
###Client-side:
<script src="https://unpkg.com/compromise@latest/builds/compromise.min.js"></script>
<script>
var r = nlp('dinosaur').nouns().toPlural()
console.log(r.out('text'))
</script>
###Tense:
let r = nlp('she sells seashells by the seashore.')
r.sentences().toFutureTense().out('text')
r.verbs().conjugate()
###Plural/singular:
r = nlp('a bottle of beer on the wall.')
r.nouns().first().toPlural()
r.out('text')
###Negation:
r = nlp('london is calling')
r.sentences().toNegative()
###Number interpretation:
r = nlp('fifth of december')
r.values().toCardinal().out('text')
r.values().toNumber().out('text')
###Normalization:
r = nlp("the guest-singer's björk at seven thirty.").normalize().out('text')
###Named-entity recognition:
r = nlp('the opera about richard nixon visiting china')
r.topics().data()
###Fancy outputs:
r = nlp('Tony Hawk won').out('html')
Join in!
we're fun, we're using semver, and moving fast.
🛠️ get involved 💃
###Don't forget about:
For the former promise-library, see jnewman/compromise
(Thanks Joshua!)