Socket
Socket
Sign inDemoInstall

compromise

Package Overview
Dependencies
Maintainers
2
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compromise

natural language processing in the browser


Version published
Weekly downloads
52K
decreased by-5.79%
Maintainers
2
Weekly downloads
 
Created
Source
natural-language processing in the browser
npm install compromise@next
(formerly nlp_compromise)

inspect and play with english text

nlp('I look just like buddy holly').sentences().toPastTense().out('text')
// "I looked just like buddy holly."

Demos   |   Quick-start   |   Docs   |   Accuracy

:boom:Welcome to v7:boom:
a lot has changed!

Yup,

###Grammar, for the win:

r = nlp('john is really nice. sara quickly walks.')

//pluck-out some parts
r.remove('#Adverb')

//reach-in and transform parts
r.match('#Person').toTitleCase()

r.plaintext()
// 'John is nice. Sara walks.'

###Conjugation:

r = nlp('she sells seashells by the seashore.').sentences().toFuture().text()
//'she will sell seashells...'

r.verbs().conjugate()
// [{ PastTense: 'sold',
//    Infinitive: 'sell',
//    Gerund: 'selling', ...
// }]

###Plural/singular:

r = nlp('a bottle of beer on the wall.')
r.nouns().first().toPlural()
r.text()
//'The bottles of beer on the wall.'

###Negation:

r = nlp('london is calling')
r.sentences().toNegative()
// 'london is not calling'

###Number interpretation:

r = nlp('fifth of december')

r.values().toCardinal().text()
// 'five of december'

r.values().toNumber().text()
// '5 of december'

###Clever normalization:

r = nlp("the guest-singer's björk at seven thirty.").normalize().text()
// 'The guest singer is Bjork at 7:30.'

###Named-entity recognition:

r = nlp('the opera about richard nixon visiting china')
r.match('(#Person|#Place|#Organization)').data()
// [
//   { text: 'richard nixon', tags: ['Person'] },
//   { text: 'china', tags: ['Place', 'Country'] }
// ]

###Fancy outputs:

r = nlp('Tony Hawk won').asHtml()
/*
<span>
  <span class="Person Noun MalePerson">Tony Hawk</span>
  <span>&nbsp;</span>
  <span class="Verb PastTense">won</span>
</span>
*/

and yes, ofcourse, there's a lot more stuff.

###Join-in:

we're fun, we're using semver, and moving fast. :hammer_and_wrench: get involved :dancer:

 

#See also For the former promise-library, see jnewman/compromise (Thanks to the awesome jnewman for the npm package!)

(don't forget NLTK, GATE, Stanford, and Illinois toolkit )

FAQs

Package last updated on 13 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc