8000 GitHub - creatorrr/nlp_compromise: natural language processing on the clientside
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

creatorrr/nlp_compromise

 
 

Repository files navigation

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.

Yup,

  • 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 v2.0!   Please file an issue if you find something 💥

Off you go:

npm install nlp_compromise

<script src="./builds/nlp_compromise.es5.min.js"> </script>

let nlp = require("nlp_compromise");

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.noun("dinosaur").pluralize();
// "dinosaurs"

nlp.term("hamburger").syllables();
// [ '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:

nlp.plugin(require("nlp-locale"))
nlp.term("favourite").toAmerican()
// favorite

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

nlp.plugin(require("nlp-ngram"));
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

Development

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

About

natural language processing on the clientside

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.9%
  • HTML 0.1%
0