Skip to content

Commit

Permalink
Merge pull request #830 from spencermountain/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
spencermountain authored Apr 6, 2021
2 parents 652196e + 3d930c1 commit 9338d26
Show file tree
Hide file tree
Showing 36 changed files with 730 additions and 520 deletions.
2 changes: 1 addition & 1 deletion builds/compromise-tokenize.js

Large diffs are not rendered by default.

38 changes: 22 additions & 16 deletions builds/compromise.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* compromise 13.10.5 MIT */
/* compromise 13.10.6 MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -3866,7 +3866,7 @@

var fromJSON_1 = fromJSON;

var _version = '13.10.5';
var _version = '13.10.6';

var entity = ['Person', 'Place', 'Organization'];
var nouns$1 = {
Expand Down Expand Up @@ -10727,30 +10727,38 @@

var isNumber = /^[0-9]+$/;
var isOrdinal = /^[0-9]+(st|nd|rd|th)$/;
var isTime = /^[0-9:]+(am|pm)$/;
var isTime = /^[0-9:]+(am|pm)?$/;

var createPhrase = function createPhrase(found, doc) {
//create phrase from ['would', 'not']
var phrase = _01Tokenizer(found.join(' '), doc.world, doc.pool())[0]; //tag it

var terms = phrase.terms();
_01Lexicon(terms, doc.world); //make these terms implicit
_01Lexicon(terms, doc.world);
var term = terms[0]; // tag number-ranges

if (isOrdinal.test(term.text)) {
terms[0].tag('Ordinal', 'ord-range', doc.world);
terms[2].tag('Ordinal', 'ord-range', doc.world);
} else if (isNumber.test(term.text)) {
terms[0].tag('Cardinal', 'num-range', doc.world);
terms[2].tag('Cardinal', 'num-range', doc.world);
} else if (isTime.test(term.text)) {
terms[0].tag('Time', 'time-range', doc.world);
terms[1].tag('Date', 'time-range', doc.world);
terms[2].tag('Time', 'time-range', doc.world);
} //make these terms implicit


terms.forEach(function (t) {
t.implicit = t.text;
t.text = '';
t.clean = ''; // remove whitespace for implicit terms

t.pre = '';
t.post = ''; // tag number-ranges

if (isNumber.test(t.implicit)) {
t.tag('Cardinal', 'num-range', doc.world);
} else if (isOrdinal.test(t.implicit)) {
t.tag('Ordinal', 'ord-range', doc.world);
} else if (isTime.test(t.implicit)) {
t.tag('Time', 'time-range', doc.world);
} else if (Object.keys(t.tags).length === 0) {
t.post = '';

if (Object.keys(t.tags).length === 0) {
t.tags.Noun = true; // if no tag, give it a noun
}
});
Expand Down Expand Up @@ -13864,9 +13872,7 @@

// walked => walk - turn a verb into it's root form
var toInfinitive = function toInfinitive(parsed, world) {
var verb = parsed.verb; // console.log(parsed)
// verb.debug()
//1. if it's already infinitive
var verb = parsed.verb; //1. if it's already infinitive

var str = verb.text('reduced');

Expand Down
2 changes: 1 addition & 1 deletion builds/compromise.min.js

Large diffs are not rendered by default.

38 changes: 22 additions & 16 deletions builds/compromise.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* compromise 13.10.5 MIT */
/* compromise 13.10.6 MIT */
function _typeof(obj) {
"@babel/helpers - typeof";

Expand Down Expand Up @@ -3860,7 +3860,7 @@ var fromJSON = function fromJSON(json, world) {

var fromJSON_1 = fromJSON;

var _version = '13.10.5';
var _version = '13.10.6';

var entity = ['Person', 'Place', 'Organization'];
var nouns$1 = {
Expand Down Expand Up @@ -10721,30 +10721,38 @@ var _07French = checkFrench;

var isNumber = /^[0-9]+$/;
var isOrdinal = /^[0-9]+(st|nd|rd|th)$/;
var isTime = /^[0-9:]+(am|pm)$/;
var isTime = /^[0-9:]+(am|pm)?$/;

var createPhrase = function createPhrase(found, doc) {
//create phrase from ['would', 'not']
var phrase = _01Tokenizer(found.join(' '), doc.world, doc.pool())[0]; //tag it

var terms = phrase.terms();
_01Lexicon(terms, doc.world); //make these terms implicit
_01Lexicon(terms, doc.world);
var term = terms[0]; // tag number-ranges

if (isOrdinal.test(term.text)) {
terms[0].tag('Ordinal', 'ord-range', doc.world);
terms[2].tag('Ordinal', 'ord-range', doc.world);
} else if (isNumber.test(term.text)) {
terms[0].tag('Cardinal', 'num-range', doc.world);
terms[2].tag('Cardinal', 'num-range', doc.world);
} else if (isTime.test(term.text)) {
terms[0].tag('Time', 'time-range', doc.world);
terms[1].tag('Date', 'time-range', doc.world);
terms[2].tag('Time', 'time-range', doc.world);
} //make these terms implicit


terms.forEach(function (t) {
t.implicit = t.text;
t.text = '';
t.clean = ''; // remove whitespace for implicit terms

t.pre = '';
t.post = ''; // tag number-ranges

if (isNumber.test(t.implicit)) {
t.tag('Cardinal', 'num-range', doc.world);
} else if (isOrdinal.test(t.implicit)) {
t.tag('Ordinal', 'ord-range', doc.world);
} else if (isTime.test(t.implicit)) {
t.tag('Time', 'time-range', doc.world);
} else if (Object.keys(t.tags).length === 0) {
t.post = '';

if (Object.keys(t.tags).length === 0) {
t.tags.Noun = true; // if no tag, give it a noun
}
});
Expand Down Expand Up @@ -13858,9 +13866,7 @@ var Quotations = addMethod$2;

// walked => walk - turn a verb into it's root form
var toInfinitive = function toInfinitive(parsed, world) {
var verb = parsed.verb; // console.log(parsed)
// verb.debug()
//1. if it's already infinitive
var verb = parsed.verb; //1. if it's already infinitive

var str = verb.text('reduced');

Expand Down
58 changes: 37 additions & 21 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,78 @@ compromise uses semver, and pushes to npm frequently

While all _Major_ releases should be reviewed, our only two _large_ releases are **v6** in 2016 and and **v12** in 2019. Others have been mostly incremental, or niche.

<!-- #### [Unreleased]
<!-- #### [Unreleased]
-->
#### 13.10.5 [March 2021]

#### 13.10.6 [April 2021]

- **[fix]** - support more time-ranges
_plugin-releases_: [email protected]

#### 13.10.5 [March 2021]

- **[new]** - support Time-range like '3pm-4pm'
- **[change]** - cleanup some unicode regexes
*plugin-releases*: dates
_plugin-releases_: dates

#### 13.10.4 [March 2021]

#### 13.10.4 [March 2021]
- **[fix]** - match syntax tokenization fix
- **[change]** - improved performance monitoring

#### 13.10.3 [March 2021]

#### 13.10.3 [March 2021]

- **[fix]** - support complicated regular-expressions in match syntax
- improved performance testing

#### 13.10.2 [March 2021]

#### 13.10.2 [March 2021]

- **[fix]** - support matching implicit terms in (or|blocks)
- **[change]** - add #Timezone tag (from date-plugin)
- **[change]** - add many more cities and regions

#### 13.10.1 [March 2021]

- **[change]** - #Date terms can still be a #Conjunction
- **[new]** - #Imperative tag and `.verbs().isImperative()` method
- **[fix]** - some tagger issues
- update deps
*plugin-releases*: dates

_plugin-releases_: dates

#### 13.10.0 [Feb 2021]

- **[new]** - #Fraction tag and improved fraction support (thanks Jakeii!)
- **[fix]** - edge-case match issues with `!` syntax
- **[change]** - update deps
- updates for `[email protected]`, `[email protected]`

#### 13.9.3 [Feb 2021]

- **[fix]** - fix weird ordering issue with named exports #815

#### 13.9.2 [Feb 2021]

- **[fix]** - typescript issue

#### 13.9.1 [Feb 2021]
- **[fix]** - matches over a contraction

- **[fix]** - matches over a contraction
- **[new]** - add 'implicit' text output

#### 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] (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]

- **[change]** improved support for fractions in numbers-plugin #793
- **[change]** remove zero-width characters in normalized output #759
- **[change]** improved Person tagging with particles #794
Expand All @@ -86,8 +102,8 @@ While all _Major_ releases should be reviewed, our only two _large_ releases are
- **[new]** - support `.apppend(doc)` and `.prepend(doc)`
- **[new]** - `values.normalize()` method


#### 13.7.0 [Oct 2020]

- **[change]** many misc tagging fixes
- 'if' is now a #Preposition
- possessive pronouns are #Pronoun and #Possessive
Expand Down Expand Up @@ -185,8 +201,8 @@ _major changes to `.export()` and `[capture] group` match-syntax._

modifications:

- **[fix]** - nlp.clone() - hasn't worked properly, since v12. (@Drache93)
- **[fix]** - issues with greedy capture [*] and [.+] -(@Drache93) 💛
- **[fix]** - nlp.clone() - hasn't worked properly, since v12. (@Drache93)
- **[fix]** - issues with greedy capture [*] and [.+] -(@Drache93) 💛
- add whitespace properties (pre+post) to default json output (suppress with `.json({ whitespace: false })`)
- `.lookup({ key: val })` with an object now returns an object back ({val: Doc})
- add nlp constructor as a third param to `.extend()`
Expand All @@ -197,10 +213,10 @@ modifications:
- allow null results in `.map()` function
- better typescript support
- allow longer acronyms
- **[fix]** - offset length issue
- **[new]** - add new named-match syntax, with .groups() method (@Drache93)
- **[new]** - add `nlp.fromJSON()` method
- **[new]** - add a new `compromise-tokenize.js` build, without the tagger, or data included.
- **[fix]** - offset length issue
- **[new]** - add new named-match syntax, with .groups() method (@Drache93)
- **[new]** - add `nlp.fromJSON()` method
- **[new]** - add a new `compromise-tokenize.js` build, without the tagger, or data included.

#### 12.3.0 [Jan 2020]

Expand Down
21 changes: 12 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Spencer Kelly <[email protected]> (http://spencermounta.in)",
"name": "compromise",
"description": "modest natural language processing",
"version": "13.10.5",
"version": "13.10.6",
"main": "./builds/compromise.js",
"unpkg": "./builds/compromise.min.js",
"module": "./builds/compromise.mjs",
Expand Down Expand Up @@ -75,7 +75,7 @@
"@babel/core": "7.13.14",
"@babel/preset-env": "7.13.12",
"@rollup/plugin-alias": "3.1.2",
"@rollup/plugin-commonjs": "17.1.0",
"@rollup/plugin-commonjs": "18.0.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "11.2.1",
"amble": "1.3.0",
Expand Down
Loading

0 comments on commit 9338d26

Please sign in to comment.