Skip to content

Commit

Permalink
13.10.2rc
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed Mar 12, 2021
1 parent 193b118 commit 1a0c425
Show file tree
Hide file tree
Showing 23 changed files with 5,977 additions and 593 deletions.
2 changes: 1 addition & 1 deletion builds/compromise-tokenize.js

Large diffs are not rendered by default.

57 changes: 48 additions & 9 deletions builds/compromise.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

57 changes: 48 additions & 9 deletions builds/compromise.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ While all _Major_ releases should be reviewed, our only two _large_ releases are
-->

#### 13.10.2
#### 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
Expand Down
1 change: 0 additions & 1 deletion data/places/cities.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,5 +493,4 @@ module.exports = [
'ranchi',
'shillong',
'shimla',
'thiruvananthapuram',
]
21 changes: 21 additions & 0 deletions data/places/places.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,25 @@ module.exports = [
'malibu',
'gay village',
'sunderland',

// places with their own timezones
'tahiti',
'chatham',
'pitcairn',
'azores',
'magadan',
'hovd',
'vostok',
'wake island',
'anadyr',
'samara',
'ulaanbaatar',
'krasnoyarsk',
'indochina',
'yakutsk',
'chamorro',
'chuuk',
'samara',
'kosrae',
'sakhalin',
]
4,651 changes: 4,168 additions & 483 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 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.1",
"version": "13.10.2",
"main": "./builds/compromise.js",
"unpkg": "./builds/compromise.min.js",
"module": "./builds/compromise.mjs",
Expand Down Expand Up @@ -70,8 +70,8 @@
"efrt-unpack": "2.2.0"
},
"devDependencies": {
"@babel/core": "7.13.8",
"@babel/preset-env": "7.13.9",
"@babel/core": "7.13.10",
"@babel/preset-env": "7.13.10",
"@rollup/plugin-alias": "3.1.2",
"@rollup/plugin-commonjs": "17.1.0",
"@rollup/plugin-json": "4.1.0",
Expand All @@ -80,7 +80,7 @@
"codecov": "3.8.1",
"efrt": "2.2.2",
"nyc": "^15.1.0",
"rollup": "2.40.0",
"rollup": "2.41.2",
"rollup-plugin-babel": "4.4.0",
"rollup-plugin-filesize-check": "0.0.1",
"rollup-plugin-terser": "7.0.2",
Expand Down
58 changes: 36 additions & 22 deletions plugins/dates/builds/compromise-dates.js

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

2 changes: 1 addition & 1 deletion plugins/dates/builds/compromise-dates.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugins/dates/builds/compromise-dates.min.js

Large diffs are not rendered by default.

58 changes: 36 additions & 22 deletions plugins/dates/builds/compromise-dates.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* compromise-dates 1.5.2 MIT */
/* compromise-dates 1.5.3 MIT */
function _typeof(obj) {
"@babel/helpers - typeof";

Expand Down Expand Up @@ -295,11 +295,10 @@ var tagDates = function tagDates(doc) {
//by 6pm
time.match('(by|before|after|at|@|about) #Time').tag('Time', 'preposition-time'); //7 7pm
// time.match('#Cardinal #Time').not('#Year').tag('Time', 'value-time')
//2pm est

time.match('#Time [(eastern|pacific|central|mountain)]', 0).tag('Date', 'timezone'); //6pm est

time.match('#Time [(est|pst|gmt)]', 0).tag('Date', 'timezone abbr');
// //2pm est
// time.match('#Time [(eastern|pacific|central|mountain)]', 0).tag('Date', 'timezone')
// //6pm est
// time.match('#Time [(est|pst|gmt)]', 0).tag('Date', 'timezone abbr')
} //'2020' bare input


Expand Down Expand Up @@ -439,15 +438,9 @@ var timeTagger = function timeTagger(doc) {

doc.match('#Date [at #Cardinal]', 0).notIf('#Year').tag('Time', here$2); // half an hour

doc.match('half an (hour|minute|second)').tag('Date', here$2); //eastern daylight time

doc.match('#Noun (standard|daylight|central|mountain)? time').tag('Timezone', here$2); //utc+5
doc.match('half an (hour|minute|second)').tag('Date', here$2); // in eastern time

doc.match('/^utc[+-][0-9]/').tag('Timezone', here$2);
doc.match('/^gmt[+-][0-9]/').tag('Timezone', here$2);
doc.match('(in|for|by|near|at) #Timezone').tag('Timezone', here$2); // 2pm eastern

doc.match('#Time [(eastern|mountain|pacific|central)]', 0).tag('Timezone', here$2);
doc.match('(in|for|by|near|at) #Timezone').tag('Timezone', here$2);
} // around four thirty


Expand Down Expand Up @@ -496,6 +489,28 @@ var tagIntervals = function tagIntervals(doc) {

var _06Intervals = tagIntervals;

// timezone abbreviations
// (from spencermountain/timezone-soft)
var zones = ['act', 'aft', 'akst', 'anat', 'art', 'azot', 'azt', 'bnt', 'bot', 'bt', 'cast', 'cat', 'cct', 'chast', 'chut', 'ckt', 'cvt', 'cxt', 'davt', 'eat', 'ect', 'fjt', 'fkst', 'fnt', 'gamt', 'get', 'gft', 'gilt', 'gyt', 'hast', 'hncu', 'hneg', 'hnnomx', 'hnog', 'hnpm', 'hnpmx', 'hntn', 'hovt', 'iot', 'irkt', 'jst', 'kgt', 'kost', 'lint', 'magt', 'mart', 'mawt', 'mmt', 'nct', 'nft', 'novt', 'npt', 'nrt', 'nut', 'nzst', 'omst', 'pet', 'pett', 'phot', 'phst', 'pont', 'pwt', 'ret', 'sakt', 'samt', 'sbt', 'sct', 'sret', 'srt', 'syot', 'taht', 'tft', 'tjt', 'tkt', 'tlt', 'tmt', 'tot', 'tvt', 'ulat', 'vut', 'wakt', 'wat', 'wet', 'wft', 'wit', 'wst', 'yekt'].reduce(function (h, str) {
h[str] = true;
return h;
}, {});

var tagTz = function tagTz(doc) {
// 4pm PST
var m = doc.match('#Time [#Acronym]', 0);

if (m.found) {
var str = m.text('reduced');

if (zones[str] === true) {
m.tag('Timezone', 'tz-abbr');
}
}
};

var _07Timezone = tagTz;

var here = 'fix-tagger'; //

var fixUp = function fixUp(doc) {
Expand Down Expand Up @@ -587,13 +602,17 @@ var fixUp = function fixUp(doc) {
return doc;
};

var _07Fixup = fixUp;
var _08Fixup = fixUp;

var methods$3 = [_00Basic, _01Values, _02Dates, _03Sections, _04Time, _05Shifts, _06Intervals, _07Fixup]; // normalizations to run before tagger
var methods$3 = [_00Basic, _01Values, _02Dates, _03Sections, _04Time, _05Shifts, _06Intervals, _07Timezone, _08Fixup]; // normalizations to run before tagger

var normalize$1 = function normalize(doc) {
// turn '20mins' into '20 mins'
doc.numbers().normalize(); // this is sorta problematic
if (typeof doc.numbers === 'function') {
doc.numbers().normalize();
} else {
console.warn("Warning: compromise-numbers plugin is not loaded.\n You should load this plugin \n - https://bit.ly/3t8RfFG");
}

return doc;
}; // run each of the taggers
Expand Down Expand Up @@ -632,11 +651,6 @@ var _tags = {
Holiday: {
isA: ['Date', 'Noun']
},
// 'PST'
Timezone: {
isA: ['Date', 'Noun'],
notA: ['Adjective', 'DateShift']
},
// 'two weeks before'
DateShift: {
isA: ['Date'],
Expand Down
4 changes: 4 additions & 0 deletions plugins/dates/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!-- #### [Unreleased]
-->
### 1.5.3 [March 2021]
- **[change]** - move Timezone tag to main lib
- **[change]** - support timezone-abbrevations

### 1.5.0 [March 2021]
- **[change]** - return dates in computer's timezone, unless set

Expand Down
Loading

0 comments on commit 1a0c425

Please sign in to comment.