0.3.0 • Published 5 years ago
compromise-sentences v0.3.0
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
// 3Demo
API
- .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 walked - .sentences().toPresentTense() -
he walked->he walks - .sentences().toFutureTense() --
he walks->he will walk - .sentences().toNegative() - -
he walks->he didn't walk - .sentences().toPositive() -
he doesn't walk->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