plugin for nlp-compromise
npm install compromise-sentencesnpm install compromise-sentences``js
const nlp = require('compromise')
nlp.extend(require('compromise-sentences'))
let doc = nlp('Are you shouting boo, or boo-urns? Booo! I was saying boo-urns.')
doc.sentences().length
// 3
`
- .sentences() - return a sentence class with additional methods
- .sentences().json() - overloaded output with sentence metadata
- .sentences().subjects() - return the main noun of each sentence
- .sentences().toPastTense() - he walks -> he walkedhe walked
- .sentences().toPresentTense() - -> he walkshe walks
- .sentences().toFutureTense() -- -> he will walkhe walks
- .sentences().toNegative() - - -> he didn't walkhe doesn't walk
- .sentences().toPositive() - -> he walks?
- .sentences().isPassive() - return only sentences with a passive-voice
- .sentences().isQuestion() - return questions with a !
- .sentences().isExclamation() - return sentences with a ?
- .sentences().isStatement() - return sentences without or !!
- .sentences().prepend() - smarter prepend that repairs whitespace + titlecasing
- .sentences().append() - smarter append that repairs sentence punctuation
- .sentences().toExclamation() - end sentence with a ?
- .sentences().toQuestion() - end sentence with a .`
- .sentences().toStatement() - end sentence with a
MIT