Skip to content
natural language processing on the clientside
Find file
Latest commit 8783ac7 Spencer Kelly bump version for npm

Natural Language Processing in the browser

CodacyBadge npm version downloads

nlp.text("She sells seashells").negate()
// She doesn't sell seashells

nlp_compromise aims to be the reasonable way to use language in software.


  • smaller than jQuery (100k)
  • 86% on the Penn treebank
  • keypress speed, constant-time
  • caniuse, yessir. IE9+
  • no dependencies, training, or configuration.

It's a use-focused, satisfactory javascript library for understanding, changing, and making written english.

                - Check it out -

   :boom: Welcome to v3.0!   Please file an issue if you find something :boom:

Off you go:

npm install nlp_compromise

<script src=""></script>

let nlp = require("nlp_compromise"); // or nlp = window.nlp_compromise

nlp.text('She sells seashells').to_past()
// She sold seashells

// { past: 'spoke',
//   infinitive: 'speak',
//   gerund: 'speaking',
//   actor: 'speaker',
//   present: 'speaks',
//   future: 'will speak',
//   perfect: 'have spoken',
//   pluperfect: 'had spoken',
//   future_perfect: 'will have spoken'
// }

// "dinosaurs"

// [ 'ham', 'bur', 'ger' ]

nlp.person("Tony Hawk").article();
// "he"

nlp.text("Tony Danza did a kickflip").people();
// "Tony Danza"

nlp.value("five hundred and sixty").number;
// 560

we've also got a modest, though ambitious plugin ecosystem:

// favorite

var t2 = nlp.term('houston texas');
//[ [ 'hous', 'ton' ], [ 'tex', 'as' ] ]

var t4 = nlp.text(`Tony Hawk played Tony Hawk's pro skater`);
t4.ngram({min_count: 2});
// [ { word: 'tony hawk', count: 2, size: 1 } ]

                try it out

View the Full API Documentation


Issue Stats Issue Stats

nlp_compromise is a wicked-problem solved with many hands. Contributions in all forms are respected.

Join our slack group slack or our infrequent announcement email-list

MIT license

Something went wrong with that request. Please try again.