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 - npm Package Compare versions

Comparing version 12.1.0 to 12.2.0

9

changelog.md

@@ -21,2 +21,11 @@ compromise uses semver, and pushes to npm frequently

##### 12.2.0
- improved splitting in .nouns()
- add `.nouns().adjectives()` method
- add `concat` param to `.pre()` and `.post()`
- allow ellipses at start of term *"....so"* in `@hasEllipses`
- fix matches with optional-end `foo?$` match syntax
- add typescript types for subsets
### v11

@@ -23,0 +32,0 @@

2

package.json

@@ -5,3 +5,3 @@ {

"description": "natural language processing in the browser",
"version": "12.1.0",
"version": "12.2.0",
"main": "./builds/compromise.js",

@@ -8,0 +8,0 @@ "unpkg": "./builds/compromise.min.js",

@@ -246,3 +246,3 @@ <div align="center">

The final lexicon is ~14,000 words:
The final lexicon is <a href="https://observablehq.com/@spencermountain/compromise-lexicon">~14,000 words</a>:

@@ -421,3 +421,3 @@ <div align="center">

- **[.text('method')](https://observablehq.com/@spencermountain/compromise-output)** - return the document as text
- **[.text('method')](https://observablehq.com/@spencermountain/compromise-text)** - return the document as text
- **[.json({})](https://observablehq.com/@spencermountain/compromise-json)** - pull out desired metadata from the document

@@ -464,2 +464,3 @@ - **[.out('array|offset|terms')](https://observablehq.com/@spencermountain/compromise-output)** - some named output formats (deprecated)

- **[.nouns().json()](https://observablehq.com/@spencermountain/nouns)** - overloaded output with noun metadata
- **[.nouns().adjectives()](https://observablehq.com/@spencermountain/nouns)** - get any adjectives describing this noun
- **[.nouns().toPlural()](https://observablehq.com/@spencermountain/nouns)** - `'football captain' → 'football captains'`

@@ -588,19 +589,19 @@ - **[.nouns().toSingular()](https://observablehq.com/@spencermountain/nouns)** - `'turnovers' → 'turnover'`

- **[.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 `.`
- **[.sentences()](https://observablehq.com/@spencermountain/compromise-sentences)** - return a sentence class with additional methods
- **[.sentences().json()](https://observablehq.com/@spencermountain/compromise-sentences)** - overloaded output with sentence metadata
- **[.sentences().subjects()](https://observablehq.com/@spencermountain/compromise-sentences)** - return the main noun of each sentence
- **[.sentences().toPastTense()](https://observablehq.com/@spencermountain/compromise-sentences)** - `he walks` -> `he walked`
- **[.sentences().toPresentTense()](https://observablehq.com/@spencermountain/compromise-sentences)** - `he walked` -> `he walks`
- **[.sentences().toFutureTense()](https://observablehq.com/@spencermountain/compromise-sentences)** -- `he walks` -> `he will walk`
- **[.sentences().toNegative()](https://observablehq.com/@spencermountain/compromise-sentences)** - - `he walks` -> `he didn't walk`
- **[.sentences().toPositive()](https://observablehq.com/@spencermountain/compromise-sentences)** - `he doesn't walk` -> `he walks`
- **[.sentences().isPassive()](https://observablehq.com/@spencermountain/compromise-sentences)** - return only sentences with a passive-voice
- **[.sentences().isQuestion()](https://observablehq.com/@spencermountain/compromise-sentences)** - return questions with a `?`
- **[.sentences().isExclamation()](https://observablehq.com/@spencermountain/compromise-sentences)** - return sentences with a `!`
- **[.sentences().isStatement()](https://observablehq.com/@spencermountain/compromise-sentences)** - return sentences without `?` or `!`
- **[.sentences().prepend()](https://observablehq.com/@spencermountain/compromise-sentences)** - smarter prepend that repairs whitespace + titlecasing
- **[.sentences().append()](https://observablehq.com/@spencermountain/compromise-sentences)** - smarter append that repairs sentence punctuation
- **[.sentences().toExclamation()](https://observablehq.com/@spencermountain/compromise-sentences)** - end sentence with a `!`
- **[.sentences().toQuestion()](https://observablehq.com/@spencermountain/compromise-sentences)** - end sentence with a `?`
- **[.sentences().toStatement()](https://observablehq.com/@spencermountain/compromise-sentences)** - end sentence with a `.`
<!-- - **[.sentences().toContinuous()](#)** - -->

@@ -607,0 +608,0 @@

@@ -93,5 +93,5 @@ export as namespace nlp

/** add this punctuation or whitespace before each match */
pre(str: String): Document
pre(str: String, concat: Boolean): Document
/** add this punctuation or whitespace after each match */
post(str: String): Document
post(str: String, concat: Boolean): Document
/** remove start and end whitespace */

@@ -207,4 +207,2 @@ trim(): Document

prepositions(n?: Number): Document
/** return things like `'Mrs.'`*/
abbreviations(n?: Number): Document
/** return person names like `'John A. Smith'`*/

@@ -222,23 +220,120 @@ people(n?: Number): Document

sentences(): Document
/** return things like `'Mrs.'`*/
abbreviations(n?: Number): Abbreviations
/** return any multi-word terms, like "didn't" */
contractions(n?: Number): Document
contractions(n?: Number): Contractions
/** contract words that can combine, like "did not" */
contract(): Document
/** return anything inside (parentheses) */
parentheses(n?: Number): Document
parentheses(n?: Number): Parentheses
/** return things like "Spencer's" */
possessives(n?: Number): Document
possessives(n?: Number): Possessives
/** return any terms inside 'quotation marks' */
quotations(n?: Number): Document
quotations(n?: Number): Quotations
/** return things like `'FBI'` */
acronyms(n?: Number): Document
acronyms(n?: Number): Acronyms
/** return things like `'eats, shoots, and leaves'` */
lists(n?: Number): Document
lists(n?: Number): Lists
/** return any subsequent terms tagged as a Noun */
nouns(n?: Number): Document
nouns(n?: Number): Nouns
/** return any subsequent terms tagged as a Verb */
verbs(n?: Number): Document
verbs(n?: Number): Verbs
}
// Nouns class
interface Nouns extends Document {
/** get any adjectives describing this noun*/
adjectives(): Document
/** return only plural nouns */
isPlural(): Document
/** return only nouns that _can be_ inflected as plural */
hasPlural(): Document
/** 'football captain' → 'football captains' */
toPlural(setArticle?: Boolean): Document
/** 'turnovers' → 'turnover' */
toSingular(setArticle?: Boolean): Document
/** add a `'s` to the end, in a safe manner. */
toPossessive(): Document
}
// Verbs class
interface Verbs extends Document {
/** return the adverbs describing this verb */
adverbs(): Document
/** return only plural nouns */
isPlural(): Document
/** return only singular nouns */
isSingular(): Document
/** return all forms of these verbs */
conjugate(): Document
/** 'will go' → 'went' */
toPastTense(): Document
/** 'walked' → 'walks' */
toPresentTense(): Document
/** 'walked' → 'will walk' */
toFutureTense(): Document
/** 'walks' → 'walk' */
toInfinitive(): Document
/** 'walks' → 'walking' */
toGerund(): Document
/** return verbs with 'not' */
isNegative(): Document
/** only verbs without 'not'*/
isPositive(): Document
/** 'went' → 'did not go'*/
toNegative(): Document
/** "didn't study" → 'studied' */
toPositive(): Document
}
interface Abbreviations extends Document {
/** */
stripPeriods(): Document
/** */
addPeriods(): Document
}
interface Acronyms extends Document {
/** */
stripPeriods(): Document
/** */
addPeriods(): Document
}
interface Contractions extends Document {
/** */
expand(): Document
}
interface Parentheses extends Document {
/** */
unwrap(): Document
}
interface Possessives extends Document {
/** */
strip(): Document
}
interface Quotations extends Document {
/** */
unwrap(): Document
}
interface Lists extends Document {
/** */
conjunctions(): Document
/** */
parts(): Document
/** */
items(): Document
/** */
add(): Document
/** */
remove(): Document
/** */
hasOxfordComma(): Document
}
}
export default nlp

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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