- smaller than jQuery (100k)
- 86% on the Penn treebank
- keypress speed, constant-time
- caniuse, yup. IE9+
- no dependencies, training, or configuration
It's a rule-based, user-focused, and satisfactory javascript library for understanding and changing written english
:boom: Welcome to v2.0! Please file an issue if you find something 💥
npm install nlp_compromise
<script src="./builds/nlp_compromise.es5.min.js"> </script>
let nlp = require("nlp_compromise");
nlp.text("She sells seashells").negate()
// She didn't sell seashells
nlp.text('She sells seashells').to_past()
// She sold seashells
nlp.verb("speak").conjugate();
// { past: 'spoke',
// infinitive: 'speak',
// gerund: 'speaking',
// actor: 'speaker',
// present: 'speaks',
// future: 'will speak',
// perfect: 'have spoken',
// pluperfect: 'had spoken',
// future_perfect: 'will have spoken'
// }
nlp.term("hamburger").syllables();
// [ 'ham', 'bur', 'ger' ]
nlp.noun("dinosaur").pluralize();
// "dinosaurs"
nlp.text("Tony Danza did a kickflip").people();
// "Tony Danza"
nlp.person("Tony Hawk").article();
// "he"
nlp.value("five hundred and sixty").number;
// 560
nlp.term("favourite").americanize()
// favorite
we've also got a modest, though very ambitious plugin ecosystem:
nlp_compromise.mixin(valley_girl);
t = nlp_compromise.text('it is a cool library.');
t.valley_girl();
// "So basically, it is like, a cool library."
nlp_compromise aims to be the best way to work with language in js. This is only done with many hands. Contributions in all forms are appreciated and respected.
Join our slack group or our infrequent announcement email-list