compromise
Advanced tools
Comparing version 13.8.0 to 13.9.0
@@ -14,2 +14,13 @@ compromise uses semver, and pushes to npm frequently | ||
#### 13.9.0 [Feb 2021] | ||
- **[new]** - World.addConjugations() method | ||
- **[new]** - World.addPlurals() method | ||
- **[new]** - start compromise-penn-tags plugin | ||
- **[new]** - add fuzzy option to match commands | ||
- **[new]** - support multiple-word matches in OR matches (a|b|foo bar|c) | ||
- **[change] (internal)** - rename 'oneOf' match syntax to 'fastOr' | ||
- **[change]** - use new export maps format | ||
- **[fix]** - conjugations fixes #800 | ||
- **[fix]** - tokenization fixes #801 | ||
#### 13.8.0 [Dec 2020] | ||
@@ -16,0 +27,0 @@ - **[change]** improved support for fractions in numbers-plugin #793 |
@@ -5,3 +5,3 @@ { | ||
"description": "modest natural language processing", | ||
"version": "13.8.0", | ||
"version": "13.9.0", | ||
"main": "./builds/compromise.js", | ||
@@ -13,2 +13,12 @@ "unpkg": "./builds/compromise.min.js", | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"default": "./builds/compromise.js", | ||
"require": "./builds/compromise.js", | ||
"import": "./builds/compromise.mjs" | ||
}, | ||
"./tokenize": { | ||
"require": "./builds/compromise-tokenize.js" | ||
} | ||
}, | ||
"repository": { | ||
@@ -49,2 +59,5 @@ "type": "git", | ||
], | ||
"keywords": [ | ||
"nlp" | ||
], | ||
"prettier": { | ||
@@ -62,8 +75,8 @@ "trailingComma": "es5", | ||
"devDependencies": { | ||
"@babel/core": "7.12.9", | ||
"@babel/preset-env": "7.12.7", | ||
"@rollup/plugin-alias": "3.1.1", | ||
"@rollup/plugin-commonjs": "17.0.0", | ||
"@babel/core": "7.12.10", | ||
"@babel/preset-env": "7.12.11", | ||
"@rollup/plugin-alias": "3.1.2", | ||
"@rollup/plugin-commonjs": "17.1.0", | ||
"@rollup/plugin-json": "4.1.0", | ||
"@rollup/plugin-node-resolve": "11.0.0", | ||
"@rollup/plugin-node-resolve": "11.1.1", | ||
"amble": "1.2.0", | ||
@@ -73,3 +86,3 @@ "codecov": "3.8.1", | ||
"nyc": "^15.1.0", | ||
"rollup": "2.34.0", | ||
"rollup": "2.38.1", | ||
"rollup-plugin-babel": "4.4.0", | ||
@@ -80,3 +93,3 @@ "rollup-plugin-filesize-check": "0.0.1", | ||
"tap-dancer": "0.3.1", | ||
"tape": "5.0.1" | ||
"tape": "5.1.1" | ||
}, | ||
@@ -83,0 +96,0 @@ "eslintIgnore": [ |
166
README.md
@@ -215,17 +215,2 @@ <div align="center"> | ||
or if you don't care about POS-tagging, you can use the tokenize-only build: (90kb!) | ||
```html | ||
<script src="https://unpkg.com/compromise/builds/compromise-tokenize.js"></script> | ||
<script> | ||
var doc = nlp('No, my son is also named Bort.') | ||
//you can see the text has no tags | ||
console.log(doc.has('#Noun')) //false | ||
//but the whole api still works | ||
console.log(doc.has('my .* is .? named /^b[oa]rt/')) //true | ||
</script> | ||
``` | ||
<!-- spacer --> | ||
@@ -320,2 +305,83 @@ <img height="30" src="https://user-images.githubusercontent.com/399657/68221862-17ceb980-ffb8-11e9-87d4-7b30b6488f16.png"/> | ||
<!-- spacer --> | ||
<div > | ||
<img height="50px" src="https://user-images.githubusercontent.com/399657/68221862-17ceb980-ffb8-11e9-87d4-7b30b6488f16.png"/> | ||
</div> | ||
### Docs: | ||
##### Warm introduction: | ||
- **[#1 Input → output](https://docs.compromise.cool/tutorial-1)** | ||
- **[#2 Match & transform](https://docs.compromise.cool/compromise-tutorial-2)** | ||
- **[#3 Making a chat-bot](https://docs.compromise.cool/compromise-making-a-bot)** | ||
<!-- * **[Tutorial #4]()** - Making a plugin --> | ||
<div > | ||
<img height="25px" src="https://user-images.githubusercontent.com/399657/68221862-17ceb980-ffb8-11e9-87d4-7b30b6488f16.png"/> | ||
</div> | ||
##### Documentation: | ||
| Concepts | API | Plugins | | ||
| ------------- |:-------------:| -----:| | ||
| [Accuracy](https://observablehq.com/@spencermountain/compromise-accuracy) | [Accessors](https://observablehq.com/@spencermountain/compromise-accessors) | [Adjectives](https://observablehq.com/@spencermountain/compromise-adjectives) | ||
| [Caching](https://observablehq.com/@spencermountain/compromise-cache) | [Constructor-methods](https://observablehq.com/@spencermountain/compromise-constructor-methods) | [Dates](https://observablehq.com/@spencermountain/compromise-dates) | ||
| [Case](https://observablehq.com/@spencermountain/compromise-case) | [Contractions](https://observablehq.com/@spencermountain/compromise-contractions) | [Export](https://observablehq.com/@spencermountain/compromise-export) | ||
| [Filesize](https://observablehq.com/@spencermountain/compromise-filesize) | [Insert](https://observablehq.com/@spencermountain/compromise-insert) | [Hash](https://observablehq.com/@spencermountain/compromise-hash) | ||
| [Internals](https://observablehq.com/@spencermountain/compromise-internals) | [Json](https://observablehq.com/@spencermountain/compromise-json) | [Html](https://observablehq.com/@spencermountain/compromise-html) | ||
| [Justification](https://observablehq.com/@spencermountain/compromise-justification) | [Lists](https://observablehq.com/@spencermountain/compromise-lists) | [Keypress](https://observablehq.com/@spencermountain/compromise-keypress) | ||
| [Lexicon](https://observablehq.com/@spencermountain/compromise-lexicon) | [Loops](https://observablehq.com/@spencermountain/compromise-loops) | [Ngrams](https://observablehq.com/@spencermountain/compromise-ngram) | ||
| [Match-syntax](https://observablehq.com/@spencermountain/compromise-match-syntax) | [Match](https://observablehq.com/@spencermountain/compromise-match) | [Numbers](https://observablehq.com/@spencermountain/compromise-values) | ||
| [Performance](https://observablehq.com/@spencermountain/compromise-performance) | [Nouns](https://observablehq.com/@spencermountain/nouns) | [Paragraphs](https://observablehq.com/@spencermountain/compromise-paragraphs) | ||
| [Plugins](https://observablehq.com/@spencermountain/compromise-plugins) | [Output](https://observablehq.com/@spencermountain/compromise-output) | [Scan](https://observablehq.com/@spencermountain/compromise-scan) | ||
| [Projects](https://observablehq.com/@spencermountain/compromise-projects) | [Selections](https://observablehq.com/@spencermountain/compromise-selections) | [Sentences](https://observablehq.com/@spencermountain/compromise-sentences) | ||
| [Tagger](https://observablehq.com/@spencermountain/compromise-tagger) | [Sorting](https://observablehq.com/@spencermountain/compromise-sorting) | [Syllables](https://observablehq.com/@spencermountain/compromise-syllables)| [Tags](https://observablehq.com/@spencermountain/compromise-tags) | [Split](https://observablehq.com/@spencermountain/compromise-split) | | ||
| [Tokenization](https://observablehq.com/@spencermountain/compromise-tokenization) | [Text](https://observablehq.com/@spencermountain/compromise-text) | [Pronounce](https://observablehq.com/@spencermountain/compromise-pronounce) | ||
| [Named-Entities](https://observablehq.com/@spencermountain/compromise-topics) | [Utils](https://observablehq.com/@spencermountain/compromise-utils) | [Strict](https://observablehq.com/@spencermountain/compromise-strict) | ||
| [Whitespace](https://observablehq.com/@spencermountain/compromise-whitespace) | [Verbs](https://observablehq.com/@spencermountain/verbs) | [Penn-tags](https://observablehq.com/@spencermountain/compromise-penn-tags) | ||
| [World](https://observablehq.com/@spencermountain/compromise-world) | [Normalization](https://observablehq.com/@spencermountain/compromise/Normalization) | | ||
| [Fuzzy-matching](https://observablehq.com/@spencermountain/compromise-fuzzy-matching) |[Typescript](https://observablehq.com/@spencermountain/compromise-typescript) | | ||
##### Talks: | ||
- **[Language as an Interface](https://www.youtube.com/watch?v=WuPVS2tCg8s)** - by Spencer Kelly | ||
- **[Coding Chat Bots](https://www.youtube.com/watch?v=c_hmwFwvO0U)** - by KahWee Teng | ||
- **[On Typing and data](https://vimeo.com/496095722)** - by Spencer Kelly | ||
##### Articles: | ||
- **[Geocoding Social Conversations with NLP and JavaScript](http://compromise.cool)** - by Microsoft | ||
- **[Microservice Recipe](https://eventn.com/recipes/text-parsing-with-nlp-compromise)** - by Eventn | ||
- **[Adventure Game Sentence Parsing with Compromise](https://killalldefects.com/2020/02/20/adventure-game-sentence-parsing-with-compromise/)** | ||
- **[Building Text-Based Games](https://killalldefects.com/2019/09/24/building-text-based-games-with-compromise-nlp/)** - by Matt Eland | ||
- **[Fun with javascript in BigQuery](https://medium.com/@hoffa/new-in-bigquery-persistent-udfs-c9ea4100fd83#6e09)** - by Felipe Hoffa | ||
- **[Natural Language Processing... in the Browser?](https://dev.to/charlesdlandau/natural-language-processing-in-the-browser-52hj)** - by Charles Landau | ||
##### Some fun Applications: | ||
- **[Chat dialogue framework](http://superscriptjs.com/)** - by Rob Ellis | ||
- **[Automated Bechdel Test](https://github.com/guardian/bechdel-test)** - by The Guardian | ||
- **[Story generation framework](https://perchance.org/welcome)** - by Jose Phrocca | ||
- **[Tumbler blog of lists](https://leanstooneside.tumblr.com/)** - horse-ebooks-like lists - by Michael Paulukonis | ||
- **[Video Editing from Transcription](https://newtheory.io/)** - by New Theory | ||
- **[Browser extension Fact-checking](https://github.com/AlexanderKidd/FactoidL)** - by Alexander Kidd | ||
- **[Siri shortcut](https://routinehub.co/shortcut/3260)** - by Michael Byrns | ||
- **[Amazon skill](https://github.com/tajddin/voiceplay)** - by Tajddin Maghni | ||
- **[Tasking Slack-bot](https://github.com/kevinsuh/toki)** - by Kevin Suh | ||
[[see more]](https://observablehq.com/@spencermountain/compromise-projects) | ||
<!-- spacer --> | ||
<div align="center"> | ||
<img height="25px" src="https://user-images.githubusercontent.com/399657/68221862-17ceb980-ffb8-11e9-87d4-7b30b6488f16.png"/> | ||
<hr/> | ||
</div> | ||
<div align="center"> | ||
<img height="50px" src="https://user-images.githubusercontent.com/399657/68221632-b9094000-ffb7-11e9-99e0-b48edd6cdf8a.png"/> | ||
</div> | ||
### API: | ||
@@ -655,2 +721,8 @@ | ||
##### Penn-tags | ||
`npm install compromise-penn-tags` | ||
- **[.pennTags()](https://observablehq.com/@spencermountain/compromise-penn-tags)** - return POS tags from the Penn Tagset | ||
<!-- spacer --> | ||
@@ -663,7 +735,2 @@ <div > | ||
<!-- spacer --> | ||
<div > | ||
<img height="50px" src="https://user-images.githubusercontent.com/399657/68221862-17ceb980-ffb8-11e9-87d4-7b30b6488f16.png"/> | ||
</div> | ||
### Typescript | ||
@@ -688,47 +755,23 @@ | ||
### Docs: | ||
##### Tutorials: | ||
### Partial-builds | ||
or if you don't care about POS-tagging, you can use the tokenize-only build: (90kb!) | ||
- **[Tutorial #1](https://docs.compromise.cool/tutorial-1)** - Input → output | ||
- **[Tutorial #2](https://docs.compromise.cool/compromise-tutorial-2)** - Match & transform | ||
- **[Tutorial #3](https://docs.compromise.cool/compromise-making-a-bot)** - Making a chat-bot | ||
<!-- * **[Tutorial #4]()** - Making a plugin --> | ||
```html | ||
<script src="https://unpkg.com/compromise/builds/compromise-tokenize.js"></script> | ||
<script> | ||
var doc = nlp('No, my son is also named Bort.') | ||
##### 3rd party: | ||
//you can see the text has no tags | ||
console.log(doc.has('#Noun')) //false | ||
- **[Geocoding Social Conversations with NLP and JavaScript](http://compromise.cool)** - by Microsoft | ||
- **[Microservice Recipe](https://eventn.com/recipes/text-parsing-with-nlp-compromise)** - by Eventn | ||
- \*\*[Adventure Game Sentence Parsing with Compromise](https://killalldefects.com/2020/02/20/adventure-game-sentence-parsing-with-compromise/) | ||
- **[Building Text-Based Games](https://killalldefects.com/2019/09/24/building-text-based-games-with-compromise-nlp/)** - by Matt Eland | ||
- **[Fun with javascript in BigQuery](https://medium.com/@hoffa/new-in-bigquery-persistent-udfs-c9ea4100fd83#6e09)** - by Felipe Hoffa | ||
- **[Natural Language Processing... in the Browser???](https://dev.to/charlesdlandau/natural-language-processing-in-the-browser-52hj)** - by Charles Landau | ||
//but the whole api still works | ||
console.log(doc.has('my .* is .? named /^b[oa]rt/')) //true | ||
</script> | ||
``` | ||
##### Talks: | ||
- **[Language as an Interface](https://www.youtube.com/watch?v=WuPVS2tCg8s)** - by Spencer Kelly | ||
- **[Coding Chat Bots](https://www.youtube.com/watch?v=c_hmwFwvO0U)** - by KahWee Teng | ||
<div align="center"> | ||
<img height="50px" src="https://user-images.githubusercontent.com/399657/68221824-09809d80-ffb8-11e9-9ef0-6ed3574b0ce8.png"/> | ||
<div > | ||
<img height="50px" src="https://user-images.githubusercontent.com/399657/68221862-17ceb980-ffb8-11e9-87d4-7b30b6488f16.png"/> | ||
</div> | ||
##### Some fun Applications: | ||
- **[Chat dialogue framework](http://superscriptjs.com/)** - by Rob Ellis | ||
- **[Automated Bechdel Test](https://github.com/guardian/bechdel-test)** - by The Guardian | ||
- **[Story generation framework](https://perchance.org/welcome)** - by Jose Phrocca | ||
- **[Tumbler blog of lists](https://leanstooneside.tumblr.com/)** - horse-ebooks-like lists - by Michael Paulukonis | ||
- **[Video Editing from Transcription](https://newtheory.io/)** - by New Theory | ||
- **[Browser extension Fact-checking](https://github.com/AlexanderKidd/FactoidL)** - by Alexander Kidd | ||
- **[Siri shortcut](https://routinehub.co/shortcut/3260)** - by Michael Byrns | ||
- **[Amazon skill](https://github.com/tajddin/voiceplay)** - by Tajddin Maghni | ||
- **[Tasking Slack-bot](https://github.com/kevinsuh/toki)** - by Kevin Suh | ||
<!-- spacer --> | ||
<div align="center"> | ||
<img height="25px" src="https://user-images.githubusercontent.com/399657/68221862-17ceb980-ffb8-11e9-87d4-7b30b6488f16.png"/> | ||
<hr/> | ||
</div> | ||
#### Limitations: | ||
@@ -804,3 +847,3 @@ | ||
<ul> | ||
we do offer a [compromise-tokenize](./builds/compromise-tokenize.js) build, which has the POS-tagger pulled-out. | ||
we do offer a <a href="./builds/compromise-tokenize.js">compromise-tokenize</a> build, which has the POS-tagger pulled-out. | ||
<br/> | ||
@@ -826,7 +869,10 @@ but otherwise, compromise isn't easily tree-shaken. | ||
- **[en-pos](https://github.com/finnlp/en-pos)** - very-clever javascript pos-tagger by *[Alex Corvi](https://github.com/alexcorvi)* | ||
- **[naturalNode](https://github.com/NaturalNode/natural)** - fancier statistical nlp in javascript | ||
- **[superScript](http://superscriptjs.com/)** - clever conversation engine in js | ||
- **[compendium-js](https://github.com/Ulflander/compendium-js)** - POS and sentiment analysis in javascript | ||
- **[nodeBox linguistics](https://www.nodebox.net/code/index.php/Linguistics)** - conjugation, inflection in javascript | ||
- **[reText](https://github.com/wooorm/retext)** - very impressive [text utilities](https://github.com/wooorm/retext/blob/master/doc/plugins.md) in javascript | ||
- **[superScript](http://superscriptjs.com/)** - conversation engine in js | ||
- **[jsPos](https://code.google.com/archive/p/jspos/)** - javascript build of the time-tested Brill-tagger | ||
- **[spaCy](https://spacy.io/)** - speedy, multilingual tagger in C/python | ||
@@ -833,0 +879,0 @@ - **[Prose](https://github.com/jdkato/prose/)** - quick tagger in Go by Joseph Kato |
@@ -47,3 +47,3 @@ export as namespace nlp | ||
/** pre-parse a match statement, for faster lookups*/ | ||
parseMatch(str: string): nlp<D, W, Ph> | ||
parseMatch(str: string, options?:object): nlp<D, W, Ph> | ||
} | ||
@@ -200,22 +200,24 @@ | ||
// Match | ||
/** return a new Doc, with this one as a parent */ | ||
match(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
/** return matching patterns in this doc */ | ||
match(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** return a named group in a match */ | ||
match(match: string | ExtendedDocument<Ext, W, Ph>, group:string|number): ExtendedDocument<Ext, W, Ph> | ||
/** return all results except for this */ | ||
not(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
not(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** return only the first match */ | ||
matchOne(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
matchOne(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** return each current phrase, only if it contains this match */ | ||
if(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
if(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** Filter-out any current phrases that have this match */ | ||
ifNo(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
ifNo(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** Return a boolean if this match exists */ | ||
has(match: string | ExtendedDocument<Ext, W, Ph>): boolean | ||
has(match: string | ExtendedDocument<Ext, W, Ph>, options:any): boolean | ||
/** search through earlier terms, in the sentence */ | ||
lookBehind(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
lookBehind(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** search through following terms, in the sentence */ | ||
lookAhead(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
lookAhead(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** return the terms before each match */ | ||
before(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
before(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** return the terms after each match */ | ||
after(match: string | ExtendedDocument<Ext, W, Ph>): ExtendedDocument<Ext, W, Ph> | ||
after(match: string | ExtendedDocument<Ext, W, Ph>, options:any): ExtendedDocument<Ext, W, Ph> | ||
/** quick find for an array of string matches */ | ||
@@ -222,0 +224,0 @@ lookup(matches: string[]): ExtendedDocument<Ext, W, Ph> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1186188
26382
877