From 95d89f5469d03bd6d0f41ffbe83380409308d439 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 10:36:37 -0500 Subject: [PATCH 01/18] mon tues consecutive dates tokenizer --- plugins/dates/scratch.js | 21 ++++++------------ plugins/dates/src/find.js | 19 +++++++++++++--- plugins/dates/tests/tokenizer.test.js | 32 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 plugins/dates/tests/tokenizer.test.js diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index 9e55dd816..fe2f745e1 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -16,20 +16,13 @@ const context = { // max_repeat: 50, } -let doc = nlp('2nd monday of february') -// let doc = nlp(`any mondays`) - -let dates = doc.dates(context) //.debug() -let date = dates.get(0) -console.log(date) -// console.log(JSON.stringify(json.date, null, 2)) -console.log('start: ', fmt(date.start)) -console.log(' end: ', fmt(date.end)) -// console.log('=-=-=-= here -=-=-=-') - -// console.log(nlp('it was ten after 9').debug().times().get()) -// console.log(nlp('around four oclock').times().get()) -// nlp('fourth quarter, 2002').debug() +let doc = nlp('tuesday - wednesday') +let dates = doc.dates(context).debug().get() +// console.log(dates) +dates.forEach((date) => { + console.log('start: ', fmt(date.start)) + console.log(' end: ', fmt(date.end)) +}) // ### hmmm // let doc = nlp('in the next three years') //.debug() diff --git a/plugins/dates/src/find.js b/plugins/dates/src/find.js index 0f24aba65..52a193499 100644 --- a/plugins/dates/src/find.js +++ b/plugins/dates/src/find.js @@ -29,15 +29,28 @@ const findDate = function (doc) { // 'tuesday, wednesday' m = dates.match('^[#WeekDay] #WeekDay$', 0) if (m.found) { - dates = dates.splitAfter(m) - dates = dates.not('^(and|or)') + if (m.first().has('@hasDash') === false) { + dates = dates.splitAfter(m) + dates = dates.not('^(and|or)') + } } + // 'tuesday, wednesday, and friday' - m = dates.match('#WeekDay #WeekDay and #WeekDay') + m = dates.match('#WeekDay #WeekDay and? #WeekDay') if (m.found) { dates = dates.splitOn('#WeekDay') dates = dates.not('^(and|or)') } + // 'june 5th, june 10th' + m = dates.match('[#Month #Value] #Month', 0) + if (m.found) { + dates = dates.splitAfter(m) + } + // 'june, august' + m = dates.match('[#Month] #Month', 0) + if (m.found) { + dates = dates.splitAfter(m) + } // for 20 minutes m = dates.match('for #Cardinal #Duration') diff --git a/plugins/dates/tests/tokenizer.test.js b/plugins/dates/tests/tokenizer.test.js new file mode 100644 index 000000000..0f5c911b5 --- /dev/null +++ b/plugins/dates/tests/tokenizer.test.js @@ -0,0 +1,32 @@ +const test = require('tape') +const nlp = require('./_lib') +const spacetime = require('spacetime') + +test('date-tokenizer', function (t) { + let arr = [ + ['june 5th, june 10th', 2], + ['monday, wednesday', 2], + ['monday, wednesday, friday', 3], + ['monday, wednesday, and friday', 3], + ['june to august', 1], + ['june or august', 2], + ['june 2020 or august', 2], + ['june, august 9th', 2], + ['mon tue fri', 3], + // 'to' + ['tuesday to friday', 1], + ['tuesday upto friday', 1], + ['tuesday until friday', 1], + ['tuesday - friday', 1], + ['tuesday, wednesday', 2], + ['tuesday or wednesday', 2], + // ['tuesday and wednesday', 2], + // ['june and august', 2], + ] + arr.forEach((a) => { + let dates = nlp(a[0]).dates() + t.equal(dates.length, a[1], a[0]) + }) + + t.end() +}) From 96f7c1e00c915cd3b8269dda8e1e70db5130f2cc Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 11:09:06 -0500 Subject: [PATCH 02/18] let dates still be conjunctions --- plugins/dates/scratch.js | 2 +- plugins/dates/src/find.js | 17 +++++++++-------- plugins/dates/tests/start-to-end.test.js | 2 +- plugins/dates/tests/tokenizer.test.js | 15 ++++++++++++--- src/World/tags/tags/misc.js | 2 +- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index fe2f745e1..15216b02a 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -16,7 +16,7 @@ const context = { // max_repeat: 50, } -let doc = nlp('tuesday - wednesday') +let doc = nlp('between monday and tuesday') let dates = doc.dates(context).debug().get() // console.log(dates) dates.forEach((date) => { diff --git a/plugins/dates/src/find.js b/plugins/dates/src/find.js index 52a193499..9feda547f 100644 --- a/plugins/dates/src/find.js +++ b/plugins/dates/src/find.js @@ -27,30 +27,31 @@ const findDate = function (doc) { dates = dates.not(m) } // 'tuesday, wednesday' - m = dates.match('^[#WeekDay] #WeekDay$', 0) + m = dates.match('^[#WeekDay] and? #WeekDay$', 0) if (m.found) { if (m.first().has('@hasDash') === false) { dates = dates.splitAfter(m) - dates = dates.not('^(and|or)') + dates = dates.not('^and') } } + // 'june, august' + m = dates.match('^[#Month] and? #Month #Ordinal?$', 0) + if (m.found) { + dates = dates.splitAfter(m) + dates = dates.not('^and') + } // 'tuesday, wednesday, and friday' m = dates.match('#WeekDay #WeekDay and? #WeekDay') if (m.found) { dates = dates.splitOn('#WeekDay') - dates = dates.not('^(and|or)') + dates = dates.not('^and') } // 'june 5th, june 10th' m = dates.match('[#Month #Value] #Month', 0) if (m.found) { dates = dates.splitAfter(m) } - // 'june, august' - m = dates.match('[#Month] #Month', 0) - if (m.found) { - dates = dates.splitAfter(m) - } // for 20 minutes m = dates.match('for #Cardinal #Duration') diff --git a/plugins/dates/tests/start-to-end.test.js b/plugins/dates/tests/start-to-end.test.js index da6640952..2d2f0f616 100644 --- a/plugins/dates/tests/start-to-end.test.js +++ b/plugins/dates/tests/start-to-end.test.js @@ -34,7 +34,7 @@ const tests = [ ['on february 22', 1], ['march 3rd and 4th', 2], - ['monday and tuesday', 2], + ['between monday and tuesday', 2], ['tuesday and wednesday next week', 2], ['march and april 2022', 61], ['first week of september', 7], diff --git a/plugins/dates/tests/tokenizer.test.js b/plugins/dates/tests/tokenizer.test.js index 0f5c911b5..9a9a44599 100644 --- a/plugins/dates/tests/tokenizer.test.js +++ b/plugins/dates/tests/tokenizer.test.js @@ -8,20 +8,29 @@ test('date-tokenizer', function (t) { ['monday, wednesday', 2], ['monday, wednesday, friday', 3], ['monday, wednesday, and friday', 3], + ['between monday and friday', 1], ['june to august', 1], ['june or august', 2], + ['june through august', 1], ['june 2020 or august', 2], - ['june, august 9th', 2], ['mon tue fri', 3], // 'to' ['tuesday to friday', 1], ['tuesday upto friday', 1], ['tuesday until friday', 1], + ['tuesday through friday', 1], ['tuesday - friday', 1], + ['tuesday - june 1st', 1], ['tuesday, wednesday', 2], ['tuesday or wednesday', 2], - // ['tuesday and wednesday', 2], - // ['june and august', 2], + // ---weird-- + ['between tuesday and friday', 1], + ['tuesday and friday', 2], + ['between june and august', 1], + // weird + ['june and august', 2], + ['june and august 2020', 1], + ['june, august 9th', 2], ] arr.forEach((a) => { let dates = nlp(a[0]).dates() diff --git a/src/World/tags/tags/misc.js b/src/World/tags/tags/misc.js index f0de340cf..49655dd79 100644 --- a/src/World/tags/tags/misc.js +++ b/src/World/tags/tags/misc.js @@ -29,7 +29,7 @@ module.exports = { // Dates: //not a noun, but usually is Date: { - notA: ['Verb', 'Conjunction', 'Adverb', 'Preposition', 'Adjective'], + notA: ['Verb', 'Adverb', 'Preposition', 'Adjective'], }, Month: { isA: ['Date', 'Singular'], From 4f9310dc156ccf322a1691880ddaa8ad5ed2187b Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 11:24:46 -0500 Subject: [PATCH 03/18] fix between weekday logic --- plugins/dates/src/02-ranges/ranges.js | 3 ++- plugins/dates/src/parseDate/units/_day.js | 9 +++++++++ plugins/dates/tests/end.test.js | 3 ++- plugins/dates/tests/start-to-end.test.js | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/dates/src/02-ranges/ranges.js b/plugins/dates/src/02-ranges/ranges.js index ff3512483..90e6b094a 100644 --- a/plugins/dates/src/02-ranges/ranges.js +++ b/plugins/dates/src/02-ranges/ranges.js @@ -15,10 +15,11 @@ module.exports = [ start = parseDate(start, context) let end = m.groups('end') end = parseDate(end, context) + end = end.before() if (start && end) { return { start: start, - end: end.before(), + end: end, } } return null diff --git a/plugins/dates/src/parseDate/units/_day.js b/plugins/dates/src/parseDate/units/_day.js index c1e385498..6155077b7 100644 --- a/plugins/dates/src/parseDate/units/_day.js +++ b/plugins/dates/src/parseDate/units/_day.js @@ -72,6 +72,15 @@ class WeekDay extends Day { this.d = this.d.day(this.weekDay) return this } + // the millescond before + before() { + this.d = this.d.minus(1, 'day') + this.d = this.d.endOf('day') + if (this.context.dayEnd) { + this.d = this.d.time(this.context.dayEnd) + } + return this + } } // like 'haloween' diff --git a/plugins/dates/tests/end.test.js b/plugins/dates/tests/end.test.js index fe68ab434..fa0879e73 100644 --- a/plugins/dates/tests/end.test.js +++ b/plugins/dates/tests/end.test.js @@ -19,7 +19,7 @@ let december = 11 const tests = [ { - today: [2016, february, 11], + today: [2016, february, 11], //thursday tests: [ ['on october 2nd', [2016, october, 2]], ['on 2nd of march', [2016, march, 2]], @@ -47,6 +47,7 @@ const tests = [ ['on the day after next', [2016, february, 13]], // ['the last weekend in october', [2016, october, 30]], // ['the last weekend this month', [2016, february, 27]], + ['between monday and tuesday', [2016, february, 15]], //'exclusive' between ], }, { diff --git a/plugins/dates/tests/start-to-end.test.js b/plugins/dates/tests/start-to-end.test.js index 2d2f0f616..d996c2f2d 100644 --- a/plugins/dates/tests/start-to-end.test.js +++ b/plugins/dates/tests/start-to-end.test.js @@ -34,7 +34,8 @@ const tests = [ ['on february 22', 1], ['march 3rd and 4th', 2], - ['between monday and tuesday', 2], + ['between monday and tuesday', 1], + ['between monday and wednesday', 2], ['tuesday and wednesday next week', 2], ['march and april 2022', 61], ['first week of september', 7], From 5ba85031a31fb7c0113b90f724d516551fdbbcdd Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 12:38:24 -0500 Subject: [PATCH 04/18] fix this-past-monday - tests passing --- plugins/dates/scratch.js | 9 +- .../src/parseDate/01-tokenize/04-relative.js | 33 +++-- .../src/parseDate/01-tokenize/07-weekday.js | 2 +- plugins/dates/src/parseDate/parse.js | 23 ++-- plugins/dates/src/parseDate/units/Unit.js | 3 + plugins/dates/src/parseDate/units/_day.js | 13 ++ plugins/dates/tests/week.test.js | 117 ++++++++++++++++++ 7 files changed, 164 insertions(+), 36 deletions(-) create mode 100644 plugins/dates/tests/week.test.js diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index 15216b02a..00cd177a0 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -7,17 +7,18 @@ nlp.extend(require('../../plugins/dates/src')) const fmt = (iso) => (iso ? spacetime(iso).format('{day-short} {nice} {year}') : '-') const context = { - // today: [2011, march, 28], //monday + // today: '2021-03-05', //on friday // today: '2000-01-01', // today: [2016, october, 4], //a tuesday - timezone: 'Canada/Pacific', + // timezone: 'Canada/Pacific', // dayStart: '8:00am', // dayEnd: '5:00pm', // max_repeat: 50, } -let doc = nlp('between monday and tuesday') -let dates = doc.dates(context).debug().get() +// let doc = nlp('this last monday') +let doc = nlp('this past monday') +let dates = doc.dates(context).get() // console.log(dates) dates.forEach((date) => { console.log('start: ', fmt(date.start)) diff --git a/plugins/dates/src/parseDate/01-tokenize/04-relative.js b/plugins/dates/src/parseDate/01-tokenize/04-relative.js index 8d693652a..5abeb6af2 100644 --- a/plugins/dates/src/parseDate/01-tokenize/04-relative.js +++ b/plugins/dates/src/parseDate/01-tokenize/04-relative.js @@ -1,38 +1,33 @@ // interpret 'this halloween' or 'next june' const parseRelative = function (doc) { - // avoid parsing 'last month of 2019' - // if (doc.has('^(this|current|next|upcoming|last|previous) #Duration')) { - // return null - // } - // parse 'this evening' - // let m = doc.match('^(next|last|this)$') - // if (m.found) { - // doc.remove(m) - // return doc.text('reduced') - // } - // but avoid parsing 'day after next' + // avoid parsing 'day after next' if (doc.has('(next|last|this)$')) { return null } - let rel = null + // next monday let m = doc.match('^this? (next|upcoming|coming)') if (m.found) { - rel = 'next' doc.remove(m) + return 'next' } + // 'this past monday' is not-always 'last monday' + m = doc.match('^this? (past)') + if (m.found) { + doc.remove(m) + return 'this-past' + } + // last monday m = doc.match('^this? (last|previous)') if (m.found) { - rel = 'last' doc.remove(m) + return 'last' } + // this monday m = doc.match('^(this|current)') if (m.found) { - rel = 'this' doc.remove(m) + return 'this' } - // finally, remove it from our text - // doc.remove('^(this|current|next|upcoming|last|previous)') - - return rel + return null } module.exports = parseRelative diff --git a/plugins/dates/src/parseDate/01-tokenize/07-weekday.js b/plugins/dates/src/parseDate/01-tokenize/07-weekday.js index 859abc10d..0eb883568 100644 --- a/plugins/dates/src/parseDate/01-tokenize/07-weekday.js +++ b/plugins/dates/src/parseDate/01-tokenize/07-weekday.js @@ -3,7 +3,7 @@ const parseWeekday = function (doc) { let day = doc.match('#WeekDay') if (day.found && !doc.has('^#WeekDay$')) { // handle relative-day logic elsewhere. - if (doc.has('(this|next|last) (next|upcoming|coming)? #WeekDay')) { + if (doc.has('(this|next|last) (next|upcoming|coming|past)? #WeekDay')) { return null } doc.remove(day) diff --git a/plugins/dates/src/parseDate/parse.js b/plugins/dates/src/parseDate/parse.js index d741f8ebe..43fadab38 100644 --- a/plugins/dates/src/parseDate/parse.js +++ b/plugins/dates/src/parseDate/parse.js @@ -39,7 +39,6 @@ const parseDate = function (doc, context) { let iso = context.today.format('iso-short') context.today = context.today.goto(context.timezone).set(iso) } - let unit = null //'in two days' unit = unit || parse.today(doc, context, { shift, time, rel }) @@ -51,6 +50,17 @@ const parseDate = function (doc, context) { unit = unit || parse.yearly(doc, context) // 'this june 2nd' unit = unit || parse.explicit(doc, context) + // debugging + // console.log('\n\n=-=-=-=-=-=-=-=-=-=-=-=Date-=-=-=-=-=-=-=-=-=-=-=-=-\n') + // console.log(` shift: ${JSON.stringify(shift)}`) + // console.log(` counter: `, counter) + // console.log(` rel: ${rel || '-'}`) + // console.log(` section: ${section || '-'}`) + // console.log(` time: ${time || '-'}`) + // console.log(` str: '${doc.text()}'`) + // console.log(' unit: ', unit, '\n') + // doc.debug() + // console.log('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n') if (!unit) { return null @@ -86,17 +96,6 @@ const parseDate = function (doc, context) { if (counter && counter.unit) { unit = transform.counter(unit, counter) } - // debugging - // console.log('\n\n=-=-=-=-=-=-=-=-=-=-=-=Date-=-=-=-=-=-=-=-=-=-=-=-=-\n') - // console.log(` shift: ${JSON.stringify(shift)}`) - // console.log(` counter: `, counter) - // console.log(` rel: ${rel || '-'}`) - // console.log(` section: ${section || '-'}`) - // console.log(` time: ${time || '-'}`) - // console.log(` str: '${doc.text()}'`) - // console.log(' unit: ', unit, '\n') - // doc.debug() - // console.log('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n') return unit } module.exports = parseDate diff --git a/plugins/dates/src/parseDate/units/Unit.js b/plugins/dates/src/parseDate/units/Unit.js index 059326e38..4000e6541 100644 --- a/plugins/dates/src/parseDate/units/Unit.js +++ b/plugins/dates/src/parseDate/units/Unit.js @@ -72,6 +72,9 @@ class Unit { if (rel === 'last') { return this.last() } + if (rel === 'this-past') { + return this.last() + } return this } applySection(section) { diff --git a/plugins/dates/src/parseDate/units/_day.js b/plugins/dates/src/parseDate/units/_day.js index 6155077b7..48af9b686 100644 --- a/plugins/dates/src/parseDate/units/_day.js +++ b/plugins/dates/src/parseDate/units/_day.js @@ -81,6 +81,19 @@ class WeekDay extends Day { } return this } + applyRel(rel) { + // console.log('=-=-=-= here -=-=-=-') + if (rel === 'next') { + return this.next() + } + if (rel === 'last') { + return this.last() + } + if (rel === 'this-past') { + return this.last() + } + return this + } } // like 'haloween' diff --git a/plugins/dates/tests/week.test.js b/plugins/dates/tests/week.test.js new file mode 100644 index 000000000..dc12dce78 --- /dev/null +++ b/plugins/dates/tests/week.test.js @@ -0,0 +1,117 @@ +const test = require('tape') +const nlp = require('./_lib') +const spacetime = require('spacetime') + +test('week-logic', function (t) { + let tests = [ + { + today: '2021-03-01', //on monday + tests: [ + ['monday', 'monday', 0], // today + ['tuesday', 'tuesday', 1], + ['wednesday', 'wednesday', 2], + ['thursday', 'thursday', 3], + ['friday', 'friday', 4], + ['saturday', 'saturday', 5], + ['sunday', 'sunday', 6], + // 'this' + ['this week', 'monday', 0], + ['this monday', 'monday', 0], // today + ['this tuesday', 'tuesday', 1], + ['this wednesday', 'wednesday', 2], + ['this thursday', 'thursday', 3], + ['this friday', 'friday', 4], + ['this weekend', 'saturday', 5], + ['this saturday', 'saturday', 5], + ['this sunday', 'sunday', 6], + //'last' + ['last week', 'monday', -7], + ['last monday', 'monday', -7], + ['last tuesday', 'tuesday', -6], + ['last wednesday', 'wednesday', -5], + ['last thursday', 'thursday', -4], + ['last friday', 'friday', -3], + ['last weekend', 'saturday', -2], + ['last saturday', 'saturday', -2], + ['last sunday', 'sunday', -1], + // this past + ['this past week', 'monday', -7], + ['this past monday', 'monday', -7], + // ['this past tuesday', 'tuesday', -6], + // ['this past wednesday', 'wednesday', -5], + // ['this past thursday', 'thursday', -4], + // ['this past friday', 'friday', -3], + // ['this past weekend', 'saturday', -2], + // ['this past saturday', 'saturday', -2], + // ['this past sunday', 'sunday', -1], + //'next' + ['next week', 'monday', 7], + ['next monday', 'monday', 7], + ['next tuesday', 'tuesday', 8], + ['next wednesday', 'wednesday', 9], + ['next thursday', 'thursday', 10], + ['next friday', 'friday', 11], + ['next weekend', 'saturday', 12], + ['next saturday', 'saturday', 12], + ['next sunday', 'sunday', 13], + ], + }, + { + today: '2021-03-05', //on friday + tests: [ + ['monday', 'monday', 3], + ['tuesday', 'tuesday', 4], + ['wednesday', 'wednesday', 5], + ['thursday', 'thursday', 6], + ['friday', 'friday', 0], // today + ['saturday', 'saturday', 1], + ['sunday', 'sunday', 2], + // 'this' + ['this week', 'monday', -4], //backward + ['this monday', 'monday', 3], + ['this tuesday', 'tuesday', 4], + ['this wednesday', 'wednesday', 5], + ['this thursday', 'thursday', 6], + ['this friday', 'friday', 0], // today + ['this weekend', 'saturday', 1], + ['this saturday', 'saturday', 1], + ['this sunday', 'sunday', 2], + //'last' + ['last week', 'monday', -7 - 4], + // ['last monday', 'monday', -7 - 4], + // ['last tuesday', 'tuesday', -7 - 3], + // ['last wednesday', 'wednesday', -7 - 2], + // ['last thursday', 'thursday', -7 - 1], + ['last friday', 'friday', -7], + ['last weekend', 'saturday', -6], + ['last saturday', 'saturday', -6], + ['last sunday', 'sunday', -5], + // //'next' + ['next week', 'monday', 3], + ['next monday', 'monday', 3 + 7], //hmm + // ['next tuesday', 'tuesday', 8], + // ['next wednesday', 'wednesday', 9], + // ['next thursday', 'thursday', 10], + ['next friday', 'friday', 7], + ['next weekend', 'saturday', 8], + ['next saturday', 'saturday', 8], + ['next sunday', 'sunday', 9], + ], + }, + ] + tests.forEach((obj) => { + let ctx = { today: obj.today } + let today = spacetime(obj.today) + obj.tests.forEach((a) => { + let dates = nlp(a[0]).dates(ctx).get() + t.equal(dates.length, 1, '[one date] ' + a[0]) + let s = spacetime(dates[0].start) + t.equal(s.format('day').toLowerCase(), a[1], '[day] ' + a[0]) + // compare isos + let want = today.add(a[2], 'day') + t.equal(want.format('iso-short'), s.format('iso-short'), `[${a[2]} days] '${a[0]}'`) + }) + }) + + t.end() +}) From 127d117b0dbb377686f751f3154ec96cd91eb3fc Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 14:58:38 -0500 Subject: [PATCH 05/18] fix last-X logic --- plugins/dates/README.md | 63 ++++++++++++++----- plugins/dates/changelog.md | 2 + plugins/dates/scratch.js | 14 ++--- plugins/dates/scripts/comparisons/chronic.rb | 12 ++++ .../scripts/comparisons/parsedatetime.py | 5 ++ .../dates/scripts/comparisons/sugar-date.js | 3 + plugins/dates/src/parseDate/units/Unit.js | 6 +- plugins/dates/src/parseDate/units/_day.js | 15 +++-- plugins/dates/tests/startDates.test.js | 14 +++-- plugins/dates/tests/week.test.js | 32 ++++++---- 10 files changed, 116 insertions(+), 50 deletions(-) create mode 100644 plugins/dates/scripts/comparisons/chronic.rb create mode 100644 plugins/dates/scripts/comparisons/parsedatetime.py create mode 100644 plugins/dates/scripts/comparisons/sugar-date.js diff --git a/plugins/dates/README.md b/plugins/dates/README.md index ab87da0f3..f5c6a6a96 100644 --- a/plugins/dates/README.md +++ b/plugins/dates/README.md @@ -254,55 +254,87 @@ nlp('in two days').dates(context).get() ## *Opinions*: -#### *Start of week:* +### *Start of week:* By default, weeks start on a Monday, and *'next week'* will run from Monday morning to Sunday night. This can be configued in spacetime, but right now we are not passing-through this config. -#### *Implied durations:* +### *Implied durations:* *'after October'* returns a range starting **Nov 1st**, and ending **2-weeks** after, by default. This can be configured by setting `punt` param in the context object: ```js doc.dates({punt: { month: 1 }}) ``` -#### *Future bias:* -*'May 7th'* will prefer a May 7th in the future +### *Future bias:* +*'May 7th'* will prefer a May 7th in the future. -#### *This/Next/Last:* -*'this/next/last week'* is mostly straight-forward. +The parser will return a past-date though, in the current-month: +```js +// from march 2nd +nlp('feb 30th').dates({today: '2021-02-01'}).get() + +``` -But *'this monday'* and *'monday'* is more ambiguous - here, it always refers to the future. On tuesday, saying 'this monday' means 'next monday'. As I understand it, this is the most-intuitive interpretation. Saying *'this monday'* on monday, is itself. +### *This/Next/Last:* +named-weeks or months eg *'this/next/last week'* are mostly straight-forward. + +#### *This monday* +A bare 'monday' will always refer to itself, or the upcoming monday. + +* Saying *'this monday'* on monday, is itself. +* Saying *'this monday'* on tuesday , is next week. Likewise, *'this june'* in June, is itself. *'this june'* in any other month, is the nearest June in the future. -Future versions of this library may look at sentence-tense to help disambiguate these dates - *'i paid on monday'* vs *'i will pay on monday'*. +Future versions of this library could look at sentence-tense to help disambiguate these dates - *'i paid on monday'* vs *'i will pay on monday'*. + +#### *Last monday* +If it's Tuesday, *'last monday'* will not mean yesterday. + +* Saying *'last monday'* on a tuesday will be -1 week. +* Saying *'a week ago monday'* will also work. +* Saying *'this past monday'* will return yesterday. + +For reference, **Wit.ai** & **chronic** libraries both return yesterday. **Natty** and **SugarJs** returns -1 week, like we do. + +*'last X'* can be less than 7 days backward, if it crosses a week starting-point: +* Saying *'last friday'* on a monday will be only a few days back. + +#### *Next Friday* +If it's Tuesday, *'next wednesday'* will not be tomorrow. It will be a week after tomorrow. + +* Saying *'next wednesday'* on a tuesday, will be +1 week. +* Saying *'a week wednesday'* will also be +1 week. +* Saying *'this coming wednesday'* will be tomorrow. + +For reference, **Wit.ai**, **chronic**, and **Natty** libraries all return tomorrow. **SugarJs** returns +1 week, like we do. -#### *Nth Week:* +### *Nth Week:* The first week of a month, or a year is the first week *with a thursday in it*. This is a weird, but widely-held standard. I believe it's a military formalism. It cannot be (easily) configued. This means that the start-date for *first week of January* may be a Monday in December, etc. As expected, *first monday of January* will always be in January. -#### *British/American ambiguity:* +### *British/American ambiguity:* by default, we use the same interpretation of dates as javascript does - we assume `01/02/2020` is Jan 2nd, (US-version) but allow `13/01/2020` to be Jan 13th (UK-version). This should be possible to configure in the near future. -#### *Seasons:* +### *Seasons:* By default, *'this summer'* will return **June 1 - Sept 1**, which is northern hemisphere ISO. Configuring the default hemisphere should be possible in the future. -#### *Day times:* +### *Day times:* There are some hardcoded times for *'lunch time'* and others, but mainly, a day begins at `12:00am` and ends at `11:59pm` - the last millisecond of the day. -#### *Invalid dates:* +### *Invalid dates:* compromise will tag anything that looks like a date, but not validate the dates until they are parsed. * *'january 34th 2020'* will return **Jan 31 2020**. * *'tomorrow at 2:62pm'* will return just return 'tomorrow'. * *'6th week of february* will return the 2nd week of march. * Setting an hour that's skipped, or repeated by a DST change will return the closest valid time to the DST change. -#### *Inclusive/exclusive ranges:* +### *Inclusive/exclusive ranges:* *'between january and march'* will include all of march. This is usually pretty-ambiguous normally. -#### *Misc:* +### *Misc:* * *'thursday the 16th'* - will set to the 16th, even if it's not thursday * *'in a few hours/years'* - in 2 hours/years * *'jan 5th 2008 to Jan 6th the following year'* - date-range explicit references @@ -350,6 +382,7 @@ The *[match-syntax](https://observablehq.com/@spencermountain/compromise-match-s ### See also * [Duckling](https://duckling.wit.ai/) - by wit.ai (facebook) +* [Sugarjs/dates](https://sugarjs.com/dates/) - by Andrew Plummer (js) * [Chronic](https://github.com/mojombo/chronic) - by Tom Preston-Werner (Ruby) * [SUTime](https://nlp.stanford.edu/software/sutime.shtml) - by Angel Chang, Christopher Manning (Java) * [Natty](http://natty.joestelmach.com/) - by Joe Stelmach (Java) diff --git a/plugins/dates/changelog.md b/plugins/dates/changelog.md index 3cba6b24c..be6d738d8 100644 --- a/plugins/dates/changelog.md +++ b/plugins/dates/changelog.md @@ -1,5 +1,7 @@ ### 1.4.1 [Jan 2021] - **[change]** - date tokenization of multiple AND and OR dates diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index 00cd177a0..26f2d4697 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -7,19 +7,13 @@ nlp.extend(require('../../plugins/dates/src')) const fmt = (iso) => (iso ? spacetime(iso).format('{day-short} {nice} {year}') : '-') const context = { - // today: '2021-03-05', //on friday - // today: '2000-01-01', - // today: [2016, october, 4], //a tuesday - // timezone: 'Canada/Pacific', - // dayStart: '8:00am', - // dayEnd: '5:00pm', - // max_repeat: 50, + // today: '2021-03-01', //monday + // today: '2021-03-02', //tuesday + today: '2016-03-05', //on friday } -// let doc = nlp('this last monday') -let doc = nlp('this past monday') +let doc = nlp('next monday') let dates = doc.dates(context).get() -// console.log(dates) dates.forEach((date) => { console.log('start: ', fmt(date.start)) console.log(' end: ', fmt(date.end)) diff --git a/plugins/dates/scripts/comparisons/chronic.rb b/plugins/dates/scripts/comparisons/chronic.rb new file mode 100644 index 000000000..3f4cd320c --- /dev/null +++ b/plugins/dates/scripts/comparisons/chronic.rb @@ -0,0 +1,12 @@ +require 'chronic' +# gem install chronic + +puts Chronic.parse('next wednesday') +# puts Chronic.parse('next wednesday', :now => Time.local(2021, 2, 1)) +# puts Chronic.parse('next wednesday', :now => Time.local(2021, 2, 2)) +# puts Chronic.parse('next wednesday', :now => Time.local(2021, 2, 3)) +# puts Chronic.parse('next wednesday', :now => Time.local(2021, 2, 4)) +# puts Chronic.parse('next wednesday', :now => Time.local(2021, 2, 5)) +# puts Chronic.parse('next wednesday', :now => Time.local(2021, 2, 6)) +# puts Chronic.parse('next wednesday', :now => Time.local(2021, 2, 7)) + #=> Mon Aug 28 12:00:00 PDT 2006 \ No newline at end of file diff --git a/plugins/dates/scripts/comparisons/parsedatetime.py b/plugins/dates/scripts/comparisons/parsedatetime.py new file mode 100644 index 000000000..ba1ca2a80 --- /dev/null +++ b/plugins/dates/scripts/comparisons/parsedatetime.py @@ -0,0 +1,5 @@ +import parsedatetime + +cal = parsedatetime.Calendar() + +cal.parse("tomorrow") \ No newline at end of file diff --git a/plugins/dates/scripts/comparisons/sugar-date.js b/plugins/dates/scripts/comparisons/sugar-date.js new file mode 100644 index 000000000..a90173ae8 --- /dev/null +++ b/plugins/dates/scripts/comparisons/sugar-date.js @@ -0,0 +1,3 @@ +const Sugar = require('sugar-date') //npm i --no-save sugar-date + +console.log(new Sugar.Date('last monday').full()) diff --git a/plugins/dates/src/parseDate/units/Unit.js b/plugins/dates/src/parseDate/units/Unit.js index 4000e6541..2cae35182 100644 --- a/plugins/dates/src/parseDate/units/Unit.js +++ b/plugins/dates/src/parseDate/units/Unit.js @@ -69,10 +69,8 @@ class Unit { if (rel === 'next') { return this.next() } - if (rel === 'last') { - return this.last() - } - if (rel === 'this-past') { + if (rel === 'last' || rel === 'this-past') { + // special 'this past' logic is handled in WeekDay return this.last() } return this diff --git a/plugins/dates/src/parseDate/units/_day.js b/plugins/dates/src/parseDate/units/_day.js index 48af9b686..3145a648b 100644 --- a/plugins/dates/src/parseDate/units/_day.js +++ b/plugins/dates/src/parseDate/units/_day.js @@ -82,16 +82,23 @@ class WeekDay extends Day { return this } applyRel(rel) { - // console.log('=-=-=-= here -=-=-=-') if (rel === 'next') { return this.next() } - if (rel === 'last') { - return this.last() - } + // the closest-one backwards if (rel === 'this-past') { return this.last() } + if (rel === 'last') { + let start = this.context.today.startOf('week') //.minus(1, 'second') + this.last() + // now we are in the past. + // are we still in 'this week' though? + if (this.d.isBefore(start) === false) { + this.last() // do it again + } + return this + } return this } } diff --git a/plugins/dates/tests/startDates.test.js b/plugins/dates/tests/startDates.test.js index 63089a673..5662a83f7 100644 --- a/plugins/dates/tests/startDates.test.js +++ b/plugins/dates/tests/startDates.test.js @@ -346,7 +346,7 @@ const tests = [ ], }, { - today: [2016, may, 11], + today: [2016, may, 11], //wednesday tests: [ ['july 5th', [2016, july, 5]], ['on july 5th', [2016, july, 5]], @@ -362,7 +362,7 @@ const tests = [ // ['after next week', [2016, may, 20]], ['two days before christmas', [2016, december, 23]], ['today', [2016, may, 11]], - // ['weds', [2016, may, 18]], + ['wednesday', [2016, may, 11]], ['in 8 days', [2016, may, 19]], ['between june 5th and august 19th 2017', [2016, june, 5]], //.... ['tomorrow early in the day', [2016, may, 12]], @@ -403,7 +403,7 @@ const tests = [ ['on sat', [2016, october, 8]], ['sunday', [2016, october, 9]], ['monday', [2016, october, 10]], - // ['tuesday', [2016, october, 11]], + ['tuesday', [2016, october, 4]], //this ['this wednesday', [2016, october, 5]], ['this thurs', [2016, october, 6]], @@ -411,7 +411,7 @@ const tests = [ ['this saturday', [2016, october, 8]], ['this sunday', [2016, october, 9]], ['this monday', [2016, october, 10]], - // ['this tuesday', [2016, october, 11]], + ['this tuesday', [2016, october, 4]], //next ['next wednesday', [2016, october, 12]], ['next thurs', [2016, october, 13]], @@ -426,7 +426,7 @@ const tests = [ ['last friday', [2016, september, 30]], ['last saturday', [2016, october, 1]], ['last sunday', [2016, october, 2]], - ['last monday', [2016, october, 3]], + ['last monday', [2016, september, 26]], ['last tuesday', [2016, september, 27]], //same logic for months ['this october', [2016, october, 1]], @@ -593,7 +593,9 @@ test('start dates', (t) => { let doc = nlp(a[0]) let json = doc.dates(context).json()[0] || {} let start = (json.date || {}).start - start = spacetime(start).format('iso-short') + if (start) { + start = spacetime(start).format('iso-short') + } t.equal(start, want, `[${today}] ${a[0]}`) }) }) diff --git a/plugins/dates/tests/week.test.js b/plugins/dates/tests/week.test.js index dc12dce78..471063d21 100644 --- a/plugins/dates/tests/week.test.js +++ b/plugins/dates/tests/week.test.js @@ -37,13 +37,13 @@ test('week-logic', function (t) { // this past ['this past week', 'monday', -7], ['this past monday', 'monday', -7], - // ['this past tuesday', 'tuesday', -6], - // ['this past wednesday', 'wednesday', -5], - // ['this past thursday', 'thursday', -4], - // ['this past friday', 'friday', -3], - // ['this past weekend', 'saturday', -2], - // ['this past saturday', 'saturday', -2], - // ['this past sunday', 'sunday', -1], + ['this past tuesday', 'tuesday', -6], + ['this past wednesday', 'wednesday', -5], + ['this past thursday', 'thursday', -4], + ['this past friday', 'friday', -3], + ['this past weekend', 'saturday', -2], + ['this past saturday', 'saturday', -2], + ['this past sunday', 'sunday', -1], //'next' ['next week', 'monday', 7], ['next monday', 'monday', 7], @@ -78,14 +78,24 @@ test('week-logic', function (t) { ['this sunday', 'sunday', 2], //'last' ['last week', 'monday', -7 - 4], - // ['last monday', 'monday', -7 - 4], - // ['last tuesday', 'tuesday', -7 - 3], - // ['last wednesday', 'wednesday', -7 - 2], - // ['last thursday', 'thursday', -7 - 1], + ['last monday', 'monday', -7 - 4], + ['last tuesday', 'tuesday', -7 - 3], + ['last wednesday', 'wednesday', -7 - 2], + ['last thursday', 'thursday', -7 - 1], ['last friday', 'friday', -7], ['last weekend', 'saturday', -6], ['last saturday', 'saturday', -6], ['last sunday', 'sunday', -5], + //'this past' + ['this past week', 'monday', -7 - 4], + ['this past monday', 'monday', -4], + ['this past tuesday', 'tuesday', -3], + ['this past wednesday', 'wednesday', -2], + ['this past thursday', 'thursday', -1], + ['this past friday', 'friday', -7], // + ['this past weekend', 'saturday', -6], + ['this past saturday', 'saturday', -6], + ['this past sunday', 'sunday', -5], // //'next' ['next week', 'monday', 3], ['next monday', 'monday', 3 + 7], //hmm From f823612705628031bb7e1cbe32d0ac483804d347 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 15:05:41 -0500 Subject: [PATCH 06/18] fix next X logic too --- plugins/dates/src/parseDate/units/_day.js | 11 ++++++++--- plugins/dates/tests/week.test.js | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/dates/src/parseDate/units/_day.js b/plugins/dates/src/parseDate/units/_day.js index 3145a648b..8418b02e9 100644 --- a/plugins/dates/src/parseDate/units/_day.js +++ b/plugins/dates/src/parseDate/units/_day.js @@ -83,16 +83,21 @@ class WeekDay extends Day { } applyRel(rel) { if (rel === 'next') { - return this.next() + let tooFar = this.context.today.endOf('week').add(1, 'week') + this.next() + // did we go too-far? + if (this.d.isAfter(tooFar)) { + this.last() // go back + } + return this } // the closest-one backwards if (rel === 'this-past') { return this.last() } if (rel === 'last') { - let start = this.context.today.startOf('week') //.minus(1, 'second') + let start = this.context.today.startOf('week') this.last() - // now we are in the past. // are we still in 'this week' though? if (this.d.isBefore(start) === false) { this.last() // do it again diff --git a/plugins/dates/tests/week.test.js b/plugins/dates/tests/week.test.js index 471063d21..e4b01d0c8 100644 --- a/plugins/dates/tests/week.test.js +++ b/plugins/dates/tests/week.test.js @@ -98,10 +98,10 @@ test('week-logic', function (t) { ['this past sunday', 'sunday', -5], // //'next' ['next week', 'monday', 3], - ['next monday', 'monday', 3 + 7], //hmm - // ['next tuesday', 'tuesday', 8], - // ['next wednesday', 'wednesday', 9], - // ['next thursday', 'thursday', 10], + ['next monday', 'monday', 3], + ['next tuesday', 'tuesday', 4], + ['next wednesday', 'wednesday', 5], + ['next thursday', 'thursday', 6], ['next friday', 'friday', 7], ['next weekend', 'saturday', 8], ['next saturday', 'saturday', 8], From b299b1e22e7d570d596d3785806a96d7e371c536 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 15:55:32 -0500 Subject: [PATCH 07/18] better duration-date splitting --- plugins/dates/scratch.js | 2 +- plugins/dates/src/find.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index 26f2d4697..cc8ffc480 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -12,7 +12,7 @@ const context = { today: '2016-03-05', //on friday } -let doc = nlp('next monday') +let doc = nlp('10 mins from now') let dates = doc.dates(context).get() dates.forEach((date) => { console.log('start: ', fmt(date.start)) diff --git a/plugins/dates/src/find.js b/plugins/dates/src/find.js index 9feda547f..b9fd4bee9 100644 --- a/plugins/dates/src/find.js +++ b/plugins/dates/src/find.js @@ -53,6 +53,11 @@ const findDate = function (doc) { dates = dates.splitAfter(m) } + // '20 minutes june 5th' + m = dates.match('[#Cardinal #Duration] #Date', 0) //but allow '20 minutes ago' + if (m.found && !dates.has('#Cardinal #Duration] (ago|from|before|after|back)')) { + dates = dates.not(m) + } // for 20 minutes m = dates.match('for #Cardinal #Duration') if (m.found) { From b29cefb6462c87de1470606fae2847dc5e2040d8 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 16:58:45 -0500 Subject: [PATCH 08/18] update spacetime hotfix --- plugins/dates/README.md | 22 ++++++++++ plugins/dates/package-lock.json | 76 +++++++++++++++++++++------------ plugins/dates/package.json | 4 +- plugins/dates/scratch.js | 2 +- 4 files changed, 73 insertions(+), 31 deletions(-) diff --git a/plugins/dates/README.md b/plugins/dates/README.md index f5c6a6a96..1b23a0c54 100644 --- a/plugins/dates/README.md +++ b/plugins/dates/README.md @@ -334,6 +334,28 @@ compromise will tag anything that looks like a date, but not validate the dates ### *Inclusive/exclusive ranges:* *'between january and march'* will include all of march. This is usually pretty-ambiguous normally. +### *Date greediness:* +This library makes no assumptions about the input text, and is careful to avoid false-positive dates. +If you know your text is a date, you can crank-up the date-tagger with a [compromise-plugin](https://observablehq.com/@spencermountain/compromise-plugins), like so: +```js +nlp.extend(function (Doc, world) { + // ambiguous words + world.addWords({ + weds: 'WeekDay', + wed: 'WeekDay', + sat: 'WeekDay', + sun: 'WeekDay', + }) + world.postProcess((doc) => { + // tag '2nd quarter' as a date + doc.match('#Ordinal quarter').tag('#Date') + // tag '2/2' as a date (not a fraction) + doc.match('/[0-9]{1,2}/[0-9]{1,2}/').tag('#Date') + }) +}) +``` + + ### *Misc:* * *'thursday the 16th'* - will set to the 16th, even if it's not thursday * *'in a few hours/years'* - in 2 hours/years diff --git a/plugins/dates/package-lock.json b/plugins/dates/package-lock.json index 9a60a95bd..790c01e8d 100644 --- a/plugins/dates/package-lock.json +++ b/plugins/dates/package-lock.json @@ -325,25 +325,27 @@ } }, "es-abstract": { - "version": "1.18.0-next.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.2.tgz", - "integrity": "sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw==", + "version": "1.18.0-next.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.3.tgz", + "integrity": "sha512-VMzHx/Bczjg59E6jZOQjHeN3DEoptdhejpARgflAViidlqSpjdq9zA6lKwlhRRs/lOw1gHJv2xkkSFRgvEwbQg==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2", + "get-intrinsic": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", + "has-symbols": "^1.0.2", + "is-callable": "^1.2.3", "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.1", + "is-regex": "^1.1.2", + "is-string": "^1.0.5", "object-inspect": "^1.9.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.3", - "string.prototype.trimstart": "^1.0.3" + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.0" } }, "es-get-iterator": { @@ -461,6 +463,12 @@ "function-bind": "^1.1.1" } }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -468,9 +476,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, "inflight": { @@ -942,9 +950,9 @@ "dev": true }, "spacetime": { - "version": "6.12.5", - "resolved": "https://registry.npmjs.org/spacetime/-/spacetime-6.12.5.tgz", - "integrity": "sha512-6TZXbkG23RCpu6L955rLH3SaPoFpl75dB/lumRnop8VTNf6Ui9S+Bn0p8Hwv6xEXKSYTxNCj4avTuoVEyWNwIg==" + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/spacetime/-/spacetime-6.13.0.tgz", + "integrity": "sha512-gHOtAjPG2e2VK7o9yNevMrj9oJcACrazTI6pER97PfPF2Vdmp10aJPYc0QnrPmB6zHFJtbVboPk296rIICi0lw==" }, "spacetime-holiday": { "version": "0.1.0", @@ -972,22 +980,22 @@ } }, "string.prototype.trimend": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", - "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", "dev": true, "requires": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3" } }, "string.prototype.trimstart": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", - "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", "dev": true, "requires": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3" } }, @@ -1091,9 +1099,9 @@ } }, "tape": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/tape/-/tape-5.2.0.tgz", - "integrity": "sha512-J7stlwNrBEpHlZvbvPEAFvMmqIy79kMYvXiyekl5w6O7C2HF63bFKi8su70mdUtZZvNMm7EbIzLyI+fk6U9Ntg==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.2.1.tgz", + "integrity": "sha512-pjrC4M7OUCndgKNJ9AEy/WCfOd8Voux6pD/WlzRi0855ZZa66nPFlisCtPixA5Phh/V/tu6v8Q1cNRND9AcYMA==", "dev": true, "requires": { "call-bind": "^1.0.2", @@ -1107,11 +1115,11 @@ "is-regex": "^1.1.2", "minimist": "^1.2.5", "object-inspect": "^1.9.0", - "object-is": "^1.1.4", + "object-is": "^1.1.5", "object.assign": "^4.1.2", "resolve": "^2.0.0-next.3", "resumer": "^0.0.0", - "string.prototype.trim": "^1.2.3", + "string.prototype.trim": "^1.2.4", "through": "^2.3.8" }, "dependencies": { @@ -1156,6 +1164,18 @@ "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", "dev": true }, + "unbox-primitive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz", + "integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.0", + "has-symbols": "^1.0.0", + "which-boxed-primitive": "^1.0.1" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/plugins/dates/package.json b/plugins/dates/package.json index 411d40f9d..f11048e09 100644 --- a/plugins/dates/package.json +++ b/plugins/dates/package.json @@ -45,10 +45,10 @@ "rollup-plugin-filesize-check": "0.0.1", "rollup-plugin-terser": "7.0.2", "tap-dancer": "0.3.1", - "tape": "5.2.0" + "tape": "5.2.1" }, "dependencies": { - "spacetime": "6.12.5", + "spacetime": "6.13.0", "spacetime-holiday": "0.1.0" }, "license": "MIT" diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index cc8ffc480..a476fc1e6 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -12,7 +12,7 @@ const context = { today: '2016-03-05', //on friday } -let doc = nlp('10 mins from now') +let doc = nlp('weds').debug() let dates = doc.dates(context).get() dates.forEach((date) => { console.log('start: ', fmt(date.start)) From 667527a703a74336879d40c46d98ba267344c054 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Tue, 2 Mar 2021 17:32:27 -0500 Subject: [PATCH 09/18] changelog --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 5c972cd95..e9cd527a1 100644 --- a/changelog.md +++ b/changelog.md @@ -9,7 +9,7 @@ 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. #### 13.10.0 [Feb 2021] From a293e031a4f3a990bad9d6e607455284561427ca Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Wed, 3 Mar 2021 12:36:34 -0500 Subject: [PATCH 10/18] tagger fixes, Imperative tag. tests passing --- changelog.md | 3 + scratch.js | 26 ++++++-- src/02-tagger/04-correction/fixMisc.js | 20 +++++- .../04-correction/matches/03-adjective.js | 2 + .../04-correction/matches/05-adverb.js | 7 +- src/Subset/Verbs/conjugate/imperative.js | 64 ++++++++++++------- src/Subset/Verbs/methods.js | 8 ++- src/World/tags/tags/verbs.js | 5 ++ tests/verbs/imperative.test.js | 46 +++++++++++-- 9 files changed, 144 insertions(+), 37 deletions(-) diff --git a/changelog.md b/changelog.md index e9cd527a1..3deab202b 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,9 @@ While all _Major_ releases should be reviewed, our only two _large_ releases are #### 13.10.0 [Feb 2021] diff --git a/scratch.js b/scratch.js index 9fbc49059..c05405488 100644 --- a/scratch.js +++ b/scratch.js @@ -1,6 +1,7 @@ const nlp = require('./src/index') -nlp.extend(require('./plugins/numbers/src')) -nlp.extend(require('./plugins/dates/src')) +// nlp.extend(require('./plugins/numbers/src')) +// nlp.extend(require('./plugins/dates/src')) +nlp.extend(require('./plugins/sentences/src')) // nlp.verbose(true) // @@ -13,8 +14,21 @@ nlp.extend(require('./plugins/dates/src')) // complex denominators - 'one fifty fourths', 'one thirty third' // -// let doc = nlp(`30mins tuesday`).debug() -let doc = nlp(`for 20 mins`).debug() -// let doc = nlp(`in 20 mins`).debug() -console.log(doc.dates().get()) +// let doc = nlp('i should drive') +// doc.sentences().toPastTense().debug() + +// let doc = nlp(`shut the door`).debug() +// let doc = nlp(`do you eat?`) //.debug() +let doc = nlp(`the service is fast`).debug() + +// let vb = doc.verbs().clone(true) +// vb.sentences().debug() +// doc.verbs().isImperative().debug() +// doc.sentences().toPastTense().debug() + +// console.log(doc.dates().get()) // console.log(doc.durations().get(0)) + +// possible match-bug: +// let doc = nlp(`go fast john!`).debug() +// s.has('^#Infinitive #Adverb? #Noun?$') diff --git a/src/02-tagger/04-correction/fixMisc.js b/src/02-tagger/04-correction/fixMisc.js index 22990f79a..48f52410b 100644 --- a/src/02-tagger/04-correction/fixMisc.js +++ b/src/02-tagger/04-correction/fixMisc.js @@ -11,8 +11,26 @@ const hasTag = function (doc, tag) { //mostly pos-corections here const miscCorrection = function (doc) { + doc.cache() + // imperative-form + let m = doc.if('#Infinitive') + if (m.found) { + // you eat? + m = m.ifNo('@hasQuestionMark') + // i speak + m = m.ifNo('(i|we|they)') + // shut the door! + m.match('[#Infinitive] (#Determiner|#Possessive) #Noun', 0).tag('Imperative', 'shut-the') + // go-fast + m.match('^[#Infinitive] #Adverb?$', 0).tag('Imperative', 'go-fast') + // do not go + m.match('[(do && #Infinitive)] not? #Verb', 0).tag('Imperative', 'do-not') + // do it + m.match('[#Infinitive] (it|some)', 0).tag('Imperative', 'do-it') + } + //exactly like - let m = hasWord(doc, 'like') + m = hasWord(doc, 'like') m.match('#Adverb like') .notIf('(really|generally|typically|usually|sometimes|often|just) [like]') .tag('Adverb', 'adverb-like') diff --git a/src/02-tagger/04-correction/matches/03-adjective.js b/src/02-tagger/04-correction/matches/03-adjective.js index be66e6be7..9c83ec873 100644 --- a/src/02-tagger/04-correction/matches/03-adjective.js +++ b/src/02-tagger/04-correction/matches/03-adjective.js @@ -48,6 +48,8 @@ let list = [ { match: 'a (little|bit|wee) bit? [#Gerund]', group: 0, tag: 'Adjective', reason: 'a-bit-gerund' }, // jury is out - preposition ➔ adjective { match: '#Copula #Adjective? [(out|in|through)]$', group: 0, tag: 'Adjective', reason: 'still-out' }, + // shut the door + { match: '^[#Adjective] (the|your) #Noun', group: 0, tag: 'Infinitive', reason: 'shut-the' }, ] module.exports = list diff --git a/src/02-tagger/04-correction/matches/05-adverb.js b/src/02-tagger/04-correction/matches/05-adverb.js index ee7800a59..88c01f200 100644 --- a/src/02-tagger/04-correction/matches/05-adverb.js +++ b/src/02-tagger/04-correction/matches/05-adverb.js @@ -23,7 +23,12 @@ module.exports = [ // even left { match: 'even left', tag: '#Adverb #Verb', reason: 'even-left' }, //cheering hard - dropped -ly's - { match: '#PresentTense [(hard|quick|long|bright|slow)]', group: 0, tag: 'Adverb', reason: 'lazy-ly' }, + { + match: '(#PresentTense && !#Copula) [(hard|quick|long|bright|slow|fast|backwards|forwards)]', + group: 0, + tag: 'Adverb', + reason: 'lazy-ly', + }, // much appreciated { match: '[much] #Adjective', group: 0, tag: 'Adverb', reason: 'bit-1' }, // is well diff --git a/src/Subset/Verbs/conjugate/imperative.js b/src/Subset/Verbs/conjugate/imperative.js index f976dea23..433a8731f 100644 --- a/src/Subset/Verbs/conjugate/imperative.js +++ b/src/Subset/Verbs/conjugate/imperative.js @@ -1,29 +1,47 @@ // verb-phrases that are orders - 'close the door' // these should not be conjugated -exports.isImperative = function (parsed) { - // do the dishes - if (parsed.auxiliary.has('do')) { - return true - } +const isImperative = function (parsed) { + // console.log(parsed) + let vb = parsed.original + let aux = parsed.auxiliary + let subj = parsed.subject + // speak the truth - // if (parsed.verb.has('^#Infinitive')) { - // // 'i speak' is not imperative - // if (parsed.subject.has('(i|we|you|they)')) { - // return false - // } - // return true - // } + if (parsed.verb.has('^#Infinitive')) { + // get the *actual* full sentence (awk) + let s = vb.parents()[0] || vb + // s = s.sentence() + // s.debug() + // s.sentence().debug() + // s.debug() + // you eat? + if (s.has('@hasQuestionMark')) { + return false + } + // 'i speak' is not imperative + if (subj.has('(i|we|they)')) { + return false + } + // do the dishes + if (aux.has('do')) { + return true + } + // go fast! + if (s.has('^#Infinitive #Adverb?$')) { + // s.debug() + // console.log('=-=-=-= here -=-=-=-') + return true + } + // 'you should speak' is + if (aux.has('(should|must)')) { + return true + } + // shut the door + if (s.has('^#Infinitive (#Determiner|#Possessive) #Noun')) { + return true + } + } return false } -// // basically, don't conjugate it -// exports.toImperative = function (parsed) { -// let str = parsed.original.text() -// let res = { -// PastTense: str, -// PresentTense: str, -// FutureTense: str, -// Infinitive: str, -// } -// return res -// } +module.exports = isImperative diff --git a/src/Subset/Verbs/methods.js b/src/Subset/Verbs/methods.js index 83ddca45b..9ea565ec3 100644 --- a/src/Subset/Verbs/methods.js +++ b/src/Subset/Verbs/methods.js @@ -3,7 +3,7 @@ const parseVerb = require('./parse') const isPlural = require('./isPlural') const getSubject = require('./getSubject') const conjugate = require('./conjugate') -const isImperative = require('./conjugate/imperative').isImperative +const isImperative = require('./conjugate/imperative') const { toParticiple, useParticiple } = require('./participle') // remove any tense-information in auxiliary verbs @@ -116,7 +116,7 @@ module.exports = { toParticiple(parsed, this.world) return } - if (isImperative(parsed)) { + if (isImperative(parsed, vb)) { return } // don't conjugate 'to be' @@ -234,6 +234,10 @@ module.exports = { isPositive: function () { return this.ifNo('#Negative') }, + /** return only commands - verbs in imperative mood */ + isImperative: function () { + return this.if('#Imperative') + }, /** add a 'not' to these verbs */ toNegative: function () { this.list.forEach(p => { diff --git a/src/World/tags/tags/verbs.js b/src/World/tags/tags/verbs.js index e3c2e0b04..cff942f02 100644 --- a/src/World/tags/tags/verbs.js +++ b/src/World/tags/tags/verbs.js @@ -12,6 +12,11 @@ module.exports = { isA: 'PresentTense', notA: ['PastTense', 'Gerund'], }, + //close the door! + Imperative: { + isA: 'Infinitive', + // notA: ['PresentTense', 'PastTense', 'FutureTense', 'Gerund'], + }, // walking Gerund: { isA: 'PresentTense', diff --git a/tests/verbs/imperative.test.js b/tests/verbs/imperative.test.js index 3da3c37e1..3a98b29bd 100644 --- a/tests/verbs/imperative.test.js +++ b/tests/verbs/imperative.test.js @@ -1,15 +1,53 @@ const test = require('tape') const nlp = require('../_lib') +test('isImperative:', function (t) { + let arr = [ + ['do speak', true], + ['do not walk', true], + ['please do not speak', true], + ['go!', true], + ['go fast.', true], + ["don't go", true], + ['shut the door', true], + ['eat your vegetables', true], + ['you should eat your vegetables', true], + ['you eat?', false], + ['do you eat?', false], + ['i often use the stairs', false], + ['i ate at the bar', false], + ['walk the plank', true], + ['turn down the music', true], + ['is it over', false], + ['save some for me please', true], + // ['stay real', true], + ['stay the course', true], + // ['stay out of my garden', true], + ['return my hat', true], + ['swim carefully', true], + ['go backwards', true], + ['walking is allowed', false], + // ['stay away from death mountain', true], + // ['never lie', true], + // ['keep it quiet', true], + ] + arr.forEach(function (a) { + const doc = nlp(a[0]) + let m = doc.verbs().isImperative() + t.equal(m.found, a[1], `[isImperative] ${a[0]}`) + }) + t.end() +}) + test('imperative keeps tense:', function (t) { let arr = [ 'do speak', 'do not walk', 'please do not speak', - // 'go!', - // "don't go", - // 'shut the door', - // 'eat your vegetables', + 'go!', + "don't go", + 'shut the door', + 'eat your vegetables', // 'you should eat your vegetables', ] arr.forEach(function (str) { From 839c624d24974c8508a8babea967193b22b372eb Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Wed, 3 Mar 2021 14:32:57 -0500 Subject: [PATCH 11/18] rewrite perf script to minimize thrash --- scripts/test/speed/_performance.json | 35 ------ scripts/test/speed/_regression.js | 24 ---- scripts/test/speed/index.js | 148 ++++++++++++++--------- src/Subset/Verbs/conjugate/imperative.js | 47 ------- src/Subset/Verbs/methods.js | 3 +- 5 files changed, 95 insertions(+), 162 deletions(-) delete mode 100644 scripts/test/speed/_performance.json delete mode 100644 scripts/test/speed/_regression.js delete mode 100644 src/Subset/Verbs/conjugate/imperative.js diff --git a/scripts/test/speed/_performance.json b/scripts/test/speed/_performance.json deleted file mode 100644 index 424413009..000000000 --- a/scripts/test/speed/_performance.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "x": [ - 10, - 27, - 46, - 487, - 788, - 24453, - 27712, - 36354, - 39577, - 39660, - 54897 - ], - "y": [ - 3, - 2.2, - 5.2, - 11.8, - 20.8, - 408.8, - 430.4, - 368.8, - 504.6, - 424, - 990 - ], - "key": { - "x": "Length", - "y": "Time" - }, - "diff": "3.72727", - "regression": "0.01447X - -6.61195", - "average": "288.14545" -} \ No newline at end of file diff --git a/scripts/test/speed/_regression.js b/scripts/test/speed/_regression.js deleted file mode 100644 index cfe83b9f0..000000000 --- a/scripts/test/speed/_regression.js +++ /dev/null @@ -1,24 +0,0 @@ -function calculateRegression(x, y) { - const sumX = x.reduce((acc, v) => acc + v, 0) - const sumY = y.reduce((acc, v) => acc + v, 0) - - const avgX = sumX / x.length - const avgY = sumY / y.length - - let sumSqX = 0 - for (let i = 0; i < x.length; i++) { - sumSqX += Math.pow(x[i] - avgX, 2) // this will never change unless we add more tests... - } - - let sumP = 0 - for (let i = 0; i < y.length; i++) { - sumP += (x[i] - avgX) * (y[i] - avgY) - } - - const b = sumP / sumSqX - const a = avgY - b * avgX - const result = `${b.toFixed(5)}X ${a > 0 ? '+' : '-'} ${a.toFixed(5)}` - - return { regression: result, average: avgY.toFixed(5) } -} -module.exports = calculateRegression diff --git a/scripts/test/speed/index.js b/scripts/test/speed/index.js index 1f0ee29dc..a3bee76df 100644 --- a/scripts/test/speed/index.js +++ b/scripts/test/speed/index.js @@ -1,65 +1,105 @@ -const nlp = require('../../../tests/_lib') -const fs = require('fs') -const path = require('path') +// https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color +const reset = '\x1b[0m' const fetch = require('./_fetch') -const calculateRegression = require('./_regression') +let nlp = require('../../../tests/_lib') +const highlight = 5 +const shouldFail = -10 -const TEST_COUNT = 5 -const node_version = 'v10.13.0' -if (node_version !== process.version) { - console.log("\n(running '" + process.version + "' instead of '" + node_version + "')\n") +//cheaper than requiring chalk +const cli = { + green: function (str) { + return '\x1b[32m' + str + reset + }, + red: function (str) { + return '\x1b[31m' + str + reset + }, + grey: function (str) { + return '\x1b[90m' + str + reset + }, } -fetch('https://unpkg.com/nlp-corpus@3.3.0/builds/nlp-corpus-1.json').then(res => { - const outputPath = path.join(__dirname, './_performance.json') - let expected = {} - if (fs.existsSync(outputPath)) { - expected = JSON.parse(fs.readFileSync(outputPath)) - } - - const textArr = res.sort((a, b) => a.length - b.length) - const x = [] - const y = [] +if (!process.version.match(/^v12\./)) { + console.warn(cli.red('Warn: Expecting node v12.x')) +} - const full = Date.now() - for (let i = 0; i < textArr.length; i++) { - const text = textArr[i] - const yI = [] +let matches = [ + 'out of range', + '#Person #Person', + '. of the world', + '#Noun+ house', + 'range #Noun+', + 'doubt . of #Verb', + '(watch|house|#Verb) .', + '(watch|house|#Verb)?', + '(watch a film|eat a cake)+', + '(#Noun of #Noun)+', + '. @hasQuestionMark', + 'the .+', + 'keep a #Noun', +] - console.group('Text', i) +let documents = [ + ['nlp-corpus-1.json', 5.2], + ['nlp-corpus-2.json', 5.5], + ['nlp-corpus-3.json', 4.6], + ['nlp-corpus-4.json', 4.6], + ['nlp-corpus-5.json', 4.5], + ['nlp-corpus-6.json', 4.7], + ['nlp-corpus-7.json', 4.3], + ['nlp-corpus-8.json', 4.5], + ['nlp-corpus-9.json', 4.1], + ['nlp-corpus-10.json', 4.3], +] +const round = n => Math.round(n * 100) / 100 - for (let j = 0; j < TEST_COUNT; j++) { - const _nlp = nlp.clone() // Avoid caching? - const start = Date.now() - _nlp(text) - const end = Date.now() - const diff = end - start - console.log(' ' + diff + ' ms') - yI.push(diff) +const nice = function (n) { + if (n > highlight) { + n = cli.red('+' + Math.abs(n) + '%') + } else if (n < -highlight) { + n = cli.green('' + n + '%') + } else { + if (n > 0) { + n = '+' + n } - - x.push(text.length) - y.push(yI.reduce((acc, v) => acc + v, 0) / yI.length) - - console.groupEnd() + n = cli.grey(' ' + n + '%') } + return n +} - const regression = calculateRegression(x, y) - const diff = Math.abs(regression.average - expected.average).toFixed(5) - const results = Object.assign({ x, y, key: { x: 'Length', y: 'Time' }, diff }, regression) - - // fs.writeFileSync(outputPath, JSON.stringify(results, null, 2)) - - console.log('\n') - console.log('Expected:', Math.ceil(expected.average) + 'ms') - console.log('Current :', Math.ceil(results.average) + 'ms') - console.log('Diff:', Math.ceil(diff) + 'ms\n') - let all = Math.ceil(Date.now() - full) / 1000 - console.log('Full thing: ' + all + 's\n') +console.log('\n\nrunning speed-test:\n') +;(async () => { + let sum = 0 + // do each document + for (let n = 0; n < documents.length; n += 1) { + let a = documents[n] + let texts = await fetch(`https://unpkg.com/nlp-corpus@3.3.0/builds/${a[0]}`) + const _nlp = nlp.clone() + //start testing the speed + let begin = new Date() + texts.forEach(txt => { + let doc = _nlp(txt) + matches.forEach(reg => { + doc.match(reg).text() + }) + }) + texts.forEach(txt => { + let doc = _nlp(txt) + doc.json() + }) + let end = new Date() + // calculate diff + let time = (end.getTime() - begin.getTime()) / 1000 + // console.log('\n ' + n + 'ms ' + time, a[1]) + let diff = round(time - a[1]) + let percent = round((diff / time) * 100, 10) + sum += percent + console.log(`${a[0]}: ${nice(percent)}`) + } + let avg = round(sum / documents.length) + console.log(`\n ${nice(avg)} avg difference\n`) - // Should we decide on a good value to check against? Might as well just log it for now - //t.true(diff < 20, 'perfomance is stable') - // if (diff > 30) { - // throw 'speed-difference of ' + diff - // } -}) + // if it's a bad difference, fail + if (avg < shouldFail) { + process.exit(1) + } +})() diff --git a/src/Subset/Verbs/conjugate/imperative.js b/src/Subset/Verbs/conjugate/imperative.js deleted file mode 100644 index 433a8731f..000000000 --- a/src/Subset/Verbs/conjugate/imperative.js +++ /dev/null @@ -1,47 +0,0 @@ -// verb-phrases that are orders - 'close the door' -// these should not be conjugated -const isImperative = function (parsed) { - // console.log(parsed) - let vb = parsed.original - let aux = parsed.auxiliary - let subj = parsed.subject - - // speak the truth - if (parsed.verb.has('^#Infinitive')) { - // get the *actual* full sentence (awk) - let s = vb.parents()[0] || vb - // s = s.sentence() - // s.debug() - // s.sentence().debug() - // s.debug() - // you eat? - if (s.has('@hasQuestionMark')) { - return false - } - // 'i speak' is not imperative - if (subj.has('(i|we|they)')) { - return false - } - // do the dishes - if (aux.has('do')) { - return true - } - // go fast! - if (s.has('^#Infinitive #Adverb?$')) { - // s.debug() - // console.log('=-=-=-= here -=-=-=-') - return true - } - // 'you should speak' is - if (aux.has('(should|must)')) { - return true - } - // shut the door - if (s.has('^#Infinitive (#Determiner|#Possessive) #Noun')) { - return true - } - } - return false -} - -module.exports = isImperative diff --git a/src/Subset/Verbs/methods.js b/src/Subset/Verbs/methods.js index 9ea565ec3..dab8aa8e8 100644 --- a/src/Subset/Verbs/methods.js +++ b/src/Subset/Verbs/methods.js @@ -3,7 +3,6 @@ const parseVerb = require('./parse') const isPlural = require('./isPlural') const getSubject = require('./getSubject') const conjugate = require('./conjugate') -const isImperative = require('./conjugate/imperative') const { toParticiple, useParticiple } = require('./participle') // remove any tense-information in auxiliary verbs @@ -116,7 +115,7 @@ module.exports = { toParticiple(parsed, this.world) return } - if (isImperative(parsed, vb)) { + if (vb.has('#Imperative')) { return } // don't conjugate 'to be' From 2460a1090d19566588309bafd8ad52dff44fba39 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Wed, 3 Mar 2021 14:55:47 -0500 Subject: [PATCH 12/18] dont bother caching for misc 2nd pass --- scripts/test/speed/index.js | 2 +- src/02-tagger/04-correction/fixMisc.js | 3 +-- tests/verbs/imperative.test.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/test/speed/index.js b/scripts/test/speed/index.js index a3bee76df..4b9199e30 100644 --- a/scripts/test/speed/index.js +++ b/scripts/test/speed/index.js @@ -19,7 +19,7 @@ const cli = { } if (!process.version.match(/^v12\./)) { - console.warn(cli.red('Warn: Expecting node v12.x')) + console.warn(cli.red('Warn: Expecting node v12.x - got ' + process.version)) } let matches = [ diff --git a/src/02-tagger/04-correction/fixMisc.js b/src/02-tagger/04-correction/fixMisc.js index 48f52410b..f9cdbcdd0 100644 --- a/src/02-tagger/04-correction/fixMisc.js +++ b/src/02-tagger/04-correction/fixMisc.js @@ -11,9 +11,8 @@ const hasTag = function (doc, tag) { //mostly pos-corections here const miscCorrection = function (doc) { - doc.cache() // imperative-form - let m = doc.if('#Infinitive') + let m = hasTag(doc, 'Infinitive') if (m.found) { // you eat? m = m.ifNo('@hasQuestionMark') diff --git a/tests/verbs/imperative.test.js b/tests/verbs/imperative.test.js index 3a98b29bd..526e66666 100644 --- a/tests/verbs/imperative.test.js +++ b/tests/verbs/imperative.test.js @@ -46,7 +46,7 @@ test('imperative keeps tense:', function (t) { 'please do not speak', 'go!', "don't go", - 'shut the door', + // 'shut the door', 'eat your vegetables', // 'you should eat your vegetables', ] From 2469d3bc6f968668f8f98595e18b9f22f2959846 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Wed, 3 Mar 2021 15:36:17 -0500 Subject: [PATCH 13/18] reduce date false-positives --- plugins/dates/src/01-tagger/00-basic.js | 6 ++++++ plugins/dates/src/data/words/times.js | 8 ++++---- plugins/dates/src/normalize.js | 1 - plugins/dates/tests/startDates.test.js | 2 +- scratch.js | 10 ++++++---- scripts/test/speed/index.js | 5 +++++ tests/verbs/imperative.test.js | 4 ++-- 7 files changed, 24 insertions(+), 12 deletions(-) diff --git a/plugins/dates/src/01-tagger/00-basic.js b/plugins/dates/src/01-tagger/00-basic.js index 91afdb041..57ed35d55 100644 --- a/plugins/dates/src/01-tagger/00-basic.js +++ b/plugins/dates/src/01-tagger/00-basic.js @@ -181,6 +181,12 @@ const tagDates = function (doc) { // in 20mins doc.match('(in|after) /^[0-9]+(min|sec|wk)s?/').tag('Date', 'shift-units') + //tuesday night + doc.match('#Date [(now|night|sometime)]', 0).tag('Time', 'date-now') + // 4 days from now + doc.match('(from|starting|until|by) now').tag('Date', 'for-now') + // every night + doc.match('(each|every) night').tag('Date', 'for-now') return doc } module.exports = tagDates diff --git a/plugins/dates/src/data/words/times.js b/plugins/dates/src/data/words/times.js index cdff1fb1a..e2902c161 100644 --- a/plugins/dates/src/data/words/times.js +++ b/plugins/dates/src/data/words/times.js @@ -1,20 +1,20 @@ module.exports = [ 'noon', 'midnight', - 'now', 'morning', 'tonight', 'evening', 'afternoon', - 'night', 'breakfast time', 'lunchtime', 'dinnertime', - 'sometime', 'midday', 'eod', 'oclock', 'oclock', - 'all day', 'at night', + // 'now', + // 'night', + // 'sometime', + // 'all day', ] diff --git a/plugins/dates/src/normalize.js b/plugins/dates/src/normalize.js index ed982b220..ea2384d4a 100644 --- a/plugins/dates/src/normalize.js +++ b/plugins/dates/src/normalize.js @@ -36,7 +36,6 @@ const normalize = function (doc) { m.groups('0').replaceWith('2') m.tag('DateShift') } - return doc } module.exports = normalize diff --git a/plugins/dates/tests/startDates.test.js b/plugins/dates/tests/startDates.test.js index 5662a83f7..ced6e774f 100644 --- a/plugins/dates/tests/startDates.test.js +++ b/plugins/dates/tests/startDates.test.js @@ -479,7 +479,7 @@ const tests = [ // ['sometime during today', [2017, october, 7]], ['dinnertime', [2017, october, 7]], // ['after lunch', [2017, october, 7]], - ['this night', [2017, october, 7]], + // ['this night', [2017, october, 7]], ['this morning', [2017, october, 7]], //tomorrow // ['in the morning', [2017, october, 8]], diff --git a/scratch.js b/scratch.js index c05405488..61aba5f4e 100644 --- a/scratch.js +++ b/scratch.js @@ -1,7 +1,7 @@ const nlp = require('./src/index') -// nlp.extend(require('./plugins/numbers/src')) -// nlp.extend(require('./plugins/dates/src')) -nlp.extend(require('./plugins/sentences/src')) +nlp.extend(require('./plugins/numbers/src')) +nlp.extend(require('./plugins/dates/src')) +// nlp.extend(require('./plugins/sentences/src')) // nlp.verbose(true) // @@ -19,7 +19,9 @@ nlp.extend(require('./plugins/sentences/src')) // let doc = nlp(`shut the door`).debug() // let doc = nlp(`do you eat?`) //.debug() -let doc = nlp(`the service is fast`).debug() +let doc = nlp(`it's time`).debug() +console.log(doc.dates().get()) +// console.log(doc.verbs().isImperative()) // let vb = doc.verbs().clone(true) // vb.sentences().debug() diff --git a/scripts/test/speed/index.js b/scripts/test/speed/index.js index 4b9199e30..855362318 100644 --- a/scripts/test/speed/index.js +++ b/scripts/test/speed/index.js @@ -2,6 +2,8 @@ const reset = '\x1b[0m' const fetch = require('./_fetch') let nlp = require('../../../tests/_lib') +nlp.extend(require('../../../plugins/numbers/src')) +nlp.extend(require('../../../plugins/dates/src')) const highlight = 5 const shouldFail = -10 @@ -81,6 +83,9 @@ console.log('\n\nrunning speed-test:\n') matches.forEach(reg => { doc.match(reg).text() }) + let dates = doc.dates().json() + console.log(dates.map(obj => obj.text)) + // fs.writeFileSync('./file.txt', txt, { flag: 'a' }) }) texts.forEach(txt => { let doc = _nlp(txt) diff --git a/tests/verbs/imperative.test.js b/tests/verbs/imperative.test.js index 526e66666..d213ba537 100644 --- a/tests/verbs/imperative.test.js +++ b/tests/verbs/imperative.test.js @@ -9,7 +9,7 @@ test('isImperative:', function (t) { ['go!', true], ['go fast.', true], ["don't go", true], - ['shut the door', true], + // ['shut the door', true], ['eat your vegetables', true], ['you should eat your vegetables', true], ['you eat?', false], @@ -46,7 +46,7 @@ test('imperative keeps tense:', function (t) { 'please do not speak', 'go!', "don't go", - // 'shut the door', + 'shut the door', 'eat your vegetables', // 'you should eat your vegetables', ] From 679e53115c8e32e8208f6957960b7b350d8c0943 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Wed, 3 Mar 2021 15:58:36 -0500 Subject: [PATCH 14/18] move perf folder --- package.json | 4 ++-- plugins/dates/src/01-tagger/02-dates.js | 4 +--- scratch.js | 4 ++-- scripts/test/{speed => perf}/_fetch.js | 0 scripts/test/{speed => perf}/_sotu-text.js | 0 scripts/test/{speed => perf}/build-speed.js | 0 scripts/test/{speed => perf}/index.js | 11 ++++++++--- 7 files changed, 13 insertions(+), 10 deletions(-) rename scripts/test/{speed => perf}/_fetch.js (100%) rename scripts/test/{speed => perf}/_sotu-text.js (100%) rename scripts/test/{speed => perf}/build-speed.js (100%) rename scripts/test/{speed => perf}/index.js (91%) diff --git a/package.json b/package.json index 6c0ebb0a6..4864e65e9 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,8 @@ "coverage:html": "nyc --reporter=html tape \"./tests/**/*.test.js\" | tap-dancer --color always", "coverage": "nyc -r lcov -n 'src/**/*' -n 'plugins/**/*' npm run test", "codecov": "npm run coverage && codecov -t 15039ad1-b495-48cd-b4a0-bcf124c9b318", - "perf": "node ./scripts/test/speed/index.js", - "perf:build": "node ./scripts/test/speed/build-speed.js", + "perf": "node ./scripts/test/perf/index.js", + "perf:build": "node ./scripts/test/perf/build-speed.js", "lint": "eslint ./src/ && eslint ./plugins/**/src/", "watch": "amble ./scratch.js", "build:all": "node ./scripts/build/build-all.js && npm run build --silent", diff --git a/plugins/dates/src/01-tagger/02-dates.js b/plugins/dates/src/01-tagger/02-dates.js index 3aae2a475..ab0738375 100644 --- a/plugins/dates/src/01-tagger/02-dates.js +++ b/plugins/dates/src/01-tagger/02-dates.js @@ -11,12 +11,10 @@ const dateTagger = function (doc) { doc.match('#Date #Preposition #Date').tag('Date', here) //once a day.. doc.match('(once|twice) (a|an|each) #Date').tag('Date', here) - //TODO:fixme - doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', here) //tuesday doc.match('#Date+').tag('Date', here) //by June - doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', here) + doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', 'until-june') //a year after.. doc.match('a #Duration').tag('Date', here) //between x and y diff --git a/scratch.js b/scratch.js index 61aba5f4e..bda3d3e00 100644 --- a/scratch.js +++ b/scratch.js @@ -2,7 +2,7 @@ const nlp = require('./src/index') nlp.extend(require('./plugins/numbers/src')) nlp.extend(require('./plugins/dates/src')) // nlp.extend(require('./plugins/sentences/src')) -// nlp.verbose(true) +nlp.verbose(true) // // '3/8ths' @@ -19,7 +19,7 @@ nlp.extend(require('./plugins/dates/src')) // let doc = nlp(`shut the door`).debug() // let doc = nlp(`do you eat?`) //.debug() -let doc = nlp(`it's time`).debug() +let doc = nlp(`it ranks third today.`).debug() console.log(doc.dates().get()) // console.log(doc.verbs().isImperative()) diff --git a/scripts/test/speed/_fetch.js b/scripts/test/perf/_fetch.js similarity index 100% rename from scripts/test/speed/_fetch.js rename to scripts/test/perf/_fetch.js diff --git a/scripts/test/speed/_sotu-text.js b/scripts/test/perf/_sotu-text.js similarity index 100% rename from scripts/test/speed/_sotu-text.js rename to scripts/test/perf/_sotu-text.js diff --git a/scripts/test/speed/build-speed.js b/scripts/test/perf/build-speed.js similarity index 100% rename from scripts/test/speed/build-speed.js rename to scripts/test/perf/build-speed.js diff --git a/scripts/test/speed/index.js b/scripts/test/perf/index.js similarity index 91% rename from scripts/test/speed/index.js rename to scripts/test/perf/index.js index 855362318..cb1c91641 100644 --- a/scripts/test/speed/index.js +++ b/scripts/test/perf/index.js @@ -6,6 +6,7 @@ nlp.extend(require('../../../plugins/numbers/src')) nlp.extend(require('../../../plugins/dates/src')) const highlight = 5 const shouldFail = -10 +// const fs = require('fs') //cheaper than requiring chalk const cli = { @@ -83,9 +84,13 @@ console.log('\n\nrunning speed-test:\n') matches.forEach(reg => { doc.match(reg).text() }) - let dates = doc.dates().json() - console.log(dates.map(obj => obj.text)) - // fs.writeFileSync('./file.txt', txt, { flag: 'a' }) + // let m = doc + // .filter(s => { + // return s.dates().found + // }) + // .json() + // let rows = m.map(obj => obj.text).join('\n') + // fs.writeFileSync('./dates.txt', rows, { flag: 'a' }) }) texts.forEach(txt => { let doc = _nlp(txt) From b7e8b532b140a63477e135749e0113182287d81a Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Wed, 3 Mar 2021 18:37:06 -0500 Subject: [PATCH 15/18] add demo webpage lint --- package.json | 1 + plugins/dates/README.md | 2 +- plugins/dates/package.json | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4864e65e9..2321e0484 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "type": "git", "url": "git://github.com/spencermountain/compromise.git" }, + "homepage": "https://github.com/spencermountain/compromise", "engines": { "node": ">=6.0.0" }, diff --git a/plugins/dates/README.md b/plugins/dates/README.md index 1b23a0c54..6302fce37 100644 --- a/plugins/dates/README.md +++ b/plugins/dates/README.md @@ -72,7 +72,7 @@ doc.dates().get(0) diff --git a/plugins/dates/package.json b/plugins/dates/package.json index f11048e09..ffe9dcb5a 100644 --- a/plugins/dates/package.json +++ b/plugins/dates/package.json @@ -11,6 +11,7 @@ "type": "git", "url": "git://github.com/spencermountain/compromise.git" }, + "homepage": "https://github.com/spencermountain/compromise/tree/master/plugins/dates", "scripts": { "test": "tape \"./tests/**/*.test.js\" | tap-dancer --color always", "testb": "TESTENV=prod tape \"./tests/**/*.test.js\" | tap-dancer --color always", From b44218261b2da74050290014405167ce33882d5e Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Thu, 4 Mar 2021 10:20:58 -0500 Subject: [PATCH 16/18] add satish for #820 --- data/nouns/uncountables.js | 1 + scratch.js | 4 ++-- src/World/_data.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data/nouns/uncountables.js b/data/nouns/uncountables.js index e0a70dce0..b81912d74 100644 --- a/data/nouns/uncountables.js +++ b/data/nouns/uncountables.js @@ -134,6 +134,7 @@ module.exports = [ 'safety', 'salmon', 'salt', + 'satish', 'sand', 'scenery', 'series', diff --git a/scratch.js b/scratch.js index bda3d3e00..de1b786e0 100644 --- a/scratch.js +++ b/scratch.js @@ -19,8 +19,8 @@ nlp.verbose(true) // let doc = nlp(`shut the door`).debug() // let doc = nlp(`do you eat?`) //.debug() -let doc = nlp(`it ranks third today.`).debug() -console.log(doc.dates().get()) +let doc = nlp(`gagan`).debug() +// console.log(doc.dates().get()) // console.log(doc.verbs().isImperative()) // let vb = doc.verbs().clone(true) diff --git a/src/World/_data.js b/src/World/_data.js index 9b6b3412a..568d467e9 100644 --- a/src/World/_data.js +++ b/src/World/_data.js @@ -20,7 +20,7 @@ module.exports={ "Actor": "true¦aJbGcFdCengineIfAgardenIh9instructPjournalLlawyIm8nurse,opeOp5r3s1t0;echnCherapK;ailNcientJecretary,oldiGu0;pervKrgeon;e0oofE;ceptionGsearC;hotographClumbColi1r0sychologF;actitionBogrammB;cem6t5;echanic,inist9us4;airdress8ousekeep8;arm7ire0;fight6m2;eputy,iet0;ici0;an;arpent2lerk;ricklay1ut0;ch0;er;ccoun6d2ge7r0ssis6ttenda7;chitect,t0;ist;minist1v0;is1;rat0;or;ta0;nt", "Honorific": "true¦a01bYcQdPeOfiJgIhon,jr,king,lHmCoffic00p7queen,r3s0taoiseach,vice6;e1fc,gt,ir,r,u0;ltRpt,rg;cond liInBrgeaJ;abbi,e0;ar1p9s,v0;!erend; admirX;astOhd,r0vt;esideDi1of0;!essM;me mini4nce0;!ss;a3essrs,i2lle,me,r1s0;!tr;!s;stK;gistrate,j,r6yF;i3lb,t;en,ov;eld mar3rst l0;ady,i0;eutena0;nt;shG;sq,xcellency;et,oct6r,utchess;apt6hance4mdr,o0pl;lonel,m2ngress0unci3;m0wom0;an;dr,mand5;ll0;or;!ain;ldg,rig0;!adi0;er;d0sst,tty,yatullah;j,m0v;!ir0;al", "SportsTeam": "true¦0:1A;1:1H;2:1G;a1Eb16c0Td0Kfc dallas,g0Ihouston 0Hindiana0Gjacksonville jagua0k0El0Bm01newToQpJqueens parkIreal salt lake,sAt5utah jazz,vancouver whitecaps,w3yW;ashington 3est ham0Rh10;natio1Oredski2wizar0W;ampa bay 6e5o3;ronto 3ttenham hotspur;blue ja0Mrapto0;nnessee tita2xasC;buccanee0ra0K;a7eattle 5heffield0Kporting kansas0Wt3;. louis 3oke0V;c1Frams;marine0s3;eah15ounG;cramento Rn 3;antonio spu0diego 3francisco gJjose earthquak1;char08paA; ran07;a8h5ittsburgh 4ortland t3;imbe0rail blaze0;pirat1steele0;il3oenix su2;adelphia 3li1;eagl1philNunE;dr1;akland 3klahoma city thunder,rlando magic;athle0Mrai3;de0; 3castle01;england 7orleans 6york 3;city fc,g4je0FknXme0Fred bul0Yy3;anke1;ian0D;pelica2sain0C;patrio0Brevolut3;ion;anchester Be9i3ontreal impact;ami 7lwaukee b6nnesota 3;t4u0Fvi3;kings;imberwolv1wi2;rewe0uc0K;dolphi2heat,marli2;mphis grizz3ts;li1;cXu08;a4eicesterVos angeles 3;clippe0dodDla9; galaxy,ke0;ansas city 3nE;chiefs,roya0E; pace0polis colU;astr06dynamo,rockeTtexa2;olden state warrio0reen bay pac3;ke0;.c.Aallas 7e3i05od5;nver 5troit 3;lio2pisto2ti3;ge0;broncZnuggeM;cowbo4maver3;ic00;ys; uQ;arCelKh8incinnati 6leveland 5ol3;orado r3umbus crew sc;api5ocki1;brow2cavalie0india2;bengaWre3;ds;arlotte horAicago 3;b4cubs,fire,wh3;iteB;ea0ulR;diff3olina panthe0; c3;ity;altimore 9lackburn rove0oston 5rooklyn 3uffalo bilN;ne3;ts;cel4red3; sox;tics;rs;oriol1rave2;rizona Ast8tlanta 3;brav1falco2h4u3;nited;aw9;ns;es;on villa,r3;os;c5di3;amondbac3;ks;ardi3;na3;ls", - "Uncountable": "true¦0:1I;1:1X;2:16;a1Rb1Jc1Ad17e10f0Ug0Nh0Ii0Ej0Dknowled1Ql08mYnews,oXpTrOsDt8vi7w3;a5ea0Bi4oo3;d,l;ldlife,ne;rmth,t0;neg17ol0Ctae;e6h5oothpaste,r3una;affTou3;ble,sers,t;ermod1Mund0;a,nnis;aBcene0Aeri2hAil9kittl2now,o8p6t4u3;g10nshi0Q;ati1Le3;am,el;ace1Ee3;ci2ed;ap,cc0;k,v0;eep,ingl2;d0Dfe18l3nd;m11t;a6e4ic3;e,ke0M;c3laxa0Isearch;ogni0Hrea0H;bi2in;aPe5hys1last9o3ress04;l3rk,w0;it1yA;a12trZ;bstetr1il,xygen;aAe8ilk,o5u3;mps,s3;ic;n3o0I;ey,o3;gamy;a3chan1;sl2t;chine3il,themat1; learn0Bry;aught0e5i4ogi0Su3;ck,g0I;ce,ghtn08ngui0QteratN;a3isM;th0;ewelAusti0L;ce,mp3nformaUtself;a3ortan0J;ti3;en0H;a6isto5o3;ck3mework,n3spitali0B;ey;ry;ir,libut,ppiD;ene6o4r3um,ymna0D;aCound;l3ssip;d,f; 3t1;editQpo3;ol;i7lour,o4urnit3;ure;od,rgive3uri0wl;ne3;ss;c9sh;conom1duca8lectr7n5quip6th1very3;body,o3thH;ne;joy3tertain3;ment;iciPon1;tiI;ar4iabet2raugh4;es;ts;aAelcius,h6iv1l5o3urrency;al,ld w3nfusiDttD;ar;ass1oth5;aos,e3;e4w3;ing;se;r7sh;a7eef,i4lood,owls,read,utt0;er;lliar4s3;on;ds;g3ss;ga3;ge;c8dvi7ero5ir4mnes3rt,thlet1;ty;craft;b1d3naut1;ynam1;ce;id,ou3;st1;ics", + "Uncountable": "true¦0:1I;1:1X;2:16;a1Rb1Jc1Ad17e10f0Ug0Nh0Ii0Ej0Dknowled1Ql08mYnews,oXpTrOsDt8vi7w3;a5ea0Bi4oo3;d,l;ldlife,ne;rmth,t0;neg17ol0Ctae;e6h5oothpaste,r3una;affTou3;ble,sers,t;ermod1Mund0;a,nnis;aBcene0Aeri2hAil9kittl2now,o8p6t4u3;g10nshi0Q;ati1Le3;am,el;ace1Ee3;ci2ed;ap,cc0;k,v0;eep,ingl2;d0Dfe18l3nd,tish;m11t;a6e4ic3;e,ke0M;c3laxa0Isearch;ogni0Hrea0H;bi2in;aPe5hys1last9o3ress04;l3rk,w0;it1yA;a12trZ;bstetr1il,xygen;aAe8ilk,o5u3;mps,s3;ic;n3o0I;ey,o3;gamy;a3chan1;sl2t;chine3il,themat1; learn0Bry;aught0e5i4ogi0Su3;ck,g0I;ce,ghtn08ngui0QteratN;a3isM;th0;ewelAusti0L;ce,mp3nformaUtself;a3ortan0J;ti3;en0H;a6isto5o3;ck3mework,n3spitali0B;ey;ry;ir,libut,ppiD;ene6o4r3um,ymna0D;aCound;l3ssip;d,f; 3t1;editQpo3;ol;i7lour,o4urnit3;ure;od,rgive3uri0wl;ne3;ss;c9sh;conom1duca8lectr7n5quip6th1very3;body,o3thH;ne;joy3tertain3;ment;iciPon1;tiI;ar4iabet2raugh4;es;ts;aAelcius,h6iv1l5o3urrency;al,ld w3nfusiDttD;ar;ass1oth5;aos,e3;e4w3;ing;se;r7sh;a7eef,i4lood,owls,read,utt0;er;lliar4s3;on;ds;g3ss;ga3;ge;c8dvi7ero5ir4mnes3rt,thlet1;ty;craft;b1d3naut1;ynam1;ce;id,ou3;st1;ics", "Infinitive": "true¦0:6S;1:76;2:5C;3:74;4:73;5:67;6:6F;7:6Y;8:6Q;9:72;A:70;B:6X;C:5X;D:77;E:6L;F:5B;a6Kb66c57d4De3Xf3Jg3Dh37i2Uj2Sk2Ql2Hm26n23o1Yp1Jr0Rs06tYuTvOwHyG;awn,ield;aJe1Zhist6iIoGre6D;nd0rG;k,ry;pe,sh,th0;lk,nHrGsh,tEve;n,raD;d0t;aJiHoG;te,w;eGsB;!w;l6Jry;nHpGr4se;gra4Pli41;dGi9lo5Zpub3Q;erGo;mi5Cw1I;aMeLhKig5SoJrHuGwi7;ne,rn;aGe0Mi5Uu7y;de,in,nsf0p,v5J;r2ZuE;ank,reatC;nd,st;lk,rg1Qs9;aZcWeVhTi4Dkip,lSmRnee3Lo52pQtJuGwitE;bmBck,ff0gge7ppHrGspe5;ge,pri1rou4Zvi3;ly,o36;aLeKoJrHuG;dy,mb6;aFeGi3;ngthCss,tE;p,re;m,p;in,ke,r0Qy;la58oil,rink6;e1Zi6o3J;am,ip;a2iv0oG;ck,rtCut;arEem,le5n1r3tt6;aHo2rG;atEew;le,re;il,ve;a05eIisk,oHuG;in,le,sh;am,ll;a01cZdu8fYgXje5lUmTnt,pQquPsKtJvGwa5V;eGiew,o36;al,l,rG;se,t;aFi2u44;eJi7oItG;!o2rG;i5uc20;l3rt;mb6nt,r3;e7i2;air,eHlGo43r0K;a8y;at;aFemb0i3Zo3;aHeGi3y;a1nt;te,x;a5Dr0J;act1Yer,le5u1;a13ei3k5PoGyc6;gni2Cnci6rd;ch,li2Bs5N;i1nG;ge,k;aTerSiRlOoMrIuG;b21ll,mp,rGsh;cha1s4Q;ai1eIiDoG;cGdu8greAhibBmi1te7vi2W;eAlaim;di5pa2ss,veD;iDp,rtr46sGur;e,t;aHead,uG;g,n4;n,y;ck,le;fo34mBsi7;ck,iDrt4Mss,u1;bJccur,ff0pera9utweIverGwe;co47lap,ta22u1wG;helm;igh;ser3taF;eHotG;e,i8;ed,gle5;aMeLiIoHuG;ltip3Grd0;nit13ve;nHrr12sreprG;eseD;d,g6us;asu2lt,n0Nr4;intaFna4rHtG;ch,t0;ch,kGry;et;aMeLiJoGu1C;aHck,oGve;k,sC;d,n;ft,g35ke,mBnk,st2YveG;!n;a2Fc0Et;b0Nck,uG;gh,nE;iGno34;ck,ll,ss;am,oFuG;d4mp;gno2mQnGss3H;cOdica9flu0MhNsKtIvG;eGol3;nt,st;erGrodu8;a5fe2;i7tG;aGru5;ll;abBibB;lu1Fr1D;agi24pG;lemeDo22ro3;aKeIi2oHuG;nt,rry;n02pe,st;aGlp;d,t;nd6ppCrm,te;aKloAove1PrIuG;arGeAi15;ant39d;aGip,ow,umb6;b,sp;in,th0ze;aReaQiOlMoJrHuncG;ti3J;acGeshC;tu2;cus,lHrG;ce,eca7m,s30;d,l24;a1ZoG;at,od,w;gu2lGni1Xt,x;e,l;r,tu2;il,stCvG;or;a15cho,le5mSnPstNvalua9xG;a0AcLerKi7pGte19;a18eHi2laFoGreA;rt,se;ct,riG;en8;ci1t;el,han4;abGima9;li1J;ab6couXdHfor8ga4han8j03riEsu2t0vG;isi2Vy;!u2;body,er4pG;hasiGow0;ze;a07eUiLoKrHuG;mp;aHeAiG;ft;g,in;d4ubt;ff0p,re5sHvG;iZor8;aKcHliGmiApl1Btingui14;ke;oGuA;uGv0;ra4;gr1YppG;ear,ro3;cOeNfLliv0ma0Fny,pKsHterG;mi0G;cribe,er3iHtrG;oy;gn,re;a0Be0Ai5osB;eGi0By;at,ct;m,pC;iIlHrG;ea1;a2i06;de;ma4n8rGte;e,kC;a0Ae09h06i9l04oJrG;aHeGoAu0Hy;a9dB;ck,ve;llZmSnHok,py,uGv0;gh,nt;cePdu5fMsKtIvG;eGin8;rt,y;aFin0VrG;a7ibu9ol;iGtitu9;d0st;iHoGroD;rm;gu2rm;rn;biLfoKmaJpG;a2laF;in;re;nd;rt;ne;ap1e5;aGip,o1;im,w;aHeG;at,ck,w;llen4n4r4se;a1nt0;ll,ncIrGt0u1;eGry;!en;el;aSePloOoMrIuG;lGry;ly;igHuG;sh;htC;en;a7mb,o7rrGth0un8;ow;ck;ar,lHnefBtrG;ay;ie3ong;ng,se;band0Jc0Bd06ffo05gr04id,l01mu1nYppTrQsKttGvoid,waB;acIeHra5;ct;m0Fnd;h,k;k,sG;eIiHocia9uG;me;gn,st;mb6rt;le;chHgGri3;ue;!i3;eaJlIroG;aEve;ch;aud,y;l,r;noun8sw0tG;icipa9;ce;lHt0;er;e4ow;ee;rd;aRdIju7mBoR;it;st;!reA;ss;cJhie3knowled4tiva9;te;ge;ve;eIouDu1;se;nt;pt;on", "Unit": "true¦0:19;a14b12c0Od0Ne0Lf0Gg0Ch09in0Hjoule0k02l00mNnMoLpIqHsqCt7volts,w6y4z3°2µ1;g,s;c,f,n;b,e2;a0Nb,d0Dears old,o1;tt0H;att0b;able4b3d,e2on1sp;!ne0;a2r0D;!l,sp;spo04; ft,uare 1;c0Id0Hf3i0Fkilo0Jm1ya0E;e0Mil1;e0li0H;eet0o0D;t,uart0;ascals,e2i1ou0Pt;c0Mnt0;rcent,t02;hms,uYz;an0JewtT;/s,b,e9g,i3l,m2p1²,³;h,s;!²;!/h,cro5l1;e1li08;! pFs1²;! 1;anEpD;g06s0B;gQter1;! 2s1;! 1;per second;b,i00m,u1x;men0x0;b,elvin0g,ilo2m1nR;!/h,ph,²;byZgXmeter1;! p2s1;! p1;er1; hour;e1g,r0z;ct1rtz0;aXogQ;al2b,igAra1;in0m0;!l1;on0;a4emtPl2t1;²,³; oz,uid ou1;nce0;hrenheit0rad0;b,x1;abyH;eciCg,l,mA;arat0eAg,m9oulomb0u1;bic 1p0;c5d4fo3i2meAya1;rd0;nch0;ot0;eci2;enti1;me4;!²,³;lsius0nti1;g2li1me1;ter0;ram0;bl,y1;te0;c4tt1;os1;eco1;nd0;re0;!s", "Organization": "true¦0:46;a3Ab2Qc2Ad21e1Xf1Tg1Lh1Gi1Dj19k17l13m0Sn0Go0Dp07qu06rZsStFuBv8w3y1;amaha,m0Xou1w0X;gov,tu2S;a3e1orld trade organizati41;lls fargo,st1;fie22inghou16;l1rner br3D;-m11gree31l street journ25m11;an halNeriz3Wisa,o1;dafo2Gl1;kswagLvo;bs,kip,n2ps,s1;a tod2Rps;es35i1;lev2Xted natio2Uv; mobi2Kaco bePd bMeAgi frida9h3im horto2Tmz,o1witt2W;shiba,y1;ota,s r Y;e 1in lizzy;b3carpen33daily ma2Xguess w2holli0rolling st1Ms1w2;mashing pumpki2Ouprem0;ho;ea1lack eyed pe3Fyrds;ch bo1tl0;ys;l2s1;co,la m12;efoni07us;a6e4ieme2Gnp,o2pice gir5ta1ubaru;rbucks,to2N;ny,undgard1;en;a2Rx pisto1;ls;few25insbu26msu1X;.e.m.,adiohead,b6e3oyal 1yan2X;b1dutch she4;ank;/max,aders dige1Ed 1vl32;bu1c1Uhot chili peppe2Klobst28;ll;c,s;ant2Vizno2F;an5bs,e3fiz24hilip morrBi2r1;emier27octer & gamb1Rudenti14;nk floyd,zza hut;psi28tro1uge08;br2Qchina,n2Q; 2ason1Xda2G;ld navy,pec,range juli2xf1;am;us;a9b8e5fl,h4i3o1sa,wa;kia,tre dame,vart1;is;ke,ntendo,ss0K;l,s;c,st1Etflix,w1; 1sweek;kids on the block,york08;a,c;nd1Us2t1;ional aca2Fo,we0Q;a,cYd0O;aAcdonald9e5i3lb,o1tv,yspace;b1Nnsanto,ody blu0t1;ley crue,or0O;crosoft,t1;as,subisO;dica3rcedes2talli1;ca;!-benz;id,re;'s,s;c's milk,tt13z1Y;'ore09a3e1g,ittle caesa1Ktd;novo,x1;is,mark; pres5-z-boy,bour party;atv,fc,kk,m1od1K;art;iffy lu0Lo3pmorgan1sa;! cha1;se;hnson & johns1Sy d1R;bm,hop,n1tv;c,g,te1;l,rpol; & m,asbro,ewlett-packaTi3o1sbc,yundai;me dep1n1J;ot;tac1zbollah;hi;eneral 6hq,l5mb,o2reen d0Iu1;cci,ns n ros0;ldman sachs,o1;dye1g0B;ar;axo smith kliZencore;electr0Im1;oto0V;a3bi,da,edex,i1leetwood mac,oGrito-l0A;at,nancial1restoV; tim0;cebook,nnie mae;b06sa,u3xxon1; m1m1;ob0H;!rosceptics;aiml0Ae5isney,o3u1;nkin donuts,po0Wran dur1;an;j,w j1;on0;a,f leppa3ll,p2r spiegZstiny's chi1;ld;eche mode,t;rd;aEbc,hBi9nn,o3r1;aigsli5eedence clearwater reviv1ossra05;al;!ca c5l4m1o0Ast05;ca2p1;aq;st;dplMgate;ola;a,sco1tigroup;! systems;ev2i1;ck fil-a,na daily;r0Hy;dbury,pital o1rl's jr;ne;aGbc,eCfAl6mw,ni,o2p,r1;exiteeWos;ei3mbardiJston 1;glo1pizza;be;ng;ack & deckFo2ue c1;roX;ckbuster video,omingda1;le; g1g1;oodriN;cht3e ge0n & jer2rkshire hathaw1;ay;ryH;el;nana republ3s1xt5y5;f,kin robbi1;ns;ic;bXcSdidRerosmith,ig,lLmFnheuser-busEol,ppleAr7s3t&t,v2y1;er;is,on;hland2s1;n,ociated F; o1;il;by4g2m1;co;os; compu2bee1;'s;te1;rs;ch;c,d,erican3t1;!r1;ak; ex1;pre1;ss; 4catel2t1;air;!-luce1;nt;jazeera,qae1;da;as;/dc,a3er,t1;ivisi1;on;demy of scienc0;es;ba,c", From 960a50ece5f32ecbf4e2488f6a2a834646f0af91 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Thu, 4 Mar 2021 10:46:54 -0500 Subject: [PATCH 17/18] fixes for #823 --- scratch.js | 9 ++++++--- src/02-tagger/04-correction/matches/04-noun.js | 8 +++----- tests/tagger/tagger.test.js | 8 ++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scratch.js b/scratch.js index de1b786e0..cec344dfc 100644 --- a/scratch.js +++ b/scratch.js @@ -17,9 +17,12 @@ nlp.verbose(true) // let doc = nlp('i should drive') // doc.sentences().toPastTense().debug() -// let doc = nlp(`shut the door`).debug() -// let doc = nlp(`do you eat?`) //.debug() -let doc = nlp(`gagan`).debug() +// let doc = nlp(`a tv show`).debug() +// let doc = nlp(`send me a currency report.`).debug() +// let doc = nlp(`a close watch on`).debug() +// let doc = nlp(` a surgery date of`).debug() +// let doc = nlp(`A girl hit a boy.`).debug() +let doc = nlp(`a auto repair shop.`).debug() // console.log(doc.dates().get()) // console.log(doc.verbs().isImperative()) diff --git a/src/02-tagger/04-correction/matches/04-noun.js b/src/02-tagger/04-correction/matches/04-noun.js index 6a406b49a..d471b0890 100644 --- a/src/02-tagger/04-correction/matches/04-noun.js +++ b/src/02-tagger/04-correction/matches/04-noun.js @@ -133,16 +133,14 @@ module.exports = [ { match: '[#Verb] than', group: 0, tag: 'Noun', reason: 'correction' }, // goes to sleep { match: '(go|goes|went) to [#Infinitive]', group: 0, tag: 'Noun', reason: 'goes-to-verb' }, - //a great run - // { match: '(a|an) #Adjective [(#Infinitive|#PresentTense)]', tag: 'Noun', reason: 'a|an2' }, + //a close watch on + { match: '(a|an) #Noun [#Infinitive] (#Preposition|#Noun)', group: 0, tag: 'Noun', reason: 'a-noun-inf' }, //a tv show - { match: '(a|an) #Noun [#Infinitive]', group: 0, tag: 'Noun', reason: 'a-noun-inf' }, + { match: '(a|an) #Noun [#Infinitive]$', group: 0, tag: 'Noun', reason: 'a-noun-inf2' }, //do so { match: 'do [so]', group: 0, tag: 'Noun', reason: 'so-noun' }, //is mark hughes { match: '#Copula [#Infinitive] #Noun', group: 0, tag: 'Noun', reason: 'is-pres-noun' }, - // - // { match: '[#Infinitive] #Copula', group: 0, tag: 'Noun', reason: 'inf-copula' }, //a close { match: '#Determiner #Adverb? [close]', group: 0, tag: 'Adjective', reason: 'a-close' }, // what the hell diff --git a/tests/tagger/tagger.test.js b/tests/tagger/tagger.test.js index 8866b3295..f4222c7fe 100644 --- a/tests/tagger/tagger.test.js +++ b/tests/tagger/tagger.test.js @@ -223,6 +223,14 @@ test('pos-basic-tag:', function (t) { ['is well made', ['Copula', 'Adverb', 'Adjective']], ['at some point', ['Preposition', 'Determiner', 'Noun']], ['to a point', ['Conjunction', 'Determiner', 'Noun']], + + // infinitive-noun + [`a tv show`, ['Determiner', 'Noun', 'Noun']], + [`send me a currency report.`, ['Infinitive', 'Pronoun', 'Determiner', 'Noun', 'Noun']], + // [`a close watch on`, ['Determiner', 'Adjective', 'Noun', 'Preposition']], + [` a surgery date of`, ['Determiner', 'Noun', 'Noun', 'Preposition']], + [`A girl hit a boy.`, ['Determiner', 'Noun', 'Infinitive', 'Determiner', 'Noun']], + [`a auto repair shop.`, ['Determiner', 'Noun', 'Noun', 'Noun']], ] arr.forEach(function (a) { let terms = nlp(a[0]).json(0).terms From 3fd8121284f7828e030b4b41cbf8e829453cd838 Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Thu, 4 Mar 2021 10:55:04 -0500 Subject: [PATCH 18/18] 13.10.1rc --- README.md | 1 + builds/compromise-tokenize.js | 2 +- builds/compromise.js | 1063 +++++++++--------- builds/compromise.min.js | 2 +- builds/compromise.mjs | 1063 +++++++++--------- changelog.md | 11 +- package-lock.json | 828 ++++++++------ package.json | 10 +- plugins/dates/builds/compromise-dates.js | 425 ++++--- plugins/dates/builds/compromise-dates.js.map | 2 +- plugins/dates/builds/compromise-dates.min.js | 2 +- plugins/dates/builds/compromise-dates.mjs | 425 ++++--- plugins/dates/changelog.md | 6 +- plugins/dates/package-lock.json | 14 +- plugins/dates/package.json | 4 +- src/_version.js | 2 +- types/index.d.ts | 2 + 17 files changed, 2096 insertions(+), 1766 deletions(-) diff --git a/README.md b/README.md index 1b10a731d..852521b66 100644 --- a/README.md +++ b/README.md @@ -556,6 +556,7 @@ _(all match methods use the [match-syntax](https://docs.compromise.cool/compromi - **[.verbs().isPlural()](https://observablehq.com/@spencermountain/verbs)** - return plural verbs like 'we walk' - **[.verbs().isSingular()](https://observablehq.com/@spencermountain/verbs)** - return singular verbs like 'spencer walks' - **[.verbs().adverbs()](https://observablehq.com/@spencermountain/verbs)** - return the adverbs describing this verb. + - **[.verbs().isImperative()](https://observablehq.com/@spencermountain/verbs)** - only instruction verbs like 'eat it!'
diff --git a/builds/compromise-tokenize.js b/builds/compromise-tokenize.js index 8e052cdd3..88256817c 100644 --- a/builds/compromise-tokenize.js +++ b/builds/compromise-tokenize.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).nlp=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;rr?n:r)+1;if(Math.abs(r-n)>(i||100))return i||100;for(var o,s,a,u,c,h,l=[],f=0;f4)return r;u=s===(a=e[o-1])?0:1,c=l[d-1][o]+1,(h=l[d][o-1]+1)1&&o>1&&s===e[o-2]&&t[d-2]===a&&(h=l[d-2][o-2]+u)2&&void 0!==arguments[2]?arguments[2]:3;if(t===e)return 1;if(t.lengthe.fuzzy)return!0;if(!0===e.soft&&(i=B(e.word,t.root))>e.fuzzy)return!0}return e.word===t.clean||e.word===t.text||e.word===t.reduced}return void 0!==e.tag?!0===t.tags[e.tag]:void 0!==e.method?"function"==typeof t[e.method]&&!0===t[e.method]():void 0!==e.regex?e.regex.test(t.clean):void 0!==e.fastOr?e.fastOr.hasOwnProperty(t.reduced)||e.fastOr.hasOwnProperty(t.text):void 0!==e.choices&&("and"===e.operator?e.choices.every((function(e){return S(t,e,r,n)})):e.choices.some((function(e){return S(t,e,r,n)})))},z=S=function(t,e,r,n){var i=I(t,e,r,n);return!0===e.negative?!i:i},D={},_={doesMatch:function(t,e,r){return z(this,t,e,r)},isAcronym:function(){return b(this.text)},isImplicit:function(){return""===this.text&&Boolean(this.implicit)},isKnown:function(){return Object.keys(this.tags).some((function(t){return!0!==D[t]}))},setRoot:function(t){var e=t.transforms,r=this.implicit||this.clean;if(this.tags.Plural&&(r=e.toSingular(r,t)),this.tags.Verb&&!this.tags.Negative&&!this.tags.Infinitive){var n=null;this.tags.PastTense?n="PastTense":this.tags.Gerund?n="Gerund":this.tags.PresentTense?n="PresentTense":this.tags.Participle?n="Participle":this.tags.Actor&&(n="Actor"),r=e.toInfinitive(r,t,n)}this.root=r}},M=/[\s-]/,G=/^[A-Z-]+$/,q={textOut:function(t,e,r){t=t||{};var n=this.text,i=this.pre,o=this.post;return!0===t.reduced&&(n=this.reduced||""),!0===t.root&&(n=this.root||""),!0===t.implicit&&this.implicit&&(n=this.implicit||""),!0===t.normal&&(n=this.clean||this.text||""),!0===t.root&&(n=this.root||this.reduced||""),!0===t.unicode&&(n=p(n)),!0===t.titlecase&&(this.tags.ProperNoun&&!this.titleCase()||(this.tags.Acronym?n=n.toUpperCase():G.test(n)&&!this.tags.Acronym&&(n=n.toLowerCase()))),!0===t.lowercase&&(n=n.toLowerCase()),!0===t.acronyms&&this.tags.Acronym&&(n=n.replace(/\./g,"")),!0!==t.whitespace&&!0!==t.root||(i="",o=" ",!1!==M.test(this.post)&&!t.last||this.implicit||(o="")),!0!==t.punctuation||t.root||(!0===this.hasPost(".")?o="."+o:!0===this.hasPost("?")?o="?"+o:!0===this.hasPost("!")?o="!"+o:!0===this.hasPost(",")?o=","+o:!0===this.hasEllipses()&&(o="..."+o)),!0!==e&&(i=""),!0!==r&&(o=""),!0===t.abbreviations&&this.tags.Abbreviation&&(o=o.replace(/^\./,"")),i+n+o}},L={Auxiliary:1,Possessive:1},W=function(t,e){var r=Object.keys(t.tags),n=e.tags;return r=r.sort((function(t,e){return L[e]||!n[e]?-1:n[e]?n[t]?n[t].lineage.length>n[e].lineage.length?1:n[t].isA.length>n[e].isA.length?-1:0:0:1}))},U={text:!0,tags:!0,implicit:!0,whitespace:!0,clean:!1,id:!1,index:!1,offset:!1,bestTag:!1},R={json:function(t,e){t=t||{};var r={};return(t=Object.assign({},U,t)).text&&(r.text=this.text),t.normal&&(r.normal=this.clean),t.tags&&(r.tags=Object.keys(this.tags)),t.clean&&(r.clean=this.clean),(t.id||t.offset)&&(r.id=this.id),t.implicit&&null!==this.implicit&&(r.implicit=this.implicit),t.whitespace&&(r.pre=this.pre,r.post=this.post),t.bestTag&&(r.bestTag=W(this,e)[0]),r}},H=Object.assign({},N,V,_,q,R);function Q(){return"undefined"!=typeof window&&window.document}var Z=function(t,e){for(t=t.toString();t.length0&&void 0!==arguments[0]?arguments[0]:"";e(this,t),r=String(r);var n=F(r);this.text=n.text||"",this.clean=n.clean,this.reduced=n.reduced,this.root=null,this.implicit=null,this.pre=n.pre||"",this.post=n.post||"",this.tags={},this.prev=null,this.next=null,this.id=h(n.clean),this.isA="Term",n.alias&&(this.alias=n.alias)}return n(t,[{key:"set",value:function(t){var e=F(t);return this.text=e.text,this.clean=e.clean,this}}]),t}();st.prototype.clone=function(){var t=new st(this.text);return t.pre=this.pre,t.post=this.post,t.clean=this.clean,t.reduced=this.reduced,t.root=this.root,t.implicit=this.implicit,t.tags=Object.assign({},this.tags),t},Object.assign(st.prototype,H),Object.assign(st.prototype,ot);var at=st,ut={terms:function(t){if(0===this.length)return[];if(this.cache.terms)return void 0!==t?this.cache.terms[t]:this.cache.terms;for(var e=[this.pool.get(this.start)],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;"string"==typeof t&&(t="normal"===t?{whitespace:!0,unicode:!0,lowercase:!0,punctuation:!0,acronyms:!0,abbreviations:!0,implicit:!0,normal:!0}:"clean"===t?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,normal:!0}:"reduced"===t?{punctuation:!1,titlecase:!1,lowercase:!0,whitespace:!0,unicode:!0,implicit:!0,reduced:!0}:"implicit"===t?{punctuation:!0,implicit:!0,whitespace:!0,trim:!0}:"root"===t?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,root:!0}:{});var n=this.terms(),i=!1;n[0]&&null===n[0].prev&&null===n[n.length-1].next&&(i=!0);var o=n.reduce((function(o,s,a){if(0===a&&""===s.text&&null!==s.implicit&&!t.implicit)return o;t.last=r&&a===n.length-1;var u=!0,c=!0;return!1===i&&(0===a&&e&&(u=!1),a===n.length-1&&r&&(c=!1)),o+s.textOut(t,u,c)}),"");return!0===i&&r&&(o=ct(o)),!0===t.trim&&(o=o.trim()),o}},lt={trim:function(){var t=this.terms();if(t.length>0){t[0].pre=t[0].pre.replace(/^\s+/,"");var e=t[t.length-1];e.post=e.post.replace(/\s+$/,"")}return this}},ft=/[.?!]\s*$/,pt=function(t,e){e[0].pre=t[0].pre;var r,n,i=t[t.length-1],o=e[e.length-1];o.post=(r=i.post,n=o.post,ft.test(n)?n+r.match(/\s*$/):r),i.post="",""===i.post&&(i.post+=" ")},dt=function(t,e,r){var n=t.terms(),i=e.terms();pt(n,i),function(t,e,r){var n=t[t.length-1],i=e[e.length-1],o=n.next;n.next=e[0].id,i.next=o,o&&(r.get(o).prev=i.id);var s=t[0].id;s&&(e[0].prev=s)}(n,i,t.pool);var o,s=[t],a=t.start,u=[r];return(u=u.concat(r.parents())).forEach((function(t){var e=t.list.filter((function(t){return t.hasId(a)}));s=s.concat(e)})),(s=(o=s).filter((function(t,e){return o.indexOf(t)===e}))).forEach((function(t){t.length+=e.length})),t.cache={},t},vt=/ /,mt=function(t,e,r){var n=t.start,i=e.terms();!function(t){var e=t[t.length-1];!1===vt.test(e.post)&&(e.post+=" ")}(i),function(t,e,r){var n=r[r.length-1];n.next=t.start;var i=t.pool,o=i.get(t.start);o.prev&&(i.get(o.prev).next=e.start),r[0].prev=t.terms(0).prev,t.terms(0).prev=n.id}(t,e,i);var o,s=[t],a=[r];return(a=a.concat(r.parents())).forEach((function(t){var r=t.list.filter((function(t){return t.hasId(n)||t.hasId(e.start)}));s=s.concat(r)})),(s=(o=s).filter((function(t,e){return o.indexOf(t)===e}))).forEach((function(t){t.length+=e.length,t.start===n&&(t.start=e.start),t.cache={}})),t},gt=function(t,e){var r=e.pool(),n=t.terms(),i=r.get(n[0].prev)||{},o=r.get(n[n.length-1].next)||{};n[0].implicit&&i.implicit&&(i.set(i.implicit),i.post+=" "),function(t,e,r,n){var i=t.parents();i.push(t),i.forEach((function(t){var i=t.list.find((function(t){return t.hasId(e)}));i&&(i.length-=r,i.start===e&&(i.start=n.id),i.cache={})})),t.list=t.list.filter((function(t){return!(!t.start||!t.length)}))}(e,t.start,t.length,o),i&&(i.next=o.id),o&&(o.prev=i.id)},bt={append:function(t,e){return dt(this,t,e),this},prepend:function(t,e){return mt(this,t,e),this},delete:function(t){return gt(this,t),this},replace:function(t,e){var r=this.length;dt(this,t,e);var n=this.buildFrom(this.start,this.length);n.length=r,gt(n,e)},splitOn:function(t){var e=this.terms(),r={before:null,match:null,after:null},n=e.findIndex((function(e){return e.id===t.start}));if(-1===n)return r;var i=e.slice(0,n);i.length>0&&(r.before=this.buildFrom(i[0].id,i.length));var o=e.slice(n,n+t.length);o.length>0&&(r.match=this.buildFrom(o[0].id,o.length));var s=e.slice(n+t.length,e.length);return s.length>0&&(r.after=this.buildFrom(s[0].id,s.length,this.pool)),r}},yt={json:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r={};return t.text&&(r.text=this.text()),t.normal&&(r.normal=this.text("normal")),t.clean&&(r.clean=this.text("clean")),t.reduced&&(r.reduced=this.text("reduced")),t.implicit&&(r.implicit=this.text("implicit")),t.root&&(r.root=this.text("root")),t.trim&&(r.text&&(r.text=r.text.trim()),r.normal&&(r.normal=r.normal.trim()),r.reduced&&(r.reduced=r.reduced.trim())),t.terms&&(!0===t.terms&&(t.terms={}),r.terms=this.terms().map((function(r){return r.json(t.terms,e)}))),r}},At={lookAhead:function(t){t||(t=".*");var e=this.pool,r=[],n=this.terms();return function t(n){var i=e.get(n);i&&(r.push(i),i.prev&&t(i.next))}(n[n.length-1].next),0===r.length?[]:this.buildFrom(r[0].id,r.length).match(t)},lookBehind:function(t){t||(t=".*");var e=this.pool,r=[];return function t(n){var i=e.get(n);i&&(r.push(i),i.prev&&t(i.prev))}(e.get(this.start).prev),0===r.length?[]:this.buildFrom(r[r.length-1].id,r.length).match(t)}},wt=Object.assign({},ut,ht,lt,bt,yt,At),xt=function(t,e){if(0===e.length)return!0;for(var r=0;r0)return!0;if(!0===n.anything&&!0===n.negative)return!0}return!1},Pt=T((function(t,e){e.getGreedy=function(t,e){for(var r=Object.assign({},t.regs[t.r],{start:!1,end:!1}),n=t.t;t.t1&&void 0!==arguments[1]?arguments[1]:0,n=t.regs[t.r],i=!1,o=0;oe&&(e=r.length),n}))&&e},e.getGroup=function(t,e,r){if(t.groups[t.groupId])return t.groups[t.groupId];var n=t.terms[e].id;return t.groups[t.groupId]={group:String(r),start:n,length:0},t.groups[t.groupId]}})),jt=function(t,e,r,n){for(var i={t:0,terms:t,r:0,regs:e,groups:{},start_i:r,phrase_length:n,hasGroup:!1,groupId:null,previousGroup:null};i.ri.t)return null;if(!0===o.end&&i.start_i+i.t!==n)return null}if(!0===i.hasGroup){var v=Pt.getGroup(i,f,o.named);i.t>1&&o.greedy?v.length+=i.t-f:v.length++}}else{if(o.negative){var m=Object.assign({},o);if(m.negative=!1,!0===i.terms[i.t].doesMatch(m,i.start_i+i.t,i.phrase_length))return null}if(!0!==o.optional){if(i.terms[i.t].isImplicit()&&e[i.r-1]&&i.terms[i.t+1]){if(i.terms[i.t-1]&&i.terms[i.t-1].implicit===e[i.r-1].word)return null;if(i.terms[i.t+1].doesMatch(o,i.start_i+i.t,i.phrase_length)){i.t+=2;continue}}return null}}}else{var g=Pt.greedyTo(i,e[i.r+1]);if(void 0!==o.min&&g-i.to.max){i.t=i.t+o.max;continue}if(null===g)return null;!0===i.hasGroup&&(Pt.getGroup(i,i.t,o.named).length=g-i.t),i.t=g}}return{match:i.terms.slice(0,i.t),groups:i.groups}},Et=function(t,e,r){if(!r||0===r.length)return r;if(e.some((function(t){return t.end}))){var n=t[t.length-1];r=r.filter((function(t){return-1!==t.match.indexOf(n)}))}return r},Ot=/\{([0-9]+,?[0-9]*)\}/,kt=/&&/,Ct=new RegExp(/^<(\S+)>/),Ft=function(t){return t[t.length-1]},Tt=function(t){return t[0]},Nt=function(t){return t.substr(1)},Vt=function(t){return t.substr(0,t.length-1)},$t=function(t){return t=Nt(t),t=Vt(t)},Bt=function t(e){for(var r,n={},i=0;i<2;i+=1){if("$"===Ft(e)&&(n.end=!0,e=Vt(e)),"^"===Tt(e)&&(n.start=!0,e=Nt(e)),("["===Tt(e)||"]"===Ft(e))&&(n.named=!0,"["===Tt(e)?n.groupType="]"===Ft(e)?"single":"start":n.groupType="end",e=(e=e.replace(/^\[/,"")).replace(/\]$/,""),"<"===Tt(e))){var o=Ct.exec(e);o.length>=2&&(n.named=o[1],e=e.replace(o[0],""))}if("+"===Ft(e)&&(n.greedy=!0,e=Vt(e)),"*"!==e&&"*"===Ft(e)&&"\\*"!==e&&(n.greedy=!0,e=Vt(e)),"?"===Ft(e)&&(n.optional=!0,e=Vt(e)),"!"===Tt(e)&&(n.negative=!0,e=Nt(e)),"("===Tt(e)&&")"===Ft(e)){kt.test(e)?(n.choices=e.split(kt),n.operator="and"):(n.choices=e.split("|"),n.operator="or"),n.choices[0]=Nt(n.choices[0]);var s=n.choices.length-1;n.choices[s]=Vt(n.choices[s]),n.choices=n.choices.map((function(t){return t.trim()})),n.choices=n.choices.filter((function(t){return t})),n.choices=n.choices.map((function(e){return e.split(/ /g).map(t)})),e=""}if("/"===Tt(e)&&"/"===Ft(e))return e=$t(e),n.regex=new RegExp(e),n;if("~"===Tt(e)&&"~"===Ft(e))return e=$t(e),n.soft=!0,n.word=e,n}return!0===Ot.test(e)&&(e=e.replace(Ot,(function(t,e){var r=e.split(/,/g);return 1===r.length?(n.min=Number(r[0]),n.max=Number(r[0])):(n.min=Number(r[0]),n.max=Number(r[1]||999)),n.greedy=!0,n.optional=!0,""}))),"#"===Tt(e)?(n.tag=Nt(e),n.tag=(r=n.tag).charAt(0).toUpperCase()+r.substr(1),n):"@"===Tt(e)?(n.method=Nt(e),n):"."===e?(n.anything=!0,n):"*"===e?(n.anything=!0,n.greedy=!0,n.optional=!0,n):(e&&(e=(e=e.replace("\\*","*")).replace("\\.","."),n.word=e.toLowerCase()),n)},St=function(t){for(var e,r=!1,n=-1,i=0;i1&&void 0!==arguments[1]?arguments[1]:{},r=t.filter((function(t){return t.groupType})).length;return r>0&&(t=St(t)),e.fuzzy||(t=It(t)),t},Dt=/[^[a-z]]\//g,_t=function(t){return"[object Array]"===Object.prototype.toString.call(t)},Mt=function(t){var e=t.split(/([\^\[\!]*(?:<\S+>)?\(.*?\)[?+*]*\]?\$?)/);return e=e.map((function(t){return t.trim()})),Dt.test(t)&&(e=function(t){return t.forEach((function(e,r){var n=e.match(Dt);null!==n&&1===n.length&&t[r+1]&&(t[r]+=t[r+1],t[r+1]="",null!==(n=t[r].match(Dt))&&1===n.length&&(t[r]+=t[r+2],t[r+2]=""))})),t=t.filter((function(t){return t}))}(e)),e},Gt=function(t){var e=[];return t.forEach((function(t){if(/\(.*\)/.test(t))e.push(t);else{var r=t.split(" ");r=r.filter((function(t){return t})),e=e.concat(r)}})),e},qt=function(t){return[{choices:t.map((function(t){return[{word:t}]})),operator:"or"}]},Lt=function(t){if(!t||!t.list||!t.list[0])return[];var e=[];return t.list.forEach((function(t){var r=[];t.terms().forEach((function(t){r.push(t.id)})),e.push(r)})),[{idBlocks:e}]},Wt=function(t,e){return!0===e.fuzzy&&(e.fuzzy=.85),"number"==typeof e.fuzzy&&(t=t.map((function(t){return e.fuzzy>0&&t.word&&(t.fuzzy=e.fuzzy),t.choices&&t.choices.forEach((function(t){t.forEach((function(t){t.fuzzy=e.fuzzy}))})),t}))),t},Ut=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||""===e)return[];if("object"===t(e)){if(_t(e)){if(0===e.length||!e[0])return[];if("object"===t(e[0]))return e;if("string"==typeof e[0])return qt(e)}return e&&"Doc"===e.isA?Lt(e):[]}"number"==typeof e&&(e=String(e));var n=Mt(e);return n=(n=Gt(n)).map((function(t){return Bt(t)})),n=zt(n,r),n=Wt(n,r)},Rt=function(t,e){for(var r=[],n=e[0].idBlocks,i=function(e){n.forEach((function(n){0!==n.length?n.every((function(r,n){return o=e,t[e+n].id===r}))&&(r.push({match:t.slice(e,e+n.length)}),e+=n.length-1):o=e})),o=e},o=0;o2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof e&&(e=Ut(e)),!0===xt(t,e))return[];var n=e.filter((function(t){return!0!==t.optional&&!0!==t.negative})).length,i=t.terms(),o=[];if(e[0].idBlocks){var s=Rt(i,e);if(s&&s.length>0)return Et(i,e,s)}if(!0===e[0].start){var a=jt(i,e,0,i.length);return a&&a.match&&a.match.length>0&&(a.match=a.match.filter((function(t){return t})),o.push(a)),Et(i,e,o)}for(var u=0;ui.length);u+=1){var c=jt(i.slice(u),e,u,i.length);if(c&&c.match&&c.match.length>0&&(u+=c.match.length-1,c.match=c.match.filter((function(t){return t})),o.push(c),!0===r))return Et(i,e,o)}return Et(i,e,o)},Qt=function(t,e){var r={};Ht(t,e).forEach((function(t){t.match.forEach((function(t){r[t.id]=!0}))}));var n=t.terms(),i=[],o=[];return n.forEach((function(t){!0!==r[t.id]?o.push(t):o.length>0&&(i.push(o),o=[])})),o.length>0&&i.push(o),i},Zt={match:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Ht(this,t,r);return n=n.map((function(t){var r=t.match,n=t.groups,i=e.buildFrom(r[0].id,r.length,n);return i.cache.terms=r,i}))},has:function(t){return Ht(this,t,!0).length>0},not:function(t){var e=this,r=Qt(this,t);return r=r.map((function(t){return e.buildFrom(t[0].id,t.length)}))},canBe:function(t,e){for(var r=this,n=[],i=this.terms(),o=!1,s=0;s0})).map((function(t){return r.buildFrom(t[0].id,t.length)}))}},Jt=function t(r,n,i){e(this,t),this.start=r,this.length=n,this.isA="Phrase",Object.defineProperty(this,"pool",{enumerable:!1,writable:!0,value:i}),Object.defineProperty(this,"cache",{enumerable:!1,writable:!0,value:{}}),Object.defineProperty(this,"groups",{enumerable:!1,writable:!0,value:{}})};Jt.prototype.buildFrom=function(t,e,r){var n=new Jt(t,e,this.pool);return r&&Object.keys(r).length>0?n.groups=r:n.groups=this.groups,n},Object.assign(Jt.prototype,Zt),Object.assign(Jt.prototype,wt);var Yt={term:"terms"};Object.keys(Yt).forEach((function(t){return Jt.prototype[t]=Jt.prototype[Yt[t]]}));var Kt=Jt,Xt=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e(this,t),Object.defineProperty(this,"words",{enumerable:!1,value:r})}return n(t,[{key:"add",value:function(t){return this.words[t.id]=t,this}},{key:"get",value:function(t){return this.words[t]}},{key:"remove",value:function(t){delete this.words[t]}},{key:"merge",value:function(t){return Object.assign(this.words,t.words),this}},{key:"stats",value:function(){return{words:Object.keys(this.words).length}}}]),t}();Xt.prototype.clone=function(){var t=this,e=Object.keys(this.words).reduce((function(e,r){var n=t.words[r].clone();return e[n.id]=n,e}),{});return new Xt(e)};var te=Xt,ee=function(t){t.forEach((function(e,r){r>0&&(e.prev=t[r-1].id),t[r+1]&&(e.next=t[r+1].id)}))},re=/(\S.+?[.!?\u203D\u2E18\u203C\u2047-\u2049])(?=\s+|$)/g,ne=/\S/,ie=/[ .][A-Z]\.? *$/i,oe=/(?:\u2026|\.{2,}) *$/,se=/((?:\r?\n|\r)+)/,ae=/[a-z0-9\u00C0-\u00FF\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/i,ue=/^\s+/,ce=function(t,e){if(!0===ie.test(t))return!1;if(!0===oe.test(t))return!1;if(!1===ae.test(t))return!1;var r=t.replace(/[.!?\u203D\u2E18\u203C\u2047-\u2049] *$/,"").split(" "),n=r[r.length-1].toLowerCase();return!e.hasOwnProperty(n)},he=function(t,e){var r=e.cache.abbreviations;t=t||"";var n=[],i=[];if(!(t=String(t))||"string"!=typeof t||!1===ne.test(t))return n;for(var o=function(t){for(var e=[],r=t.split(se),n=0;n0&&(n.push(c),i[u]="")}if(0===n.length)return[t];for(var h=1;h0?(e[e.length-1]+=o,e.push(a)):e.push(o+a),o=""):o+=a}return o&&(0===e.length&&(e[0]=""),e[e.length-1]+=o),e=(e=function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=null;"string"!=typeof t&&("number"==typeof t?t=String(t):ye(t)&&(n=t)),n=(n=n||he(t,e)).map((function(t){return be(t)})),r=r||new te;var i=n.map((function(t){t=t.map((function(t){var e=new at(t);return r.add(e),e})),ee(t);var e=new Kt(t[0].id,t.length,r);return e.cache.terms=t,e}));return i},we=function(t,e){var r=new te;return t.map((function(t,n){var i=t.terms.map((function(i,o){var s=new at(i.text);return s.pre=void 0!==i.pre?i.pre:"",void 0===i.post&&(i.post=" ",o>=t.terms.length-1&&(i.post=". ",n>=t.terms.length-1&&(i.post="."))),s.post=void 0!==i.post?i.post:" ",i.tags&&i.tags.forEach((function(t){return s.tag(t,"",e)})),r.add(s),s}));return ee(i),new Kt(i[0].id,i.length,r)}))},xe=["Person","Place","Organization"],Pe={Noun:{notA:["Verb","Adjective","Adverb"]},Singular:{isA:"Noun",notA:"Plural"},ProperNoun:{isA:"Noun"},Person:{isA:["ProperNoun","Singular"],notA:["Place","Organization","Date"]},FirstName:{isA:"Person"},MaleName:{isA:"FirstName",notA:["FemaleName","LastName"]},FemaleName:{isA:"FirstName",notA:["MaleName","LastName"]},LastName:{isA:"Person",notA:["FirstName"]},NickName:{isA:"Person",notA:["FirstName","LastName"]},Honorific:{isA:"Noun",notA:["FirstName","LastName","Value"]},Place:{isA:"Singular",notA:["Person","Organization"]},Country:{isA:["Place","ProperNoun"],notA:["City"]},City:{isA:["Place","ProperNoun"],notA:["Country"]},Region:{isA:["Place","ProperNoun"]},Address:{isA:"Place"},Organization:{isA:["Singular","ProperNoun"],notA:["Person","Place"]},SportsTeam:{isA:"Organization"},School:{isA:"Organization"},Company:{isA:"Organization"},Plural:{isA:"Noun",notA:["Singular"]},Uncountable:{isA:"Noun"},Pronoun:{isA:"Noun",notA:xe},Actor:{isA:"Noun",notA:xe},Activity:{isA:"Noun",notA:["Person","Place"]},Unit:{isA:"Noun",notA:xe},Demonym:{isA:["Noun","ProperNoun"],notA:xe},Possessive:{isA:"Noun"}},je={Verb:{notA:["Noun","Adjective","Adverb","Value"]},PresentTense:{isA:"Verb",notA:["PastTense","FutureTense"]},Infinitive:{isA:"PresentTense",notA:["PastTense","Gerund"]},Gerund:{isA:"PresentTense",notA:["PastTense","Copula","FutureTense"]},PastTense:{isA:"Verb",notA:["FutureTense"]},FutureTense:{isA:"Verb"},Copula:{isA:"Verb"},Modal:{isA:"Verb",notA:["Infinitive"]},PerfectTense:{isA:"Verb",notA:"Gerund"},Pluperfect:{isA:"Verb"},Participle:{isA:"PastTense"},PhrasalVerb:{isA:"Verb"},Particle:{isA:"PhrasalVerb"},Auxiliary:{notA:["Noun","Adjective","Value"]}},Ee={Value:{notA:["Verb","Adjective","Adverb"]},Ordinal:{isA:"Value",notA:["Cardinal"]},Cardinal:{isA:"Value",notA:["Ordinal"]},Fraction:{isA:"Value",notA:["Noun"]},RomanNumeral:{isA:"Cardinal",notA:["Ordinal","TextValue"]},TextValue:{isA:"Value",notA:["NumericValue"]},NumericValue:{isA:"Value",notA:["TextValue"]},Money:{isA:"Cardinal"},Percent:{isA:"Value"}},Oe=["Noun","Verb","Adjective","Adverb","Value","QuestionWord"],ke={Adjective:{notA:["Noun","Verb","Adverb","Value"]},Comparable:{isA:["Adjective"]},Comparative:{isA:["Adjective"]},Superlative:{isA:["Adjective"],notA:["Comparative"]},NumberRange:{isA:["Contraction"]},Adverb:{notA:["Noun","Verb","Adjective","Value"]},Date:{notA:["Verb","Conjunction","Adverb","Preposition","Adjective"]},Month:{isA:["Date","Singular"],notA:["Year","WeekDay","Time"]},WeekDay:{isA:["Date","Noun"]},Time:{isA:["Date"],notA:["AtMention"]},Determiner:{notA:Oe},Conjunction:{notA:Oe},Preposition:{notA:Oe},QuestionWord:{notA:["Determiner"]},Currency:{isA:["Noun"]},Expression:{notA:["Noun","Adjective","Verb","Adverb"]},Abbreviation:{},Url:{notA:["HashTag","PhoneNumber","Verb","Adjective","Value","AtMention","Email"]},PhoneNumber:{notA:["HashTag","Verb","Adjective","Value","AtMention","Email"]},HashTag:{},AtMention:{isA:["Noun"],notA:["HashTag","Verb","Adjective","Value","Email"]},Emoji:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Emoticon:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Email:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Acronym:{notA:["Plural","RomanNumeral"]},Negative:{notA:["Noun","Adjective","Value"]},Condition:{notA:["Verb","Adjective","Noun","Value"]}},Ce={Noun:"blue",Verb:"green",Negative:"green",Date:"red",Value:"red",Adjective:"magenta",Preposition:"cyan",Conjunction:"cyan",Determiner:"cyan",Adverb:"cyan"},Fe=function(t){return Object.keys(t).forEach((function(e){t[e].color?t[e].color=t[e].color:Ce[e]?t[e].color=Ce[e]:t[e].isA.some((function(r){return!!Ce[r]&&(t[e].color=Ce[r],!0)}))})),t},Te=function(t){return Object.keys(t).forEach((function(e){for(var r=t[e],n=r.isA.length,i=0;i1&&(r.hasCompound[o[0]]=!0),void 0===De[i]?void 0!==e[n]?("string"==typeof e[n]&&(e[n]=[e[n]]),"string"==typeof i?e[n].push(i):e[n]=e[n].concat(i)):e[n]=i:De[i](e,n,r)}))},Me=function(t){var e=Object.assign({},Ie);return Object.keys(Ie).forEach((function(r){var n=Ie[r];Object.keys(n).forEach((function(t){n[t]=r})),_e(n,e,t)})),e},Ge=_e,qe=function(t){for(var e=t.irregulars.nouns,r=Object.keys(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&"number"!=typeof e&&null!==e||(e={group:e});var r=Ut(t,e);if(0===r.length)return this.buildFrom([]);if(!1===Ye(this,r))return this.buildFrom([]);var n=this.list.reduce((function(t,e){return t.concat(e.match(r))}),[]);return void 0!==e.group&&null!==e.group&&""!==e.group?this.buildFrom(n).groups(e.group):this.buildFrom(n)},e.not=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);if(0===r.length||!1===Ye(this,r))return this;var n=this.list.reduce((function(t,e){return t.concat(e.not(r))}),[]);return this.buildFrom(n)},e.matchOne=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);if(!1===Ye(this,r))return this.buildFrom([]);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);if(!1===Ye(this,r))return this.buildFrom([]);var n=this.list.filter((function(t){return!0===t.has(r)}));return this.buildFrom(n)},e.ifNo=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e),n=this.list.filter((function(t){return!1===t.has(r)}));return this.buildFrom(n)},e.has=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);return!1!==Ye(this,r)&&this.list.some((function(t){return!0===t.has(r)}))},e.lookAhead=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t||(t=".*");var r=Ut(t,e),n=[];return this.list.forEach((function(t){n=n.concat(t.lookAhead(r))})),n=n.filter((function(t){return t})),this.buildFrom(n)},e.lookAfter=e.lookAhead,e.lookBehind=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t||(t=".*");var r=Ut(t,e),n=[];return this.list.forEach((function(t){n=n.concat(t.lookBehind(r))})),n=n.filter((function(t){return t})),this.buildFrom(n)},e.lookBefore=e.lookBehind,e.before=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e),n=this.if(r).list,i=n.map((function(t){var e=t.terms().map((function(t){return t.id})),n=t.match(r)[0],i=e.indexOf(n.start);return 0===i||-1===i?null:t.buildFrom(t.start,i)}));return i=i.filter((function(t){return null!==t})),this.buildFrom(i)},e.after=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e),n=this.if(r).list,i=n.map((function(t){var e=t.terms(),n=e.map((function(t){return t.id})),i=t.match(r)[0],o=n.indexOf(i.start);if(-1===o||!e[o+i.length])return null;var s=e[o+i.length].id,a=t.length-o-i.length;return t.buildFrom(s,a)}));return i=i.filter((function(t){return null!==t})),this.buildFrom(i)},e.hasAfter=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookAfter(t,e).found}))},e.hasBefore=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookBefore(t,e).found}))}})),Xe=function(t,e,r,n){var i=[];"string"==typeof t&&(i=t.split(" ")),e.list.forEach((function(o){var s=o.terms();!0===r&&(s=s.filter((function(r){return r.canBe(t,e.world)}))),s.forEach((function(r,o){i.length>1?i[o]&&"."!==i[o]&&r.tag(i[o],n,e.world):r.tag(t,n,e.world)}))}))},tr={tag:function(t,e){return t?(Xe(t,this,!1,e),this):this},tagSafe:function(t,e){return t?(Xe(t,this,!0,e),this):this},unTag:function(t,e){var r=this;return this.list.forEach((function(n){n.terms().forEach((function(n){return n.unTag(t,e,r.world)}))})),this},canBe:function(t){if(!t)return this;var e=this.world,r=this.list.reduce((function(r,n){return r.concat(n.canBe(t,e))}),[]);return this.buildFrom(r)}},er={map:function(e){var r=this;if(!e)return this;var n=this.list.map((function(t,n){var i=r.buildFrom([t]);i.from=null;var o=e(i,n);return o&&o.list&&o.list[0]?o.list[0]:o}));return 0===(n=n.filter((function(t){return t}))).length?this.buildFrom(n):"object"!==t(n[0])||"Phrase"!==n[0].isA?n:this.buildFrom(n)},forEach:function(t,e){var r=this;return t?(this.list.forEach((function(n,i){var o=r.buildFrom([n]);!0===e&&(o.from=null),t(o,i)})),this):this},filter:function(t){var e=this;if(!t)return this;var r=this.list.filter((function(r,n){var i=e.buildFrom([r]);return i.from=null,t(i,n)}));return this.buildFrom(r)},find:function(t){var e=this;if(!t)return this;var r=this.list.find((function(r,n){var i=e.buildFrom([r]);return i.from=null,t(i,n)}));return r?this.buildFrom([r]):void 0},some:function(t){var e=this;return t?this.list.some((function(r,n){var i=e.buildFrom([r]);return i.from=null,t(i,n)})):this},random:function(t){if(!this.found)return this;var e=Math.floor(Math.random()*this.list.length);if(void 0===t){var r=[this.list[e]];return this.buildFrom(r)}return e+t>this.length&&(e=(e=this.length-t)<0?0:e),this.slice(e,e+t)}},rr=function(t){return t.split(/[ -]/g)},nr=function(t,e,r){for(var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r={};return t.forEach((function(t,n){var i=!0;void 0!==e[n]&&(i=e[n]),t=(t=(t||"").toLowerCase()).replace(/[,;.!?]+$/,"");var o=rr(t).map((function(t){return t.trim()}));r[o[0]]=r[o[0]]||{},1===o.length?r[o[0]].value=i:(r[o[0]].more=r[o[0]].more||[],r[o[0]].more.push({rest:o.slice(1),value:i}))})),r}(t,e),i=[],o=function(t){for(var e=r.list[t],o=e.terms().map((function(t){return t.reduced})),s=function(t){void 0!==n[o[t]]&&(void 0!==n[o[t]].more&&n[o[t]].more.forEach((function(r){void 0!==o[t+r.rest.length]&&(!0===r.rest.every((function(e,r){return e===o[t+r+1]}))&&i.push({id:e.terms()[t].id,value:r.value,length:r.rest.length+1}))})),void 0!==n[o[t]].value&&i.push({id:e.terms()[t].id,value:n[o[t]].value,length:1}))},a=0;a1&&void 0!==arguments[1]?arguments[1]:{};return e?(!0===n&&(n={keepTags:!0}),!1===n&&(n={keepTags:!1}),n=n||{},this.uncache(),this.list.forEach((function(i){var o,s=e;if("function"==typeof e&&(s=e(i)),s&&"object"===t(s)&&"Doc"===s.isA)o=s.list,r.pool().merge(s.pool());else{if("string"!=typeof s)return;!1!==n.keepCase&&i.terms(0).isTitleCase()&&(s=sr(s)),o=Ae(s,r.world,r.pool());var a=r.buildFrom(o);a.tagger(),o=a.list}if(!0===n.keepTags){var u=i.json({terms:{tags:!0}}).terms;o[0].terms().forEach((function(t,e){u[e]&&t.tagSafe(u[e].tags,"keptTag",r.world)}))}i.replace(o[0],r)})),this):this.delete()},replace:function(t,e,r){return void 0===e?this.replaceWith(t,r):(this.match(t).replaceWith(e,r),this)}},ur=T((function(t,e){var r=function(t){return t&&"[object Object]"===Object.prototype.toString.call(t)},n=function(t,e){var r=Ae(t,e.world)[0],n=e.buildFrom([r]);return n.tagger(),e.list=n.list,e};e.append=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?this.found?(this.uncache(),this.list.forEach((function(n){var i;r(e)&&"Doc"===e.isA?i=e.list[0].clone():"string"==typeof e&&(i=Ae(e,t.world,t.pool())[0]),t.buildFrom([i]).tagger(),n.append(i,t)})),this):n(e,this):this},e.insertAfter=e.append,e.insertAt=e.append,e.prepend=function(t){var e=this;return t?this.found?(this.uncache(),this.list.forEach((function(n){var i;r(t)&&"Doc"===t.isA?i=t.list[0].clone():"string"==typeof t&&(i=Ae(t,e.world,e.pool())[0]),e.buildFrom([i]).tagger(),n.prepend(i,e)})),this):n(t,this):this},e.insertBefore=e.prepend,e.concat=function(){this.uncache();for(var t=this.list.slice(0),e=0;e0&&void 0!==arguments[0]?arguments[0]:{};if("number"==typeof e&&this.list[e])return this.list[e].json(r);!0===(e=n(e)).root&&this.list.forEach((function(e){e.terms().forEach((function(e){null===e.root&&e.setRoot(t.world)}))}));var i=this.list.map((function(r){return r.json(e,t.world)}));if((e.terms.offset||e.offset||e.terms.index||e.index)&&lr(this,i,e),e.frequency||e.freq||e.count){var o={};this.list.forEach((function(t){var e=t.text("reduced");o[e]=o[e]||0,o[e]+=1})),this.list.forEach((function(t,e){i[e].count=o[t.text("reduced")]}))}if(e.unique){var s={};i=i.filter((function(t){return!0!==s[t.reduced]&&(s[t.reduced]=!0,!0)}))}return i},e.data=e.json})),pr=T((function(t){var e="",r=function(t,e){for(t=t.toString();t.lengthe.count?-1:t.countn?1:0},length:function(t,e){var r=t.text().trim().length,n=e.text().trim().length;return rn?-1:0},wordCount:function(t,e){var r=t.wordCount(),n=e.wordCount();return rn?-1:0}};mr.alphabetical=mr.alpha,mr.wordcount=mr.wordCount;var gr={index:!0,sequence:!0,seq:!0,sequential:!0,chron:!0,chronological:!0},br={sort:function(t){return"freq"===(t=t||"alpha")||"frequency"===t||"topk"===t?(r={},n={case:!0,punctuation:!1,whitespace:!0,unicode:!0},(e=this).list.forEach((function(t){var e=t.text(n);r[e]=r[e]||0,r[e]+=1})),e.list.sort((function(t,e){var i=r[t.text(n)],o=r[e.text(n)];return io?-1:0})),e):gr.hasOwnProperty(t)?function(t){var e={};return t.json({terms:{offset:!0}}).forEach((function(t){e[t.terms[0].id]=t.terms[0].offset.start})),t.list=t.list.sort((function(t,r){return e[t.start]>e[r.start]?1:e[t.start]0){i+=s;continue}}if(void 0===r[o]||!0!==r.hasOwnProperty(o))if(o===t[i].reduced||!0!==r.hasOwnProperty(t[i].reduced)){if(!0===Ir.test(o)){var a=o.replace(Ir,"");!0===r.hasOwnProperty(a)&&t[i].tag(r[a],"noprefix-lexicon",e)}}else t[i].tag(r[t[i].reduced],"lexicon",e);else t[i].tag(r[o],"lexicon",e)}return t},_r=function(t){var e=t.termList();return Dr(e,t.world),t.world.taggers.forEach((function(e){e(t)})),t},Mr=function(t){var r=function(t){i(o,t);var r=u(o);function o(){return e(this,o),r.apply(this,arguments)}return n(o,[{key:"stripPeriods",value:function(){return this.termList().forEach((function(t){!0===t.tags.Abbreviation&&t.next&&(t.post=t.post.replace(/^\./,""));var e=t.text.replace(/\./,"");t.set(e)})),this}},{key:"addPeriods",value:function(){return this.termList().forEach((function(t){t.post=t.post.replace(/^\./,""),t.post="."+t.post})),this}}]),o}(t);return r.prototype.unwrap=r.prototype.stripPeriods,t.prototype.abbreviations=function(t){var e=this.match("#Abbreviation");return"number"==typeof t&&(e=e.get(t)),new r(e.list,this,this.world)},t},Gr=/\./,qr=function(t){var r=function(t){i(o,t);var r=u(o);function o(){return e(this,o),r.apply(this,arguments)}return n(o,[{key:"stripPeriods",value:function(){return this.termList().forEach((function(t){var e=t.text.replace(/\./g,"");t.set(e)})),this}},{key:"addPeriods",value:function(){return this.termList().forEach((function(t){var e=t.text.replace(/\./g,"");e=e.split("").join("."),!1===Gr.test(t.post)&&(e+="."),t.set(e)})),this}}]),o}(t);return r.prototype.unwrap=r.prototype.stripPeriods,r.prototype.strip=r.prototype.stripPeriods,t.prototype.acronyms=function(t){var e=this.match("#Acronym");return"number"==typeof t&&(e=e.get(t)),new r(e.list,this,this.world)},t},Lr=function(t){return t.prototype.clauses=function(e){var r=this.if("@hasComma").notIf("@hasComma @hasComma").notIf("@hasComma . .? (and|or) .").notIf("(#City && @hasComma) #Country").notIf("(#WeekDay && @hasComma) #Date").notIf("(#Date && @hasComma) #Year").notIf("@hasComma (too|also)$").match("@hasComma"),n=this.splitAfter(r),i=n.quotations(),o=(n=n.splitOn(i)).parentheses(),s=(n=n.splitOn(o)).if("#Copula #Adjective #Conjunction (#Pronoun|#Determiner) #Verb").match("#Conjunction"),a=(n=n.splitBefore(s)).if("if .{2,9} then .").match("then"),u=(n=(n=(n=(n=(n=(n=n.splitBefore(a)).splitBefore("as well as .")).splitBefore("such as .")).splitBefore("in addition to .")).splitAfter("@hasSemicolon")).splitAfter("@hasDash")).filter((function(t){return t.wordCount()>5&&t.match("#Verb+").length>=2}));if(u.found){var c=u.splitAfter("#Noun .* #Verb .* #Noun+");n=n.splitOn(c.eq(0))}return"number"==typeof e&&(n=n.get(e)),new t(n.list,this,this.world)},t},Wr=function(t){var r=function(t){i(o,t);var r=u(o);function o(t,n,i){var s;return e(this,o),(s=r.call(this,t,n,i)).contracted=null,s}return n(o,[{key:"expand",value:function(){return this.list.forEach((function(t){var e=t.terms(),r=e[0].isTitleCase();e.forEach((function(t,r){t.set(t.implicit||t.text),t.implicit=void 0,r1&&void 0!==arguments[1]?arguments[1]:{},n=this.match("(#City && @hasComma) (#Region|#Country)"),i=this.not(n).splitAfter("@hasComma"),o=(i=i.concat(n)).quotations();return o.found&&(i=i.splitOn(o.eq(0))),i=i.match("#Noun+ (of|by)? the? #Noun+?"),!0!==e.keep_anaphora&&(i=(i=(i=(i=i.not("#Pronoun")).not("(there|these)")).not("(#Month|#WeekDay)")).not("(my|our|your|their|her|his)")),i=i.not("(of|for|by|the)$"),"number"==typeof t&&(i=i.get(t)),new r(i.list,this,this.world)},t},sn=/\(/,an=/\)/,un=function(t){var r=function(t){i(o,t);var r=u(o);function o(){return e(this,o),r.apply(this,arguments)}return n(o,[{key:"unwrap",value:function(){return this.list.forEach((function(t){var e=t.terms(0);e.pre=e.pre.replace(sn,"");var r=t.lastTerm();r.post=r.post.replace(an,"")})),this}}]),o}(t);return t.prototype.parentheses=function(t){var e=[];return this.list.forEach((function(t){for(var r=t.terms(),n=0;n0}}),Object.defineProperty(this,"length",{get:function(){return o.list.length}}),Object.defineProperty(this,"isA",{get:function(){return"Doc"}})}return n(t,[{key:"tagger",value:function(){return _r(this)}},{key:"pool",value:function(){return this.list.length>0?this.list[0].pool:this.all().list[0].pool}}]),t}();Cn.prototype.buildFrom=function(t){return t=t.map((function(t){return t.clone(!0)})),new Cn(t,this,this.world)},Cn.prototype.fromText=function(t){var e=Ae(t,this.world,this.pool());return this.buildFrom(e)},Object.assign(Cn.prototype,kn.misc),Object.assign(Cn.prototype,kn.selections),On(Cn);var Fn={untag:"unTag",and:"match",notIf:"ifNo",only:"if",onlyIf:"if"};Object.keys(Fn).forEach((function(t){return Cn.prototype[t]=Cn.prototype[Fn[t]]}));var Tn=Cn;return function t(e){var r=e,n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;e&&r.addWords(e);var n=Ae(t,r),i=new Tn(n,null,r);return i.tagger(),i};return n.tokenize=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,n=r;e&&((n=n.clone()).words={},n.addWords(e));var i=Ae(t,n),o=new Tn(i,null,n);return(e||o.world.taggers.length>0)&&_r(o),o},n.extend=function(t){return t(Tn,r,this,Kt,at,te),this},n.fromJSON=function(t){var e=we(t,r);return new Tn(e,null,r)},n.clone=function(){return t(r.clone())},n.verbose=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return r.verbose(t),this},n.world=function(){return r},n.parseMatch=function(t,e){return Ut(t,e)},n.version="13.10.0",n.import=n.load,n.plugin=n.extend,n}(new Qe)})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).nlp=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;rr?n:r)+1;if(Math.abs(r-n)>(i||100))return i||100;for(var o,s,a,u,c,h,l=[],f=0;f4)return r;u=s===(a=e[o-1])?0:1,c=l[v-1][o]+1,(h=l[v][o-1]+1)1&&o>1&&s===e[o-2]&&t[v-2]===a&&(h=l[v-2][o-2]+u)2&&void 0!==arguments[2]?arguments[2]:3;if(t===e)return 1;if(t.lengthe.fuzzy)return!0;if(!0===e.soft&&(i=B(e.word,t.root))>e.fuzzy)return!0}return e.word===t.clean||e.word===t.text||e.word===t.reduced}return void 0!==e.tag?!0===t.tags[e.tag]:void 0!==e.method?"function"==typeof t[e.method]&&!0===t[e.method]():void 0!==e.regex?e.regex.test(t.clean):void 0!==e.fastOr?e.fastOr.hasOwnProperty(t.reduced)||e.fastOr.hasOwnProperty(t.text):void 0!==e.choices&&("and"===e.operator?e.choices.every((function(e){return S(t,e,r,n)})):e.choices.some((function(e){return S(t,e,r,n)})))},z=S=function(t,e,r,n){var i=I(t,e,r,n);return!0===e.negative?!i:i},D={},_={doesMatch:function(t,e,r){return z(this,t,e,r)},isAcronym:function(){return b(this.text)},isImplicit:function(){return""===this.text&&Boolean(this.implicit)},isKnown:function(){return Object.keys(this.tags).some((function(t){return!0!==D[t]}))},setRoot:function(t){var e=t.transforms,r=this.implicit||this.clean;if(this.tags.Plural&&(r=e.toSingular(r,t)),this.tags.Verb&&!this.tags.Negative&&!this.tags.Infinitive){var n=null;this.tags.PastTense?n="PastTense":this.tags.Gerund?n="Gerund":this.tags.PresentTense?n="PresentTense":this.tags.Participle?n="Participle":this.tags.Actor&&(n="Actor"),r=e.toInfinitive(r,t,n)}this.root=r}},M=/[\s-]/,G=/^[A-Z-]+$/,q={textOut:function(t,e,r){t=t||{};var n=this.text,i=this.pre,o=this.post;return!0===t.reduced&&(n=this.reduced||""),!0===t.root&&(n=this.root||""),!0===t.implicit&&this.implicit&&(n=this.implicit||""),!0===t.normal&&(n=this.clean||this.text||""),!0===t.root&&(n=this.root||this.reduced||""),!0===t.unicode&&(n=p(n)),!0===t.titlecase&&(this.tags.ProperNoun&&!this.titleCase()||(this.tags.Acronym?n=n.toUpperCase():G.test(n)&&!this.tags.Acronym&&(n=n.toLowerCase()))),!0===t.lowercase&&(n=n.toLowerCase()),!0===t.acronyms&&this.tags.Acronym&&(n=n.replace(/\./g,"")),!0!==t.whitespace&&!0!==t.root||(i="",o=" ",!1!==M.test(this.post)&&!t.last||this.implicit||(o="")),!0!==t.punctuation||t.root||(!0===this.hasPost(".")?o="."+o:!0===this.hasPost("?")?o="?"+o:!0===this.hasPost("!")?o="!"+o:!0===this.hasPost(",")?o=","+o:!0===this.hasEllipses()&&(o="..."+o)),!0!==e&&(i=""),!0!==r&&(o=""),!0===t.abbreviations&&this.tags.Abbreviation&&(o=o.replace(/^\./,"")),i+n+o}},L={Auxiliary:1,Possessive:1},W=function(t,e){var r=Object.keys(t.tags),n=e.tags;return r=r.sort((function(t,e){return L[e]||!n[e]?-1:n[e]?n[t]?n[t].lineage.length>n[e].lineage.length?1:n[t].isA.length>n[e].isA.length?-1:0:0:1}))},U={text:!0,tags:!0,implicit:!0,whitespace:!0,clean:!1,id:!1,index:!1,offset:!1,bestTag:!1},R={json:function(t,e){t=t||{};var r={};return(t=Object.assign({},U,t)).text&&(r.text=this.text),t.normal&&(r.normal=this.clean),t.tags&&(r.tags=Object.keys(this.tags)),t.clean&&(r.clean=this.clean),(t.id||t.offset)&&(r.id=this.id),t.implicit&&null!==this.implicit&&(r.implicit=this.implicit),t.whitespace&&(r.pre=this.pre,r.post=this.post),t.bestTag&&(r.bestTag=W(this,e)[0]),r}},H=Object.assign({},N,V,_,q,R);function Q(){return"undefined"!=typeof window&&window.document}var Z=function(t,e){for(t=t.toString();t.length0&&void 0!==arguments[0]?arguments[0]:"";e(this,t),r=String(r);var n=F(r);this.text=n.text||"",this.clean=n.clean,this.reduced=n.reduced,this.root=null,this.implicit=null,this.pre=n.pre||"",this.post=n.post||"",this.tags={},this.prev=null,this.next=null,this.id=h(n.clean),this.isA="Term",n.alias&&(this.alias=n.alias)}return n(t,[{key:"set",value:function(t){var e=F(t);return this.text=e.text,this.clean=e.clean,this}}]),t}();st.prototype.clone=function(){var t=new st(this.text);return t.pre=this.pre,t.post=this.post,t.clean=this.clean,t.reduced=this.reduced,t.root=this.root,t.implicit=this.implicit,t.tags=Object.assign({},this.tags),t},Object.assign(st.prototype,H),Object.assign(st.prototype,ot);var at=st,ut={terms:function(t){if(0===this.length)return[];if(this.cache.terms)return void 0!==t?this.cache.terms[t]:this.cache.terms;for(var e=[this.pool.get(this.start)],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;"string"==typeof t&&(t="normal"===t?{whitespace:!0,unicode:!0,lowercase:!0,punctuation:!0,acronyms:!0,abbreviations:!0,implicit:!0,normal:!0}:"clean"===t?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,normal:!0}:"reduced"===t?{punctuation:!1,titlecase:!1,lowercase:!0,whitespace:!0,unicode:!0,implicit:!0,reduced:!0}:"implicit"===t?{punctuation:!0,implicit:!0,whitespace:!0,trim:!0}:"root"===t?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,root:!0}:{});var n=this.terms(),i=!1;n[0]&&null===n[0].prev&&null===n[n.length-1].next&&(i=!0);var o=n.reduce((function(o,s,a){if(0===a&&""===s.text&&null!==s.implicit&&!t.implicit)return o;t.last=r&&a===n.length-1;var u=!0,c=!0;return!1===i&&(0===a&&e&&(u=!1),a===n.length-1&&r&&(c=!1)),o+s.textOut(t,u,c)}),"");return!0===i&&r&&(o=ct(o)),!0===t.trim&&(o=o.trim()),o}},lt={trim:function(){var t=this.terms();if(t.length>0){t[0].pre=t[0].pre.replace(/^\s+/,"");var e=t[t.length-1];e.post=e.post.replace(/\s+$/,"")}return this}},ft=/[.?!]\s*$/,pt=function(t,e){e[0].pre=t[0].pre;var r,n,i=t[t.length-1],o=e[e.length-1];o.post=(r=i.post,n=o.post,ft.test(n)?n+r.match(/\s*$/):r),i.post="",""===i.post&&(i.post+=" ")},vt=function(t,e,r){var n=t.terms(),i=e.terms();pt(n,i),function(t,e,r){var n=t[t.length-1],i=e[e.length-1],o=n.next;n.next=e[0].id,i.next=o,o&&(r.get(o).prev=i.id);var s=t[0].id;s&&(e[0].prev=s)}(n,i,t.pool);var o,s=[t],a=t.start,u=[r];return(u=u.concat(r.parents())).forEach((function(t){var e=t.list.filter((function(t){return t.hasId(a)}));s=s.concat(e)})),(s=(o=s).filter((function(t,e){return o.indexOf(t)===e}))).forEach((function(t){t.length+=e.length})),t.cache={},t},dt=/ /,mt=function(t,e,r){var n=t.start,i=e.terms();!function(t){var e=t[t.length-1];!1===dt.test(e.post)&&(e.post+=" ")}(i),function(t,e,r){var n=r[r.length-1];n.next=t.start;var i=t.pool,o=i.get(t.start);o.prev&&(i.get(o.prev).next=e.start),r[0].prev=t.terms(0).prev,t.terms(0).prev=n.id}(t,e,i);var o,s=[t],a=[r];return(a=a.concat(r.parents())).forEach((function(t){var r=t.list.filter((function(t){return t.hasId(n)||t.hasId(e.start)}));s=s.concat(r)})),(s=(o=s).filter((function(t,e){return o.indexOf(t)===e}))).forEach((function(t){t.length+=e.length,t.start===n&&(t.start=e.start),t.cache={}})),t},gt=function(t,e){var r=e.pool(),n=t.terms(),i=r.get(n[0].prev)||{},o=r.get(n[n.length-1].next)||{};n[0].implicit&&i.implicit&&(i.set(i.implicit),i.post+=" "),function(t,e,r,n){var i=t.parents();i.push(t),i.forEach((function(t){var i=t.list.find((function(t){return t.hasId(e)}));i&&(i.length-=r,i.start===e&&(i.start=n.id),i.cache={})})),t.list=t.list.filter((function(t){return!(!t.start||!t.length)}))}(e,t.start,t.length,o),i&&(i.next=o.id),o&&(o.prev=i.id)},bt={append:function(t,e){return vt(this,t,e),this},prepend:function(t,e){return mt(this,t,e),this},delete:function(t){return gt(this,t),this},replace:function(t,e){var r=this.length;vt(this,t,e);var n=this.buildFrom(this.start,this.length);n.length=r,gt(n,e)},splitOn:function(t){var e=this.terms(),r={before:null,match:null,after:null},n=e.findIndex((function(e){return e.id===t.start}));if(-1===n)return r;var i=e.slice(0,n);i.length>0&&(r.before=this.buildFrom(i[0].id,i.length));var o=e.slice(n,n+t.length);o.length>0&&(r.match=this.buildFrom(o[0].id,o.length));var s=e.slice(n+t.length,e.length);return s.length>0&&(r.after=this.buildFrom(s[0].id,s.length,this.pool)),r}},yt={json:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r={};return t.text&&(r.text=this.text()),t.normal&&(r.normal=this.text("normal")),t.clean&&(r.clean=this.text("clean")),t.reduced&&(r.reduced=this.text("reduced")),t.implicit&&(r.implicit=this.text("implicit")),t.root&&(r.root=this.text("root")),t.trim&&(r.text&&(r.text=r.text.trim()),r.normal&&(r.normal=r.normal.trim()),r.reduced&&(r.reduced=r.reduced.trim())),t.terms&&(!0===t.terms&&(t.terms={}),r.terms=this.terms().map((function(r){return r.json(t.terms,e)}))),r}},At={lookAhead:function(t){t||(t=".*");var e=this.pool,r=[],n=this.terms();return function t(n){var i=e.get(n);i&&(r.push(i),i.prev&&t(i.next))}(n[n.length-1].next),0===r.length?[]:this.buildFrom(r[0].id,r.length).match(t)},lookBehind:function(t){t||(t=".*");var e=this.pool,r=[];return function t(n){var i=e.get(n);i&&(r.push(i),i.prev&&t(i.prev))}(e.get(this.start).prev),0===r.length?[]:this.buildFrom(r[r.length-1].id,r.length).match(t)}},wt=Object.assign({},ut,ht,lt,bt,yt,At),xt=function(t,e){if(0===e.length)return!0;for(var r=0;r0)return!0;if(!0===n.anything&&!0===n.negative)return!0}return!1},Pt=T((function(t,e){e.getGreedy=function(t,e){for(var r=Object.assign({},t.regs[t.r],{start:!1,end:!1}),n=t.t;t.t1&&void 0!==arguments[1]?arguments[1]:0,n=t.regs[t.r],i=!1,o=0;oe&&(e=r.length),n}))&&e},e.getGroup=function(t,e,r){if(t.groups[t.groupId])return t.groups[t.groupId];var n=t.terms[e].id;return t.groups[t.groupId]={group:String(r),start:n,length:0},t.groups[t.groupId]}})),jt=function(t,e,r,n){for(var i={t:0,terms:t,r:0,regs:e,groups:{},start_i:r,phrase_length:n,hasGroup:!1,groupId:null,previousGroup:null};i.ri.t)return null;if(!0===o.end&&i.start_i+i.t!==n)return null}if(!0===i.hasGroup){var d=Pt.getGroup(i,f,o.named);i.t>1&&o.greedy?d.length+=i.t-f:d.length++}}else{if(o.negative){var m=Object.assign({},o);if(m.negative=!1,!0===i.terms[i.t].doesMatch(m,i.start_i+i.t,i.phrase_length))return null}if(!0!==o.optional){if(i.terms[i.t].isImplicit()&&e[i.r-1]&&i.terms[i.t+1]){if(i.terms[i.t-1]&&i.terms[i.t-1].implicit===e[i.r-1].word)return null;if(i.terms[i.t+1].doesMatch(o,i.start_i+i.t,i.phrase_length)){i.t+=2;continue}}return null}}}else{var g=Pt.greedyTo(i,e[i.r+1]);if(void 0!==o.min&&g-i.to.max){i.t=i.t+o.max;continue}if(null===g)return null;!0===i.hasGroup&&(Pt.getGroup(i,i.t,o.named).length=g-i.t),i.t=g}}return{match:i.terms.slice(0,i.t),groups:i.groups}},Et=function(t,e,r){if(!r||0===r.length)return r;if(e.some((function(t){return t.end}))){var n=t[t.length-1];r=r.filter((function(t){return-1!==t.match.indexOf(n)}))}return r},Ot=/\{([0-9]+,?[0-9]*)\}/,kt=/&&/,Ct=new RegExp(/^<(\S+)>/),Ft=function(t){return t[t.length-1]},Tt=function(t){return t[0]},Nt=function(t){return t.substr(1)},Vt=function(t){return t.substr(0,t.length-1)},$t=function(t){return t=Nt(t),t=Vt(t)},Bt=function t(e){for(var r,n={},i=0;i<2;i+=1){if("$"===Ft(e)&&(n.end=!0,e=Vt(e)),"^"===Tt(e)&&(n.start=!0,e=Nt(e)),("["===Tt(e)||"]"===Ft(e))&&(n.named=!0,"["===Tt(e)?n.groupType="]"===Ft(e)?"single":"start":n.groupType="end",e=(e=e.replace(/^\[/,"")).replace(/\]$/,""),"<"===Tt(e))){var o=Ct.exec(e);o.length>=2&&(n.named=o[1],e=e.replace(o[0],""))}if("+"===Ft(e)&&(n.greedy=!0,e=Vt(e)),"*"!==e&&"*"===Ft(e)&&"\\*"!==e&&(n.greedy=!0,e=Vt(e)),"?"===Ft(e)&&(n.optional=!0,e=Vt(e)),"!"===Tt(e)&&(n.negative=!0,e=Nt(e)),"("===Tt(e)&&")"===Ft(e)){kt.test(e)?(n.choices=e.split(kt),n.operator="and"):(n.choices=e.split("|"),n.operator="or"),n.choices[0]=Nt(n.choices[0]);var s=n.choices.length-1;n.choices[s]=Vt(n.choices[s]),n.choices=n.choices.map((function(t){return t.trim()})),n.choices=n.choices.filter((function(t){return t})),n.choices=n.choices.map((function(e){return e.split(/ /g).map(t)})),e=""}if("/"===Tt(e)&&"/"===Ft(e))return e=$t(e),n.regex=new RegExp(e),n;if("~"===Tt(e)&&"~"===Ft(e))return e=$t(e),n.soft=!0,n.word=e,n}return!0===Ot.test(e)&&(e=e.replace(Ot,(function(t,e){var r=e.split(/,/g);return 1===r.length?(n.min=Number(r[0]),n.max=Number(r[0])):(n.min=Number(r[0]),n.max=Number(r[1]||999)),n.greedy=!0,n.optional=!0,""}))),"#"===Tt(e)?(n.tag=Nt(e),n.tag=(r=n.tag).charAt(0).toUpperCase()+r.substr(1),n):"@"===Tt(e)?(n.method=Nt(e),n):"."===e?(n.anything=!0,n):"*"===e?(n.anything=!0,n.greedy=!0,n.optional=!0,n):(e&&(e=(e=e.replace("\\*","*")).replace("\\.","."),n.word=e.toLowerCase()),n)},St=function(t){for(var e,r=!1,n=-1,i=0;i1&&void 0!==arguments[1]?arguments[1]:{},r=t.filter((function(t){return t.groupType})).length;return r>0&&(t=St(t)),e.fuzzy||(t=It(t)),t},Dt=/[^[a-z]]\//g,_t=function(t){return"[object Array]"===Object.prototype.toString.call(t)},Mt=function(t){var e=t.split(/([\^\[\!]*(?:<\S+>)?\(.*?\)[?+*]*\]?\$?)/);return e=e.map((function(t){return t.trim()})),Dt.test(t)&&(e=function(t){return t.forEach((function(e,r){var n=e.match(Dt);null!==n&&1===n.length&&t[r+1]&&(t[r]+=t[r+1],t[r+1]="",null!==(n=t[r].match(Dt))&&1===n.length&&(t[r]+=t[r+2],t[r+2]=""))})),t=t.filter((function(t){return t}))}(e)),e},Gt=function(t){var e=[];return t.forEach((function(t){if(/\(.*\)/.test(t))e.push(t);else{var r=t.split(" ");r=r.filter((function(t){return t})),e=e.concat(r)}})),e},qt=function(t){return[{choices:t.map((function(t){return[{word:t}]})),operator:"or"}]},Lt=function(t){if(!t||!t.list||!t.list[0])return[];var e=[];return t.list.forEach((function(t){var r=[];t.terms().forEach((function(t){r.push(t.id)})),e.push(r)})),[{idBlocks:e}]},Wt=function(t,e){return!0===e.fuzzy&&(e.fuzzy=.85),"number"==typeof e.fuzzy&&(t=t.map((function(t){return e.fuzzy>0&&t.word&&(t.fuzzy=e.fuzzy),t.choices&&t.choices.forEach((function(t){t.forEach((function(t){t.fuzzy=e.fuzzy}))})),t}))),t},Ut=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||""===e)return[];if("object"===t(e)){if(_t(e)){if(0===e.length||!e[0])return[];if("object"===t(e[0]))return e;if("string"==typeof e[0])return qt(e)}return e&&"Doc"===e.isA?Lt(e):[]}"number"==typeof e&&(e=String(e));var n=Mt(e);return n=(n=Gt(n)).map((function(t){return Bt(t)})),n=zt(n,r),n=Wt(n,r)},Rt=function(t,e){for(var r=[],n=e[0].idBlocks,i=function(e){n.forEach((function(n){0!==n.length?n.every((function(r,n){return o=e,t[e+n].id===r}))&&(r.push({match:t.slice(e,e+n.length)}),e+=n.length-1):o=e})),o=e},o=0;o2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof e&&(e=Ut(e)),!0===xt(t,e))return[];var n=e.filter((function(t){return!0!==t.optional&&!0!==t.negative})).length,i=t.terms(),o=[];if(e[0].idBlocks){var s=Rt(i,e);if(s&&s.length>0)return Et(i,e,s)}if(!0===e[0].start){var a=jt(i,e,0,i.length);return a&&a.match&&a.match.length>0&&(a.match=a.match.filter((function(t){return t})),o.push(a)),Et(i,e,o)}for(var u=0;ui.length);u+=1){var c=jt(i.slice(u),e,u,i.length);if(c&&c.match&&c.match.length>0&&(u+=c.match.length-1,c.match=c.match.filter((function(t){return t})),o.push(c),!0===r))return Et(i,e,o)}return Et(i,e,o)},Qt=function(t,e){var r={};Ht(t,e).forEach((function(t){t.match.forEach((function(t){r[t.id]=!0}))}));var n=t.terms(),i=[],o=[];return n.forEach((function(t){!0!==r[t.id]?o.push(t):o.length>0&&(i.push(o),o=[])})),o.length>0&&i.push(o),i},Zt={match:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Ht(this,t,r);return n=n.map((function(t){var r=t.match,n=t.groups,i=e.buildFrom(r[0].id,r.length,n);return i.cache.terms=r,i}))},has:function(t){return Ht(this,t,!0).length>0},not:function(t){var e=this,r=Qt(this,t);return r=r.map((function(t){return e.buildFrom(t[0].id,t.length)}))},canBe:function(t,e){for(var r=this,n=[],i=this.terms(),o=!1,s=0;s0})).map((function(t){return r.buildFrom(t[0].id,t.length)}))}},Jt=function t(r,n,i){e(this,t),this.start=r,this.length=n,this.isA="Phrase",Object.defineProperty(this,"pool",{enumerable:!1,writable:!0,value:i}),Object.defineProperty(this,"cache",{enumerable:!1,writable:!0,value:{}}),Object.defineProperty(this,"groups",{enumerable:!1,writable:!0,value:{}})};Jt.prototype.buildFrom=function(t,e,r){var n=new Jt(t,e,this.pool);return r&&Object.keys(r).length>0?n.groups=r:n.groups=this.groups,n},Object.assign(Jt.prototype,Zt),Object.assign(Jt.prototype,wt);var Yt={term:"terms"};Object.keys(Yt).forEach((function(t){return Jt.prototype[t]=Jt.prototype[Yt[t]]}));var Kt=Jt,Xt=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e(this,t),Object.defineProperty(this,"words",{enumerable:!1,value:r})}return n(t,[{key:"add",value:function(t){return this.words[t.id]=t,this}},{key:"get",value:function(t){return this.words[t]}},{key:"remove",value:function(t){delete this.words[t]}},{key:"merge",value:function(t){return Object.assign(this.words,t.words),this}},{key:"stats",value:function(){return{words:Object.keys(this.words).length}}}]),t}();Xt.prototype.clone=function(){var t=this,e=Object.keys(this.words).reduce((function(e,r){var n=t.words[r].clone();return e[n.id]=n,e}),{});return new Xt(e)};var te=Xt,ee=function(t){t.forEach((function(e,r){r>0&&(e.prev=t[r-1].id),t[r+1]&&(e.next=t[r+1].id)}))},re=/(\S.+?[.!?\u203D\u2E18\u203C\u2047-\u2049])(?=\s+|$)/g,ne=/\S/,ie=/[ .][A-Z]\.? *$/i,oe=/(?:\u2026|\.{2,}) *$/,se=/((?:\r?\n|\r)+)/,ae=/[a-z0-9\u00C0-\u00FF\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/i,ue=/^\s+/,ce=function(t,e){if(!0===ie.test(t))return!1;if(!0===oe.test(t))return!1;if(!1===ae.test(t))return!1;var r=t.replace(/[.!?\u203D\u2E18\u203C\u2047-\u2049] *$/,"").split(" "),n=r[r.length-1].toLowerCase();return!e.hasOwnProperty(n)},he=function(t,e){var r=e.cache.abbreviations;t=t||"";var n=[],i=[];if(!(t=String(t))||"string"!=typeof t||!1===ne.test(t))return n;for(var o=function(t){for(var e=[],r=t.split(se),n=0;n0&&(n.push(c),i[u]="")}if(0===n.length)return[t];for(var h=1;h0?(e[e.length-1]+=o,e.push(a)):e.push(o+a),o=""):o+=a}return o&&(0===e.length&&(e[0]=""),e[e.length-1]+=o),e=(e=function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=null;"string"!=typeof t&&("number"==typeof t?t=String(t):ye(t)&&(n=t)),n=(n=n||he(t,e)).map((function(t){return be(t)})),r=r||new te;var i=n.map((function(t){t=t.map((function(t){var e=new at(t);return r.add(e),e})),ee(t);var e=new Kt(t[0].id,t.length,r);return e.cache.terms=t,e}));return i},we=function(t,e){var r=new te;return t.map((function(t,n){var i=t.terms.map((function(i,o){var s=new at(i.text);return s.pre=void 0!==i.pre?i.pre:"",void 0===i.post&&(i.post=" ",o>=t.terms.length-1&&(i.post=". ",n>=t.terms.length-1&&(i.post="."))),s.post=void 0!==i.post?i.post:" ",i.tags&&i.tags.forEach((function(t){return s.tag(t,"",e)})),r.add(s),s}));return ee(i),new Kt(i[0].id,i.length,r)}))},xe=["Person","Place","Organization"],Pe={Noun:{notA:["Verb","Adjective","Adverb"]},Singular:{isA:"Noun",notA:"Plural"},ProperNoun:{isA:"Noun"},Person:{isA:["ProperNoun","Singular"],notA:["Place","Organization","Date"]},FirstName:{isA:"Person"},MaleName:{isA:"FirstName",notA:["FemaleName","LastName"]},FemaleName:{isA:"FirstName",notA:["MaleName","LastName"]},LastName:{isA:"Person",notA:["FirstName"]},NickName:{isA:"Person",notA:["FirstName","LastName"]},Honorific:{isA:"Noun",notA:["FirstName","LastName","Value"]},Place:{isA:"Singular",notA:["Person","Organization"]},Country:{isA:["Place","ProperNoun"],notA:["City"]},City:{isA:["Place","ProperNoun"],notA:["Country"]},Region:{isA:["Place","ProperNoun"]},Address:{isA:"Place"},Organization:{isA:["Singular","ProperNoun"],notA:["Person","Place"]},SportsTeam:{isA:"Organization"},School:{isA:"Organization"},Company:{isA:"Organization"},Plural:{isA:"Noun",notA:["Singular"]},Uncountable:{isA:"Noun"},Pronoun:{isA:"Noun",notA:xe},Actor:{isA:"Noun",notA:xe},Activity:{isA:"Noun",notA:["Person","Place"]},Unit:{isA:"Noun",notA:xe},Demonym:{isA:["Noun","ProperNoun"],notA:xe},Possessive:{isA:"Noun"}},je={Verb:{notA:["Noun","Adjective","Adverb","Value"]},PresentTense:{isA:"Verb",notA:["PastTense","FutureTense"]},Infinitive:{isA:"PresentTense",notA:["PastTense","Gerund"]},Imperative:{isA:"Infinitive"},Gerund:{isA:"PresentTense",notA:["PastTense","Copula","FutureTense"]},PastTense:{isA:"Verb",notA:["FutureTense"]},FutureTense:{isA:"Verb"},Copula:{isA:"Verb"},Modal:{isA:"Verb",notA:["Infinitive"]},PerfectTense:{isA:"Verb",notA:"Gerund"},Pluperfect:{isA:"Verb"},Participle:{isA:"PastTense"},PhrasalVerb:{isA:"Verb"},Particle:{isA:"PhrasalVerb"},Auxiliary:{notA:["Noun","Adjective","Value"]}},Ee={Value:{notA:["Verb","Adjective","Adverb"]},Ordinal:{isA:"Value",notA:["Cardinal"]},Cardinal:{isA:"Value",notA:["Ordinal"]},Fraction:{isA:"Value",notA:["Noun"]},RomanNumeral:{isA:"Cardinal",notA:["Ordinal","TextValue"]},TextValue:{isA:"Value",notA:["NumericValue"]},NumericValue:{isA:"Value",notA:["TextValue"]},Money:{isA:"Cardinal"},Percent:{isA:"Value"}},Oe=["Noun","Verb","Adjective","Adverb","Value","QuestionWord"],ke={Adjective:{notA:["Noun","Verb","Adverb","Value"]},Comparable:{isA:["Adjective"]},Comparative:{isA:["Adjective"]},Superlative:{isA:["Adjective"],notA:["Comparative"]},NumberRange:{isA:["Contraction"]},Adverb:{notA:["Noun","Verb","Adjective","Value"]},Date:{notA:["Verb","Adverb","Preposition","Adjective"]},Month:{isA:["Date","Singular"],notA:["Year","WeekDay","Time"]},WeekDay:{isA:["Date","Noun"]},Time:{isA:["Date"],notA:["AtMention"]},Determiner:{notA:Oe},Conjunction:{notA:Oe},Preposition:{notA:Oe},QuestionWord:{notA:["Determiner"]},Currency:{isA:["Noun"]},Expression:{notA:["Noun","Adjective","Verb","Adverb"]},Abbreviation:{},Url:{notA:["HashTag","PhoneNumber","Verb","Adjective","Value","AtMention","Email"]},PhoneNumber:{notA:["HashTag","Verb","Adjective","Value","AtMention","Email"]},HashTag:{},AtMention:{isA:["Noun"],notA:["HashTag","Verb","Adjective","Value","Email"]},Emoji:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Emoticon:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Email:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Acronym:{notA:["Plural","RomanNumeral"]},Negative:{notA:["Noun","Adjective","Value"]},Condition:{notA:["Verb","Adjective","Noun","Value"]}},Ce={Noun:"blue",Verb:"green",Negative:"green",Date:"red",Value:"red",Adjective:"magenta",Preposition:"cyan",Conjunction:"cyan",Determiner:"cyan",Adverb:"cyan"},Fe=function(t){return Object.keys(t).forEach((function(e){t[e].color?t[e].color=t[e].color:Ce[e]?t[e].color=Ce[e]:t[e].isA.some((function(r){return!!Ce[r]&&(t[e].color=Ce[r],!0)}))})),t},Te=function(t){return Object.keys(t).forEach((function(e){for(var r=t[e],n=r.isA.length,i=0;i1&&(r.hasCompound[o[0]]=!0),void 0===De[i]?void 0!==e[n]?("string"==typeof e[n]&&(e[n]=[e[n]]),"string"==typeof i?e[n].push(i):e[n]=e[n].concat(i)):e[n]=i:De[i](e,n,r)}))},Me=function(t){var e=Object.assign({},Ie);return Object.keys(Ie).forEach((function(r){var n=Ie[r];Object.keys(n).forEach((function(t){n[t]=r})),_e(n,e,t)})),e},Ge=_e,qe=function(t){for(var e=t.irregulars.nouns,r=Object.keys(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&"number"!=typeof e&&null!==e||(e={group:e});var r=Ut(t,e);if(0===r.length)return this.buildFrom([]);if(!1===Ye(this,r))return this.buildFrom([]);var n=this.list.reduce((function(t,e){return t.concat(e.match(r))}),[]);return void 0!==e.group&&null!==e.group&&""!==e.group?this.buildFrom(n).groups(e.group):this.buildFrom(n)},e.not=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);if(0===r.length||!1===Ye(this,r))return this;var n=this.list.reduce((function(t,e){return t.concat(e.not(r))}),[]);return this.buildFrom(n)},e.matchOne=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);if(!1===Ye(this,r))return this.buildFrom([]);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);if(!1===Ye(this,r))return this.buildFrom([]);var n=this.list.filter((function(t){return!0===t.has(r)}));return this.buildFrom(n)},e.ifNo=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e),n=this.list.filter((function(t){return!1===t.has(r)}));return this.buildFrom(n)},e.has=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e);return!1!==Ye(this,r)&&this.list.some((function(t){return!0===t.has(r)}))},e.lookAhead=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t||(t=".*");var r=Ut(t,e),n=[];return this.list.forEach((function(t){n=n.concat(t.lookAhead(r))})),n=n.filter((function(t){return t})),this.buildFrom(n)},e.lookAfter=e.lookAhead,e.lookBehind=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t||(t=".*");var r=Ut(t,e),n=[];return this.list.forEach((function(t){n=n.concat(t.lookBehind(r))})),n=n.filter((function(t){return t})),this.buildFrom(n)},e.lookBefore=e.lookBehind,e.before=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e),n=this.if(r).list,i=n.map((function(t){var e=t.terms().map((function(t){return t.id})),n=t.match(r)[0],i=e.indexOf(n.start);return 0===i||-1===i?null:t.buildFrom(t.start,i)}));return i=i.filter((function(t){return null!==t})),this.buildFrom(i)},e.after=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ut(t,e),n=this.if(r).list,i=n.map((function(t){var e=t.terms(),n=e.map((function(t){return t.id})),i=t.match(r)[0],o=n.indexOf(i.start);if(-1===o||!e[o+i.length])return null;var s=e[o+i.length].id,a=t.length-o-i.length;return t.buildFrom(s,a)}));return i=i.filter((function(t){return null!==t})),this.buildFrom(i)},e.hasAfter=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookAfter(t,e).found}))},e.hasBefore=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookBefore(t,e).found}))}})),Xe=function(t,e,r,n){var i=[];"string"==typeof t&&(i=t.split(" ")),e.list.forEach((function(o){var s=o.terms();!0===r&&(s=s.filter((function(r){return r.canBe(t,e.world)}))),s.forEach((function(r,o){i.length>1?i[o]&&"."!==i[o]&&r.tag(i[o],n,e.world):r.tag(t,n,e.world)}))}))},tr={tag:function(t,e){return t?(Xe(t,this,!1,e),this):this},tagSafe:function(t,e){return t?(Xe(t,this,!0,e),this):this},unTag:function(t,e){var r=this;return this.list.forEach((function(n){n.terms().forEach((function(n){return n.unTag(t,e,r.world)}))})),this},canBe:function(t){if(!t)return this;var e=this.world,r=this.list.reduce((function(r,n){return r.concat(n.canBe(t,e))}),[]);return this.buildFrom(r)}},er={map:function(e){var r=this;if(!e)return this;var n=this.list.map((function(t,n){var i=r.buildFrom([t]);i.from=null;var o=e(i,n);return o&&o.list&&o.list[0]?o.list[0]:o}));return 0===(n=n.filter((function(t){return t}))).length?this.buildFrom(n):"object"!==t(n[0])||"Phrase"!==n[0].isA?n:this.buildFrom(n)},forEach:function(t,e){var r=this;return t?(this.list.forEach((function(n,i){var o=r.buildFrom([n]);!0===e&&(o.from=null),t(o,i)})),this):this},filter:function(t){var e=this;if(!t)return this;var r=this.list.filter((function(r,n){var i=e.buildFrom([r]);return i.from=null,t(i,n)}));return this.buildFrom(r)},find:function(t){var e=this;if(!t)return this;var r=this.list.find((function(r,n){var i=e.buildFrom([r]);return i.from=null,t(i,n)}));return r?this.buildFrom([r]):void 0},some:function(t){var e=this;return t?this.list.some((function(r,n){var i=e.buildFrom([r]);return i.from=null,t(i,n)})):this},random:function(t){if(!this.found)return this;var e=Math.floor(Math.random()*this.list.length);if(void 0===t){var r=[this.list[e]];return this.buildFrom(r)}return e+t>this.length&&(e=(e=this.length-t)<0?0:e),this.slice(e,e+t)}},rr=function(t){return t.split(/[ -]/g)},nr=function(t,e,r){for(var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r={};return t.forEach((function(t,n){var i=!0;void 0!==e[n]&&(i=e[n]),t=(t=(t||"").toLowerCase()).replace(/[,;.!?]+$/,"");var o=rr(t).map((function(t){return t.trim()}));r[o[0]]=r[o[0]]||{},1===o.length?r[o[0]].value=i:(r[o[0]].more=r[o[0]].more||[],r[o[0]].more.push({rest:o.slice(1),value:i}))})),r}(t,e),i=[],o=function(t){for(var e=r.list[t],o=e.terms().map((function(t){return t.reduced})),s=function(t){void 0!==n[o[t]]&&(void 0!==n[o[t]].more&&n[o[t]].more.forEach((function(r){void 0!==o[t+r.rest.length]&&(!0===r.rest.every((function(e,r){return e===o[t+r+1]}))&&i.push({id:e.terms()[t].id,value:r.value,length:r.rest.length+1}))})),void 0!==n[o[t]].value&&i.push({id:e.terms()[t].id,value:n[o[t]].value,length:1}))},a=0;a1&&void 0!==arguments[1]?arguments[1]:{};return e?(!0===n&&(n={keepTags:!0}),!1===n&&(n={keepTags:!1}),n=n||{},this.uncache(),this.list.forEach((function(i){var o,s=e;if("function"==typeof e&&(s=e(i)),s&&"object"===t(s)&&"Doc"===s.isA)o=s.list,r.pool().merge(s.pool());else{if("string"!=typeof s)return;!1!==n.keepCase&&i.terms(0).isTitleCase()&&(s=sr(s)),o=Ae(s,r.world,r.pool());var a=r.buildFrom(o);a.tagger(),o=a.list}if(!0===n.keepTags){var u=i.json({terms:{tags:!0}}).terms;o[0].terms().forEach((function(t,e){u[e]&&t.tagSafe(u[e].tags,"keptTag",r.world)}))}i.replace(o[0],r)})),this):this.delete()},replace:function(t,e,r){return void 0===e?this.replaceWith(t,r):(this.match(t).replaceWith(e,r),this)}},ur=T((function(t,e){var r=function(t){return t&&"[object Object]"===Object.prototype.toString.call(t)},n=function(t,e){var r=Ae(t,e.world)[0],n=e.buildFrom([r]);return n.tagger(),e.list=n.list,e};e.append=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?this.found?(this.uncache(),this.list.forEach((function(n){var i;r(e)&&"Doc"===e.isA?i=e.list[0].clone():"string"==typeof e&&(i=Ae(e,t.world,t.pool())[0]),t.buildFrom([i]).tagger(),n.append(i,t)})),this):n(e,this):this},e.insertAfter=e.append,e.insertAt=e.append,e.prepend=function(t){var e=this;return t?this.found?(this.uncache(),this.list.forEach((function(n){var i;r(t)&&"Doc"===t.isA?i=t.list[0].clone():"string"==typeof t&&(i=Ae(t,e.world,e.pool())[0]),e.buildFrom([i]).tagger(),n.prepend(i,e)})),this):n(t,this):this},e.insertBefore=e.prepend,e.concat=function(){this.uncache();for(var t=this.list.slice(0),e=0;e0&&void 0!==arguments[0]?arguments[0]:{};if("number"==typeof e&&this.list[e])return this.list[e].json(r);!0===(e=n(e)).root&&this.list.forEach((function(e){e.terms().forEach((function(e){null===e.root&&e.setRoot(t.world)}))}));var i=this.list.map((function(r){return r.json(e,t.world)}));if((e.terms.offset||e.offset||e.terms.index||e.index)&&lr(this,i,e),e.frequency||e.freq||e.count){var o={};this.list.forEach((function(t){var e=t.text("reduced");o[e]=o[e]||0,o[e]+=1})),this.list.forEach((function(t,e){i[e].count=o[t.text("reduced")]}))}if(e.unique){var s={};i=i.filter((function(t){return!0!==s[t.reduced]&&(s[t.reduced]=!0,!0)}))}return i},e.data=e.json})),pr=T((function(t){var e="",r=function(t,e){for(t=t.toString();t.lengthe.count?-1:t.countn?1:0},length:function(t,e){var r=t.text().trim().length,n=e.text().trim().length;return rn?-1:0},wordCount:function(t,e){var r=t.wordCount(),n=e.wordCount();return rn?-1:0}};mr.alphabetical=mr.alpha,mr.wordcount=mr.wordCount;var gr={index:!0,sequence:!0,seq:!0,sequential:!0,chron:!0,chronological:!0},br={sort:function(t){return"freq"===(t=t||"alpha")||"frequency"===t||"topk"===t?(r={},n={case:!0,punctuation:!1,whitespace:!0,unicode:!0},(e=this).list.forEach((function(t){var e=t.text(n);r[e]=r[e]||0,r[e]+=1})),e.list.sort((function(t,e){var i=r[t.text(n)],o=r[e.text(n)];return io?-1:0})),e):gr.hasOwnProperty(t)?function(t){var e={};return t.json({terms:{offset:!0}}).forEach((function(t){e[t.terms[0].id]=t.terms[0].offset.start})),t.list=t.list.sort((function(t,r){return e[t.start]>e[r.start]?1:e[t.start]0){i+=s;continue}}if(void 0===r[o]||!0!==r.hasOwnProperty(o))if(o===t[i].reduced||!0!==r.hasOwnProperty(t[i].reduced)){if(!0===Ir.test(o)){var a=o.replace(Ir,"");!0===r.hasOwnProperty(a)&&t[i].tag(r[a],"noprefix-lexicon",e)}}else t[i].tag(r[t[i].reduced],"lexicon",e);else t[i].tag(r[o],"lexicon",e)}return t},_r=function(t){var e=t.termList();return Dr(e,t.world),t.world.taggers.forEach((function(e){e(t)})),t},Mr=function(t){var r=function(t){i(o,t);var r=u(o);function o(){return e(this,o),r.apply(this,arguments)}return n(o,[{key:"stripPeriods",value:function(){return this.termList().forEach((function(t){!0===t.tags.Abbreviation&&t.next&&(t.post=t.post.replace(/^\./,""));var e=t.text.replace(/\./,"");t.set(e)})),this}},{key:"addPeriods",value:function(){return this.termList().forEach((function(t){t.post=t.post.replace(/^\./,""),t.post="."+t.post})),this}}]),o}(t);return r.prototype.unwrap=r.prototype.stripPeriods,t.prototype.abbreviations=function(t){var e=this.match("#Abbreviation");return"number"==typeof t&&(e=e.get(t)),new r(e.list,this,this.world)},t},Gr=/\./,qr=function(t){var r=function(t){i(o,t);var r=u(o);function o(){return e(this,o),r.apply(this,arguments)}return n(o,[{key:"stripPeriods",value:function(){return this.termList().forEach((function(t){var e=t.text.replace(/\./g,"");t.set(e)})),this}},{key:"addPeriods",value:function(){return this.termList().forEach((function(t){var e=t.text.replace(/\./g,"");e=e.split("").join("."),!1===Gr.test(t.post)&&(e+="."),t.set(e)})),this}}]),o}(t);return r.prototype.unwrap=r.prototype.stripPeriods,r.prototype.strip=r.prototype.stripPeriods,t.prototype.acronyms=function(t){var e=this.match("#Acronym");return"number"==typeof t&&(e=e.get(t)),new r(e.list,this,this.world)},t},Lr=function(t){return t.prototype.clauses=function(e){var r=this.if("@hasComma").notIf("@hasComma @hasComma").notIf("@hasComma . .? (and|or) .").notIf("(#City && @hasComma) #Country").notIf("(#WeekDay && @hasComma) #Date").notIf("(#Date && @hasComma) #Year").notIf("@hasComma (too|also)$").match("@hasComma"),n=this.splitAfter(r),i=n.quotations(),o=(n=n.splitOn(i)).parentheses(),s=(n=n.splitOn(o)).if("#Copula #Adjective #Conjunction (#Pronoun|#Determiner) #Verb").match("#Conjunction"),a=(n=n.splitBefore(s)).if("if .{2,9} then .").match("then"),u=(n=(n=(n=(n=(n=(n=n.splitBefore(a)).splitBefore("as well as .")).splitBefore("such as .")).splitBefore("in addition to .")).splitAfter("@hasSemicolon")).splitAfter("@hasDash")).filter((function(t){return t.wordCount()>5&&t.match("#Verb+").length>=2}));if(u.found){var c=u.splitAfter("#Noun .* #Verb .* #Noun+");n=n.splitOn(c.eq(0))}return"number"==typeof e&&(n=n.get(e)),new t(n.list,this,this.world)},t},Wr=function(t){var r=function(t){i(o,t);var r=u(o);function o(t,n,i){var s;return e(this,o),(s=r.call(this,t,n,i)).contracted=null,s}return n(o,[{key:"expand",value:function(){return this.list.forEach((function(t){var e=t.terms(),r=e[0].isTitleCase();e.forEach((function(t,r){t.set(t.implicit||t.text),t.implicit=void 0,r1&&void 0!==arguments[1]?arguments[1]:{},n=this.match("(#City && @hasComma) (#Region|#Country)"),i=this.not(n).splitAfter("@hasComma"),o=(i=i.concat(n)).quotations();return o.found&&(i=i.splitOn(o.eq(0))),i=i.match("#Noun+ (of|by)? the? #Noun+?"),!0!==e.keep_anaphora&&(i=(i=(i=(i=i.not("#Pronoun")).not("(there|these)")).not("(#Month|#WeekDay)")).not("(my|our|your|their|her|his)")),i=i.not("(of|for|by|the)$"),"number"==typeof t&&(i=i.get(t)),new r(i.list,this,this.world)},t},sn=/\(/,an=/\)/,un=function(t){var r=function(t){i(o,t);var r=u(o);function o(){return e(this,o),r.apply(this,arguments)}return n(o,[{key:"unwrap",value:function(){return this.list.forEach((function(t){var e=t.terms(0);e.pre=e.pre.replace(sn,"");var r=t.lastTerm();r.post=r.post.replace(an,"")})),this}}]),o}(t);return t.prototype.parentheses=function(t){var e=[];return this.list.forEach((function(t){for(var r=t.terms(),n=0;n0}}),Object.defineProperty(this,"length",{get:function(){return o.list.length}}),Object.defineProperty(this,"isA",{get:function(){return"Doc"}})}return n(t,[{key:"tagger",value:function(){return _r(this)}},{key:"pool",value:function(){return this.list.length>0?this.list[0].pool:this.all().list[0].pool}}]),t}();kn.prototype.buildFrom=function(t){return t=t.map((function(t){return t.clone(!0)})),new kn(t,this,this.world)},kn.prototype.fromText=function(t){var e=Ae(t,this.world,this.pool());return this.buildFrom(e)},Object.assign(kn.prototype,On.misc),Object.assign(kn.prototype,On.selections),En(kn);var Cn={untag:"unTag",and:"match",notIf:"ifNo",only:"if",onlyIf:"if"};Object.keys(Cn).forEach((function(t){return kn.prototype[t]=kn.prototype[Cn[t]]}));var Fn=kn;return function t(e){var r=e,n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;e&&r.addWords(e);var n=Ae(t,r),i=new Fn(n,null,r);return i.tagger(),i};return n.tokenize=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,n=r;e&&((n=n.clone()).words={},n.addWords(e));var i=Ae(t,n),o=new Fn(i,null,n);return(e||o.world.taggers.length>0)&&_r(o),o},n.extend=function(t){return t(Fn,r,this,Kt,at,te),this},n.fromJSON=function(t){var e=we(t,r);return new Fn(e,null,r)},n.clone=function(){return t(r.clone())},n.verbose=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return r.verbose(t),this},n.world=function(){return r},n.parseMatch=function(t,e){return Ut(t,e)},n.version="13.10.1",n.import=n.load,n.plugin=n.extend,n}(new Qe)})); diff --git a/builds/compromise.js b/builds/compromise.js index 8f24b1c75..25085c4dc 100644 --- a/builds/compromise.js +++ b/builds/compromise.js @@ -1,4 +1,4 @@ -/* compromise 13.10.0 MIT */ +/* compromise 13.10.1 MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -80,7 +80,7 @@ if (typeof Proxy === "function") return true; try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; @@ -197,11 +197,11 @@ var unicode_1 = killUnicode; // console.log(killUnicode('bjŏȒk—Ɏó')); var periodAcronym = /([A-Z]\.)+[A-Z]?,?$/; - var oneLetterAcronym = /^[A-Z]\.,?$/; + var oneLetterAcronym$1 = /^[A-Z]\.,?$/; var noPeriodAcronym = /[A-Z]{2,}('s|,)?$/; var lowerCaseAcronym = /([a-z]\.){1,}[a-z]\.?$/; - var isAcronym = function isAcronym(str) { + var isAcronym$2 = function isAcronym(str) { //like N.D.A if (periodAcronym.test(str) === true) { return true; @@ -213,7 +213,7 @@ } //like 'F.' - if (oneLetterAcronym.test(str) === true) { + if (oneLetterAcronym$1.test(str) === true) { return true; } //like NDA @@ -225,9 +225,9 @@ return false; }; - var isAcronym_1 = isAcronym; + var isAcronym_1$1 = isAcronym$2; - var hasSlash = /[a-z\u00C0-\u00FF] ?\/ ?[a-z\u00C0-\u00FF]/; + var hasSlash$1 = /[a-z\u00C0-\u00FF] ?\/ ?[a-z\u00C0-\u00FF]/; /** some basic operations on a string to reduce noise */ var clean = function clean(str) { @@ -238,7 +238,7 @@ str = unicode_1(str); //rough handling of slashes - 'see/saw' - if (hasSlash.test(str) === true) { + if (hasSlash$1.test(str) === true) { str = str.replace(/\/.*/, ''); } //#tags, @mentions @@ -262,7 +262,7 @@ } //compact acronyms - if (isAcronym_1(str)) { + if (isAcronym_1$1(str)) { str = str.replace(/\./g, ''); } //strip leading & trailing grammatical punctuation @@ -305,7 +305,7 @@ var startings = /^[ \n\t\.’'\[\](){}⟨⟩:,،、‒–—―…!.‹›«»‐\-?‘’;\/⁄·&*•^†‡°¡¿※№÷׺ª%‰+−=‱¶′″‴§~|‖¦©℗®℠™¤₳฿\u0022|\uFF02|\u0027|\u201C|\u2018|\u201F|\u201B|\u201E|\u2E42|\u201A|\u00AB|\u2039|\u2035|\u2036|\u2037|\u301D|\u0060|\u301F]+/; var endings = /[ \n\t\.’'\[\](){}⟨⟩:,،、‒–—―…!.‹›«»‐\-?‘’;\/⁄·&*@•^†‡°¡¿※#№÷׺ª‰+−=‱¶′″‴§~|‖¦©℗®℠™¤₳฿\u0022|\uFF02|\u0027|\u201D|\u2019|\u201D|\u2019|\u201D|\u201D|\u2019|\u00BB|\u203A|\u2032|\u2033|\u2034|\u301E|\u00B4|\u301E]+$/; //money = ₵¢₡₢$₫₯֏₠€ƒ₣₲₴₭₺₾ℳ₥₦₧₱₰£៛₽₹₨₪৳₸₮₩¥ - var hasSlash$1 = /\//; + var hasSlash = /\//; var hasApostrophe = /['’]/; var hasAcronym = /^[a-z]\.([a-z]\.)+/i; var minusNumber = /^[-+\.][0-9]/; @@ -372,8 +372,8 @@ post: post }; // support aliases for slashes - if (hasSlash$1.test(str)) { - str.split(hasSlash$1).forEach(function (word) { + if (hasSlash.test(str)) { + str.split(hasSlash).forEach(function (word) { parsed.alias = parsed.alias || {}; parsed.alias[word.trim()] = true; }); @@ -382,7 +382,7 @@ return parsed; }; - var parse = parseTerm; + var parse$2 = parseTerm; function createCommonjsModule(fn) { var module = { exports: {} }; @@ -433,7 +433,7 @@ exports.titleCase = exports.isTitleCase; }); - var _02Punctuation = createCommonjsModule(function (module, exports) { + var _02Punctuation$1 = createCommonjsModule(function (module, exports) { // these methods are called with '@hasComma' in the match syntax // various unicode quotation-mark formats var startQuote = /(\u0022|\uFF02|\u0027|\u201C|\u2018|\u201F|\u201B|\u201E|\u2E42|\u201A|\u00AB|\u2039|\u2035|\u2036|\u2037|\u301D|\u0060|\u301F)/; @@ -755,8 +755,8 @@ /** does this term look like an acronym? */ - var isAcronym_1$1 = function isAcronym_1$1() { - return isAcronym_1(this.text); + var isAcronym_1 = function isAcronym_1() { + return isAcronym_1$1(this.text); }; /** is this term implied by a contraction? */ @@ -806,13 +806,13 @@ var _03Misc = { doesMatch: doesMatch_1, - isAcronym: isAcronym_1$1, + isAcronym: isAcronym_1, isImplicit: isImplicit, isKnown: isKnown, setRoot: setRoot }; - var hasSpace = /[\s-]/; + var hasSpace$1 = /[\s-]/; var isUpperCase = /^[A-Z-]+$/; // const titleCase = str => { // return str.charAt(0).toUpperCase() + str.substr(1) // } @@ -873,7 +873,7 @@ before = ''; after = ' '; - if ((hasSpace.test(this.post) === false || options.last) && !this.implicit) { + if ((hasSpace$1.test(this.post) === false || options.last) && !this.implicit) { after = ''; } } @@ -967,7 +967,7 @@ }; /** return various metadata for this term */ - var json = function json(options, world) { + var json$1 = function json(options, world) { options = options || {}; options = Object.assign({}, jsonDefault, options); var result = {}; // default on @@ -1009,11 +1009,11 @@ return result; }; - var _05Json = { - json: json + var _05Json$1 = { + json: json$1 }; - var methods = Object.assign({}, _01Case, _02Punctuation, _03Misc, _04Text, _05Json); + var methods$8 = Object.assign({}, _01Case, _02Punctuation$1, _03Misc, _04Text, _05Json$1); function isClientSide() { return typeof window !== 'undefined' && window.document; @@ -1067,19 +1067,19 @@ console.log(log); }; - var isArray = function isArray(arr) { + var isArray$3 = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; - var titleCase = function titleCase(str) { + var titleCase$4 = function titleCase(str) { return str.charAt(0).toUpperCase() + str.substr(1); }; - var fns = { + var fns$1 = { logTag: logTag, logUntag: logUntag, - isArray: isArray, - titleCase: titleCase + isArray: isArray$3, + titleCase: titleCase$4 }; /** add a tag, and its descendents, to a term */ @@ -1095,7 +1095,7 @@ tag = tag.replace(/^#/, ''); } - tag = fns.titleCase(tag); //if we already got this one + tag = fns$1.titleCase(tag); //if we already got this one if (t.tags[tag] === true) { return; @@ -1105,7 +1105,7 @@ var isVerbose = world.isVerbose(); if (isVerbose === true) { - fns.logTag(t, tag, reason); + fns$1.logTag(t, tag, reason); } //add tag @@ -1118,7 +1118,7 @@ t.tags[down] = true; if (isVerbose === true) { - fns.logTag(t, '→ ' + down); + fns$1.logTag(t, '→ ' + down); } }); //remove any contrary tags @@ -1143,13 +1143,13 @@ var lowerCase = /^[a-z]/; - var titleCase$1 = function titleCase(str) { + var titleCase$3 = function titleCase(str) { return str.charAt(0).toUpperCase() + str.substr(1); }; /** remove this tag, and its descentents from the term */ - var unTag = function unTag(t, tag, reason, world) { + var unTag$1 = function unTag(t, tag, reason, world) { var isVerbose = world.isVerbose(); //support '*' for removing all tags if (tag === '*') { @@ -1160,7 +1160,7 @@ tag = tag.replace(/^#/, ''); if (lowerCase.test(tag) === true) { - tag = titleCase$1(tag); + tag = titleCase$3(tag); } // remove the tag @@ -1168,7 +1168,7 @@ delete t.tags[tag]; //log in verbose-mode if (isVerbose === true) { - fns.logUntag(t, tag, reason); + fns$1.logUntag(t, tag, reason); } } //delete downstream tags too @@ -1183,7 +1183,7 @@ delete t.tags[lineage[i]]; if (isVerbose === true) { - fns.logUntag(t, ' - ' + lineage[i]); + fns$1.logUntag(t, ' - ' + lineage[i]); } } } @@ -1196,18 +1196,18 @@ var untagAll = function untagAll(term, tags, reason, world) { if (typeof tags !== 'string' && tags) { for (var i = 0; i < tags.length; i++) { - unTag(term, tags[i], reason, world); + unTag$1(term, tags[i], reason, world); } return; } - unTag(term, tags, reason, world); + unTag$1(term, tags, reason, world); }; - var unTag_1 = untagAll; + var unTag_1$1 = untagAll; - var canBe = function canBe(term, tag, world) { + var canBe$2 = function canBe(term, tag, world) { var tagset = world.tags; // cleanup tag if (tag[0] === '#') { @@ -1235,7 +1235,7 @@ return true; }; - var canBe_1 = canBe; + var canBe_1$1 = canBe$2; /** add a tag or tags, and their descendents to this term * @param {string | string[]} tags - a tag or tags @@ -1249,8 +1249,8 @@ /** only tag this term if it's consistent with it's current tags */ - var tagSafe = function tagSafe(tags, reason, world) { - if (canBe_1(this, tags, world)) { + var tagSafe$1 = function tagSafe(tags, reason, world) { + if (canBe_1$1(this, tags, world)) { add(this, tags, reason, world); } @@ -1262,8 +1262,8 @@ */ - var unTag_1$1 = function unTag_1$1(tags, reason, world) { - unTag_1(this, tags, reason, world); + var unTag_1 = function unTag_1(tags, reason, world) { + unTag_1$1(this, tags, reason, world); return this; }; /** is this tag consistent with the word's current tags? @@ -1272,15 +1272,15 @@ */ - var canBe_1$1 = function canBe_1$1(tags, world) { - return canBe_1(this, tags, world); + var canBe_1 = function canBe_1(tags, world) { + return canBe_1$1(this, tags, world); }; - var tag = { + var tag$1 = { tag: tag_1, - tagSafe: tagSafe, - unTag: unTag_1$1, - canBe: canBe_1$1 + tagSafe: tagSafe$1, + unTag: unTag_1, + canBe: canBe_1 }; var Term = /*#__PURE__*/function () { @@ -1290,7 +1290,7 @@ _classCallCheck(this, Term); text = String(text); - var obj = parse(text); // the various forms of our text + var obj = parse$2(text); // the various forms of our text this.text = obj.text || ''; this.clean = obj.clean; @@ -1316,7 +1316,7 @@ _createClass(Term, [{ key: "set", value: function set(str) { - var obj = parse(str); + var obj = parse$2(str); this.text = obj.text; this.clean = obj.clean; return this; @@ -1342,8 +1342,8 @@ return term; }; - Object.assign(Term.prototype, methods); - Object.assign(Term.prototype, tag); + Object.assign(Term.prototype, methods$8); + Object.assign(Term.prototype, tag$1); var Term_1 = Term; /** return a flat array of Term objects */ @@ -1393,7 +1393,7 @@ /** return a shallow or deep copy of this phrase */ - var clone = function clone(isShallow) { + var clone$1 = function clone(isShallow) { var _this = this; if (isShallow) { @@ -1505,9 +1505,9 @@ return this.buildFrom(start, len); }; - var _01Utils = { + var _01Utils$1 = { terms: terms, - clone: clone, + clone: clone$1, lastTerm: lastTerm, hasId: hasId, wordCount: wordCount, @@ -1520,7 +1520,7 @@ /** produce output in the given format */ - var text = function text() { + var text$1 = function text() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var isFirst = arguments.length > 1 ? arguments[1] : undefined; var isLast = arguments.length > 2 ? arguments[2] : undefined; @@ -1630,7 +1630,7 @@ }; var _02Text = { - text: text + text: text$1 }; /** remove start and end whitespace */ @@ -1665,7 +1665,7 @@ }; //add whitespace to the start of the second bit - var addWhitespace = function addWhitespace(beforeTerms, newTerms) { + var addWhitespace$1 = function addWhitespace(beforeTerms, newTerms) { // add any existing pre-whitespace to beginning newTerms[0].pre = beforeTerms[0].pre; var lastTerm = beforeTerms[beforeTerms.length - 1]; //add any existing punctuation to end of our new terms @@ -1681,7 +1681,7 @@ }; //insert this segment into the linked-list - var stitchIn = function stitchIn(beforeTerms, newTerms, pool) { + var stitchIn$1 = function stitchIn(beforeTerms, newTerms, pool) { var lastBefore = beforeTerms[beforeTerms.length - 1]; var lastNew = newTerms[newTerms.length - 1]; var afterId = lastBefore.next; //connect ours in (main → newPhrase) @@ -1706,7 +1706,7 @@ }; // avoid stretching a phrase twice. - var unique = function unique(list) { + var unique$5 = function unique(list) { return list.filter(function (o, i) { return list.indexOf(o) === i; }); @@ -1717,9 +1717,9 @@ var beforeTerms = before.terms(); var newTerms = newPhrase.terms(); //spruce-up the whitespace issues - addWhitespace(beforeTerms, newTerms); //insert this segment into the linked-list + addWhitespace$1(beforeTerms, newTerms); //insert this segment into the linked-list - stitchIn(beforeTerms, newTerms, before.pool); // stretch! + stitchIn$1(beforeTerms, newTerms, before.pool); // stretch! // make each effected phrase longer var toStretch = [before]; @@ -1735,7 +1735,7 @@ toStretch = toStretch.concat(shouldChange); }); // don't double-count a phrase - toStretch = unique(toStretch); + toStretch = unique$5(toStretch); toStretch.forEach(function (p) { p.length += newPhrase.length; }); @@ -1745,15 +1745,15 @@ var append = appendPhrase; - var hasSpace$1 = / /; //a new space needs to be added, either on the new phrase, or the old one + var hasSpace = / /; //a new space needs to be added, either on the new phrase, or the old one // '[new] [◻old]' -or- '[old] [◻new] [old]' - var addWhitespace$1 = function addWhitespace(newTerms) { + var addWhitespace = function addWhitespace(newTerms) { //add a space before our new text? // add a space after our text var lastTerm = newTerms[newTerms.length - 1]; - if (hasSpace$1.test(lastTerm.post) === false) { + if (hasSpace.test(lastTerm.post) === false) { lastTerm.post += ' '; } @@ -1761,7 +1761,7 @@ }; //insert this segment into the linked-list - var stitchIn$1 = function stitchIn(main, newPhrase, newTerms) { + var stitchIn = function stitchIn(main, newPhrase, newTerms) { // [newPhrase] → [main] var lastTerm = newTerms[newTerms.length - 1]; lastTerm.next = main.start; // [before] → [main] @@ -1781,7 +1781,7 @@ main.terms(0).prev = lastTerm.id; }; - var unique$1 = function unique(list) { + var unique$4 = function unique(list) { return list.filter(function (o, i) { return list.indexOf(o) === i; }); @@ -1792,9 +1792,9 @@ var starterId = original.start; var newTerms = newPhrase.terms(); //spruce-up the whitespace issues - addWhitespace$1(newTerms); //insert this segment into the linked-list + addWhitespace(newTerms); //insert this segment into the linked-list - stitchIn$1(original, newPhrase, newTerms); //increase the length of our phrases + stitchIn(original, newPhrase, newTerms); //increase the length of our phrases var toStretch = [original]; var docs = [doc]; @@ -1807,7 +1807,7 @@ toStretch = toStretch.concat(shouldChange); }); // don't double-count - toStretch = unique$1(toStretch); // stretch these phrases + toStretch = unique$4(toStretch); // stretch these phrases toStretch.forEach(function (p) { p.length += newPhrase.length; // change the start too, if necessary @@ -1888,7 +1888,7 @@ }; - var _delete = deletePhrase; + var _delete$1 = deletePhrase; /** put this text at the end */ @@ -1904,20 +1904,20 @@ return this; }; - var _delete$1 = function _delete$1(doc) { - _delete(this, doc); + var _delete = function _delete(doc) { + _delete$1(this, doc); return this; }; // stich-in newPhrase, stretch 'doc' + parents - var replace = function replace(newPhrase, doc) { + var replace$1 = function replace(newPhrase, doc) { //add it do the end var firstLength = this.length; append(this, newPhrase, doc); //delete original terms var tmp = this.buildFrom(this.start, this.length); tmp.length = firstLength; - _delete(tmp, doc); + _delete$1(tmp, doc); }; /** * Turn this phrase object into 3 phrase objects @@ -1964,13 +1964,13 @@ var _04Insert = { append: append_1, prepend: prepend_1, - "delete": _delete$1, - replace: replace, + "delete": _delete, + replace: replace$1, splitOn: splitOn }; /** return json metadata for this phrase */ - var json$1 = function json() { + var json = function json() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var world = arguments.length > 1 ? arguments[1] : undefined; var res = {}; // text data @@ -2027,8 +2027,8 @@ return res; }; - var _05Json$1 = { - json: json$1 + var _05Json = { + json: json }; /** match any terms after this phrase */ @@ -2112,10 +2112,10 @@ lookBehind: lookBehind }; - var methods$1 = Object.assign({}, _01Utils, _02Text, _03Change, _04Insert, _05Json$1, _06Lookahead); + var methods$7 = Object.assign({}, _01Utils$1, _02Text, _03Change, _04Insert, _05Json, _06Lookahead); // try to avoid doing the match - var failFast = function failFast(p, regs) { + var failFast$1 = function failFast(p, regs) { if (regs.length === 0) { return true; } @@ -2139,7 +2139,7 @@ return false; }; - var _02FailFast = failFast; + var _02FailFast = failFast$1; var _matchLogic = createCommonjsModule(function (module, exports) { //found a match? it's greedy? keep going! @@ -2564,7 +2564,7 @@ var _03TryMatch = tryHere; // final checks on the validity of our results - var postProcess = function postProcess(terms, regs, matches) { + var postProcess$1 = function postProcess(terms, regs, matches) { if (!matches || matches.length === 0) { return matches; } // ensure end reg has the end term @@ -2585,7 +2585,7 @@ return matches; }; - var _04PostProcess = postProcess; + var _04PostProcess = postProcess$1; /* break-down a match expression into this: { @@ -2907,7 +2907,7 @@ // } - var postProcess$1 = function postProcess(tokens) { + var postProcess = function postProcess(tokens) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // ensure all capture groups are filled between start and end // give all capture groups names @@ -2931,11 +2931,11 @@ return tokens; }; - var _02PostProcess = postProcess$1; + var _02PostProcess = postProcess; var hasReg = /[^[a-z]]\//g; - var isArray$1 = function isArray(arr) { + var isArray$2 = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; // don't split up a regular expression @@ -3069,7 +3069,7 @@ if (_typeof(input) === 'object') { - if (isArray$1(input)) { + if (isArray$2(input)) { if (input.length === 0 || !input[0]) { return []; } //is it a pre-parsed reg-list? @@ -3262,7 +3262,7 @@ return result; }; - var not = notMatch; + var not$1 = notMatch; /** return an array of matching phrases */ @@ -3293,10 +3293,10 @@ /** remove all matches from the result */ - var not$1 = function not$1(regs) { + var not = function not(regs) { var _this2 = this; - var matches = not(this, regs); //make them phrase objects + var matches = not$1(this, regs); //make them phrase objects matches = matches.map(function (list) { return _this2.buildFrom(list[0].id, list.length); @@ -3340,7 +3340,7 @@ var match = { match: match_1, has: has, - not: not$1, + not: not, canBe: canBe$1 }; @@ -3384,13 +3384,13 @@ Object.assign(Phrase.prototype, match); - Object.assign(Phrase.prototype, methods$1); //apply aliases + Object.assign(Phrase.prototype, methods$7); //apply aliases - var aliases = { + var aliases$1 = { term: 'terms' }; - Object.keys(aliases).forEach(function (k) { - return Phrase.prototype[k] = Phrase.prototype[aliases[k]]; + Object.keys(aliases$1).forEach(function (k) { + return Phrase.prototype[k] = Phrase.prototype[aliases$1[k]]; }); var Phrase_1 = Phrase; @@ -3701,7 +3701,7 @@ return arr; }; - var isArray$2 = function isArray(arr) { + var isArray$1 = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; //turn a string into an array of strings (naiive for now, lumped later) @@ -3716,7 +3716,7 @@ str = String(str); } - if (isArray$2(str)) { + if (isArray$1(str)) { return str; } @@ -3774,7 +3774,7 @@ var _02Words = splitWords; - var isArray$3 = function isArray(arr) { + var isArray = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; /** turn a string into an array of Phrase objects */ @@ -3789,7 +3789,7 @@ if (typeof text !== 'string') { if (typeof text === 'number') { text = String(text); - } else if (isArray$3(text)) { + } else if (isArray(text)) { sentences = text; } } //tokenize into words @@ -3860,10 +3860,10 @@ var fromJSON_1 = fromJSON; - var _version = '13.10.0'; + var _version = '13.10.1'; var entity = ['Person', 'Place', 'Organization']; - var nouns = { + var nouns$1 = { Noun: { notA: ['Verb', 'Adjective', 'Adverb'] }, @@ -3977,7 +3977,7 @@ } }; - var verbs = { + var verbs$1 = { Verb: { notA: ['Noun', 'Adjective', 'Adverb', 'Value'] }, @@ -3991,6 +3991,11 @@ isA: 'PresentTense', notA: ['PastTense', 'Gerund'] }, + //close the door! + Imperative: { + isA: 'Infinitive' // notA: ['PresentTense', 'PastTense', 'FutureTense', 'Gerund'], + + }, // walking Gerund: { isA: 'PresentTense', @@ -4078,7 +4083,7 @@ }; var anything = ['Noun', 'Verb', 'Adjective', 'Adverb', 'Value', 'QuestionWord']; - var misc = { + var misc$1 = { //--Adjectives-- Adjective: { notA: ['Noun', 'Verb', 'Adverb', 'Value'] @@ -4105,7 +4110,7 @@ // Dates: //not a noun, but usually is Date: { - notA: ['Verb', 'Conjunction', 'Adverb', 'Preposition', 'Adjective'] + notA: ['Verb', 'Adverb', 'Preposition', 'Adjective'] }, Month: { isA: ['Date', 'Singular'], @@ -4220,7 +4225,7 @@ var _color = addColors; - var unique$2 = function unique(arr) { + var unique$3 = function unique(arr) { return arr.filter(function (v, i, a) { return a.indexOf(v) === i; }); @@ -4241,14 +4246,14 @@ } // clean it up - tag.isA = unique$2(tag.isA); + tag.isA = unique$3(tag.isA); }); return tags; }; var _isA = inferIsA; - var unique$3 = function unique(arr) { + var unique$2 = function unique(arr) { return arr.filter(function (v, i, a) { return a.indexOf(v) === i; }); @@ -4278,7 +4283,7 @@ } // clean it up - tag.notA = unique$3(tag.notA); + tag.notA = unique$2(tag.notA); }); return tags; }; @@ -4349,10 +4354,10 @@ var build = function build() { var tags = {}; - addIn(nouns, tags); - addIn(verbs, tags); + addIn(nouns$1, tags); + addIn(verbs$1, tags); addIn(values, tags); - addIn(misc, tags); // do the graph-stuff + addIn(misc$1, tags); // do the graph-stuff tags = inference(tags); return tags; @@ -4382,7 +4387,7 @@ "Actor": "true¦aJbGcFdCengineIfAgardenIh9instructPjournalLlawyIm8nurse,opeOp5r3s1t0;echnCherapK;ailNcientJecretary,oldiGu0;pervKrgeon;e0oofE;ceptionGsearC;hotographClumbColi1r0sychologF;actitionBogrammB;cem6t5;echanic,inist9us4;airdress8ousekeep8;arm7ire0;fight6m2;eputy,iet0;ici0;an;arpent2lerk;ricklay1ut0;ch0;er;ccoun6d2ge7r0ssis6ttenda7;chitect,t0;ist;minist1v0;is1;rat0;or;ta0;nt", "Honorific": "true¦a01bYcQdPeOfiJgIhon,jr,king,lHmCoffic00p7queen,r3s0taoiseach,vice6;e1fc,gt,ir,r,u0;ltRpt,rg;cond liInBrgeaJ;abbi,e0;ar1p9s,v0;!erend; admirX;astOhd,r0vt;esideDi1of0;!essM;me mini4nce0;!ss;a3essrs,i2lle,me,r1s0;!tr;!s;stK;gistrate,j,r6yF;i3lb,t;en,ov;eld mar3rst l0;ady,i0;eutena0;nt;shG;sq,xcellency;et,oct6r,utchess;apt6hance4mdr,o0pl;lonel,m2ngress0unci3;m0wom0;an;dr,mand5;ll0;or;!ain;ldg,rig0;!adi0;er;d0sst,tty,yatullah;j,m0v;!ir0;al", "SportsTeam": "true¦0:1A;1:1H;2:1G;a1Eb16c0Td0Kfc dallas,g0Ihouston 0Hindiana0Gjacksonville jagua0k0El0Bm01newToQpJqueens parkIreal salt lake,sAt5utah jazz,vancouver whitecaps,w3yW;ashington 3est ham0Rh10;natio1Oredski2wizar0W;ampa bay 6e5o3;ronto 3ttenham hotspur;blue ja0Mrapto0;nnessee tita2xasC;buccanee0ra0K;a7eattle 5heffield0Kporting kansas0Wt3;. louis 3oke0V;c1Frams;marine0s3;eah15ounG;cramento Rn 3;antonio spu0diego 3francisco gJjose earthquak1;char08paA; ran07;a8h5ittsburgh 4ortland t3;imbe0rail blaze0;pirat1steele0;il3oenix su2;adelphia 3li1;eagl1philNunE;dr1;akland 3klahoma city thunder,rlando magic;athle0Mrai3;de0; 3castle01;england 7orleans 6york 3;city fc,g4je0FknXme0Fred bul0Yy3;anke1;ian0D;pelica2sain0C;patrio0Brevolut3;ion;anchester Be9i3ontreal impact;ami 7lwaukee b6nnesota 3;t4u0Fvi3;kings;imberwolv1wi2;rewe0uc0K;dolphi2heat,marli2;mphis grizz3ts;li1;cXu08;a4eicesterVos angeles 3;clippe0dodDla9; galaxy,ke0;ansas city 3nE;chiefs,roya0E; pace0polis colU;astr06dynamo,rockeTtexa2;olden state warrio0reen bay pac3;ke0;.c.Aallas 7e3i05od5;nver 5troit 3;lio2pisto2ti3;ge0;broncZnuggeM;cowbo4maver3;ic00;ys; uQ;arCelKh8incinnati 6leveland 5ol3;orado r3umbus crew sc;api5ocki1;brow2cavalie0india2;bengaWre3;ds;arlotte horAicago 3;b4cubs,fire,wh3;iteB;ea0ulR;diff3olina panthe0; c3;ity;altimore 9lackburn rove0oston 5rooklyn 3uffalo bilN;ne3;ts;cel4red3; sox;tics;rs;oriol1rave2;rizona Ast8tlanta 3;brav1falco2h4u3;nited;aw9;ns;es;on villa,r3;os;c5di3;amondbac3;ks;ardi3;na3;ls", - "Uncountable": "true¦0:1I;1:1X;2:16;a1Rb1Jc1Ad17e10f0Ug0Nh0Ii0Ej0Dknowled1Ql08mYnews,oXpTrOsDt8vi7w3;a5ea0Bi4oo3;d,l;ldlife,ne;rmth,t0;neg17ol0Ctae;e6h5oothpaste,r3una;affTou3;ble,sers,t;ermod1Mund0;a,nnis;aBcene0Aeri2hAil9kittl2now,o8p6t4u3;g10nshi0Q;ati1Le3;am,el;ace1Ee3;ci2ed;ap,cc0;k,v0;eep,ingl2;d0Dfe18l3nd;m11t;a6e4ic3;e,ke0M;c3laxa0Isearch;ogni0Hrea0H;bi2in;aPe5hys1last9o3ress04;l3rk,w0;it1yA;a12trZ;bstetr1il,xygen;aAe8ilk,o5u3;mps,s3;ic;n3o0I;ey,o3;gamy;a3chan1;sl2t;chine3il,themat1; learn0Bry;aught0e5i4ogi0Su3;ck,g0I;ce,ghtn08ngui0QteratN;a3isM;th0;ewelAusti0L;ce,mp3nformaUtself;a3ortan0J;ti3;en0H;a6isto5o3;ck3mework,n3spitali0B;ey;ry;ir,libut,ppiD;ene6o4r3um,ymna0D;aCound;l3ssip;d,f; 3t1;editQpo3;ol;i7lour,o4urnit3;ure;od,rgive3uri0wl;ne3;ss;c9sh;conom1duca8lectr7n5quip6th1very3;body,o3thH;ne;joy3tertain3;ment;iciPon1;tiI;ar4iabet2raugh4;es;ts;aAelcius,h6iv1l5o3urrency;al,ld w3nfusiDttD;ar;ass1oth5;aos,e3;e4w3;ing;se;r7sh;a7eef,i4lood,owls,read,utt0;er;lliar4s3;on;ds;g3ss;ga3;ge;c8dvi7ero5ir4mnes3rt,thlet1;ty;craft;b1d3naut1;ynam1;ce;id,ou3;st1;ics", + "Uncountable": "true¦0:1I;1:1X;2:16;a1Rb1Jc1Ad17e10f0Ug0Nh0Ii0Ej0Dknowled1Ql08mYnews,oXpTrOsDt8vi7w3;a5ea0Bi4oo3;d,l;ldlife,ne;rmth,t0;neg17ol0Ctae;e6h5oothpaste,r3una;affTou3;ble,sers,t;ermod1Mund0;a,nnis;aBcene0Aeri2hAil9kittl2now,o8p6t4u3;g10nshi0Q;ati1Le3;am,el;ace1Ee3;ci2ed;ap,cc0;k,v0;eep,ingl2;d0Dfe18l3nd,tish;m11t;a6e4ic3;e,ke0M;c3laxa0Isearch;ogni0Hrea0H;bi2in;aPe5hys1last9o3ress04;l3rk,w0;it1yA;a12trZ;bstetr1il,xygen;aAe8ilk,o5u3;mps,s3;ic;n3o0I;ey,o3;gamy;a3chan1;sl2t;chine3il,themat1; learn0Bry;aught0e5i4ogi0Su3;ck,g0I;ce,ghtn08ngui0QteratN;a3isM;th0;ewelAusti0L;ce,mp3nformaUtself;a3ortan0J;ti3;en0H;a6isto5o3;ck3mework,n3spitali0B;ey;ry;ir,libut,ppiD;ene6o4r3um,ymna0D;aCound;l3ssip;d,f; 3t1;editQpo3;ol;i7lour,o4urnit3;ure;od,rgive3uri0wl;ne3;ss;c9sh;conom1duca8lectr7n5quip6th1very3;body,o3thH;ne;joy3tertain3;ment;iciPon1;tiI;ar4iabet2raugh4;es;ts;aAelcius,h6iv1l5o3urrency;al,ld w3nfusiDttD;ar;ass1oth5;aos,e3;e4w3;ing;se;r7sh;a7eef,i4lood,owls,read,utt0;er;lliar4s3;on;ds;g3ss;ga3;ge;c8dvi7ero5ir4mnes3rt,thlet1;ty;craft;b1d3naut1;ynam1;ce;id,ou3;st1;ics", "Infinitive": "true¦0:6S;1:76;2:5C;3:74;4:73;5:67;6:6F;7:6Y;8:6Q;9:72;A:70;B:6X;C:5X;D:77;E:6L;F:5B;a6Kb66c57d4De3Xf3Jg3Dh37i2Uj2Sk2Ql2Hm26n23o1Yp1Jr0Rs06tYuTvOwHyG;awn,ield;aJe1Zhist6iIoGre6D;nd0rG;k,ry;pe,sh,th0;lk,nHrGsh,tEve;n,raD;d0t;aJiHoG;te,w;eGsB;!w;l6Jry;nHpGr4se;gra4Pli41;dGi9lo5Zpub3Q;erGo;mi5Cw1I;aMeLhKig5SoJrHuGwi7;ne,rn;aGe0Mi5Uu7y;de,in,nsf0p,v5J;r2ZuE;ank,reatC;nd,st;lk,rg1Qs9;aZcWeVhTi4Dkip,lSmRnee3Lo52pQtJuGwitE;bmBck,ff0gge7ppHrGspe5;ge,pri1rou4Zvi3;ly,o36;aLeKoJrHuG;dy,mb6;aFeGi3;ngthCss,tE;p,re;m,p;in,ke,r0Qy;la58oil,rink6;e1Zi6o3J;am,ip;a2iv0oG;ck,rtCut;arEem,le5n1r3tt6;aHo2rG;atEew;le,re;il,ve;a05eIisk,oHuG;in,le,sh;am,ll;a01cZdu8fYgXje5lUmTnt,pQquPsKtJvGwa5V;eGiew,o36;al,l,rG;se,t;aFi2u44;eJi7oItG;!o2rG;i5uc20;l3rt;mb6nt,r3;e7i2;air,eHlGo43r0K;a8y;at;aFemb0i3Zo3;aHeGi3y;a1nt;te,x;a5Dr0J;act1Yer,le5u1;a13ei3k5PoGyc6;gni2Cnci6rd;ch,li2Bs5N;i1nG;ge,k;aTerSiRlOoMrIuG;b21ll,mp,rGsh;cha1s4Q;ai1eIiDoG;cGdu8greAhibBmi1te7vi2W;eAlaim;di5pa2ss,veD;iDp,rtr46sGur;e,t;aHead,uG;g,n4;n,y;ck,le;fo34mBsi7;ck,iDrt4Mss,u1;bJccur,ff0pera9utweIverGwe;co47lap,ta22u1wG;helm;igh;ser3taF;eHotG;e,i8;ed,gle5;aMeLiIoHuG;ltip3Grd0;nit13ve;nHrr12sreprG;eseD;d,g6us;asu2lt,n0Nr4;intaFna4rHtG;ch,t0;ch,kGry;et;aMeLiJoGu1C;aHck,oGve;k,sC;d,n;ft,g35ke,mBnk,st2YveG;!n;a2Fc0Et;b0Nck,uG;gh,nE;iGno34;ck,ll,ss;am,oFuG;d4mp;gno2mQnGss3H;cOdica9flu0MhNsKtIvG;eGol3;nt,st;erGrodu8;a5fe2;i7tG;aGru5;ll;abBibB;lu1Fr1D;agi24pG;lemeDo22ro3;aKeIi2oHuG;nt,rry;n02pe,st;aGlp;d,t;nd6ppCrm,te;aKloAove1PrIuG;arGeAi15;ant39d;aGip,ow,umb6;b,sp;in,th0ze;aReaQiOlMoJrHuncG;ti3J;acGeshC;tu2;cus,lHrG;ce,eca7m,s30;d,l24;a1ZoG;at,od,w;gu2lGni1Xt,x;e,l;r,tu2;il,stCvG;or;a15cho,le5mSnPstNvalua9xG;a0AcLerKi7pGte19;a18eHi2laFoGreA;rt,se;ct,riG;en8;ci1t;el,han4;abGima9;li1J;ab6couXdHfor8ga4han8j03riEsu2t0vG;isi2Vy;!u2;body,er4pG;hasiGow0;ze;a07eUiLoKrHuG;mp;aHeAiG;ft;g,in;d4ubt;ff0p,re5sHvG;iZor8;aKcHliGmiApl1Btingui14;ke;oGuA;uGv0;ra4;gr1YppG;ear,ro3;cOeNfLliv0ma0Fny,pKsHterG;mi0G;cribe,er3iHtrG;oy;gn,re;a0Be0Ai5osB;eGi0By;at,ct;m,pC;iIlHrG;ea1;a2i06;de;ma4n8rGte;e,kC;a0Ae09h06i9l04oJrG;aHeGoAu0Hy;a9dB;ck,ve;llZmSnHok,py,uGv0;gh,nt;cePdu5fMsKtIvG;eGin8;rt,y;aFin0VrG;a7ibu9ol;iGtitu9;d0st;iHoGroD;rm;gu2rm;rn;biLfoKmaJpG;a2laF;in;re;nd;rt;ne;ap1e5;aGip,o1;im,w;aHeG;at,ck,w;llen4n4r4se;a1nt0;ll,ncIrGt0u1;eGry;!en;el;aSePloOoMrIuG;lGry;ly;igHuG;sh;htC;en;a7mb,o7rrGth0un8;ow;ck;ar,lHnefBtrG;ay;ie3ong;ng,se;band0Jc0Bd06ffo05gr04id,l01mu1nYppTrQsKttGvoid,waB;acIeHra5;ct;m0Fnd;h,k;k,sG;eIiHocia9uG;me;gn,st;mb6rt;le;chHgGri3;ue;!i3;eaJlIroG;aEve;ch;aud,y;l,r;noun8sw0tG;icipa9;ce;lHt0;er;e4ow;ee;rd;aRdIju7mBoR;it;st;!reA;ss;cJhie3knowled4tiva9;te;ge;ve;eIouDu1;se;nt;pt;on", "Unit": "true¦0:19;a14b12c0Od0Ne0Lf0Gg0Ch09in0Hjoule0k02l00mNnMoLpIqHsqCt7volts,w6y4z3°2µ1;g,s;c,f,n;b,e2;a0Nb,d0Dears old,o1;tt0H;att0b;able4b3d,e2on1sp;!ne0;a2r0D;!l,sp;spo04; ft,uare 1;c0Id0Hf3i0Fkilo0Jm1ya0E;e0Mil1;e0li0H;eet0o0D;t,uart0;ascals,e2i1ou0Pt;c0Mnt0;rcent,t02;hms,uYz;an0JewtT;/s,b,e9g,i3l,m2p1²,³;h,s;!²;!/h,cro5l1;e1li08;! pFs1²;! 1;anEpD;g06s0B;gQter1;! 2s1;! 1;per second;b,i00m,u1x;men0x0;b,elvin0g,ilo2m1nR;!/h,ph,²;byZgXmeter1;! p2s1;! p1;er1; hour;e1g,r0z;ct1rtz0;aXogQ;al2b,igAra1;in0m0;!l1;on0;a4emtPl2t1;²,³; oz,uid ou1;nce0;hrenheit0rad0;b,x1;abyH;eciCg,l,mA;arat0eAg,m9oulomb0u1;bic 1p0;c5d4fo3i2meAya1;rd0;nch0;ot0;eci2;enti1;me4;!²,³;lsius0nti1;g2li1me1;ter0;ram0;bl,y1;te0;c4tt1;os1;eco1;nd0;re0;!s", "Organization": "true¦0:46;a3Ab2Qc2Ad21e1Xf1Tg1Lh1Gi1Dj19k17l13m0Sn0Go0Dp07qu06rZsStFuBv8w3y1;amaha,m0Xou1w0X;gov,tu2S;a3e1orld trade organizati41;lls fargo,st1;fie22inghou16;l1rner br3D;-m11gree31l street journ25m11;an halNeriz3Wisa,o1;dafo2Gl1;kswagLvo;bs,kip,n2ps,s1;a tod2Rps;es35i1;lev2Xted natio2Uv; mobi2Kaco bePd bMeAgi frida9h3im horto2Tmz,o1witt2W;shiba,y1;ota,s r Y;e 1in lizzy;b3carpen33daily ma2Xguess w2holli0rolling st1Ms1w2;mashing pumpki2Ouprem0;ho;ea1lack eyed pe3Fyrds;ch bo1tl0;ys;l2s1;co,la m12;efoni07us;a6e4ieme2Gnp,o2pice gir5ta1ubaru;rbucks,to2N;ny,undgard1;en;a2Rx pisto1;ls;few25insbu26msu1X;.e.m.,adiohead,b6e3oyal 1yan2X;b1dutch she4;ank;/max,aders dige1Ed 1vl32;bu1c1Uhot chili peppe2Klobst28;ll;c,s;ant2Vizno2F;an5bs,e3fiz24hilip morrBi2r1;emier27octer & gamb1Rudenti14;nk floyd,zza hut;psi28tro1uge08;br2Qchina,n2Q; 2ason1Xda2G;ld navy,pec,range juli2xf1;am;us;a9b8e5fl,h4i3o1sa,wa;kia,tre dame,vart1;is;ke,ntendo,ss0K;l,s;c,st1Etflix,w1; 1sweek;kids on the block,york08;a,c;nd1Us2t1;ional aca2Fo,we0Q;a,cYd0O;aAcdonald9e5i3lb,o1tv,yspace;b1Nnsanto,ody blu0t1;ley crue,or0O;crosoft,t1;as,subisO;dica3rcedes2talli1;ca;!-benz;id,re;'s,s;c's milk,tt13z1Y;'ore09a3e1g,ittle caesa1Ktd;novo,x1;is,mark; pres5-z-boy,bour party;atv,fc,kk,m1od1K;art;iffy lu0Lo3pmorgan1sa;! cha1;se;hnson & johns1Sy d1R;bm,hop,n1tv;c,g,te1;l,rpol; & m,asbro,ewlett-packaTi3o1sbc,yundai;me dep1n1J;ot;tac1zbollah;hi;eneral 6hq,l5mb,o2reen d0Iu1;cci,ns n ros0;ldman sachs,o1;dye1g0B;ar;axo smith kliZencore;electr0Im1;oto0V;a3bi,da,edex,i1leetwood mac,oGrito-l0A;at,nancial1restoV; tim0;cebook,nnie mae;b06sa,u3xxon1; m1m1;ob0H;!rosceptics;aiml0Ae5isney,o3u1;nkin donuts,po0Wran dur1;an;j,w j1;on0;a,f leppa3ll,p2r spiegZstiny's chi1;ld;eche mode,t;rd;aEbc,hBi9nn,o3r1;aigsli5eedence clearwater reviv1ossra05;al;!ca c5l4m1o0Ast05;ca2p1;aq;st;dplMgate;ola;a,sco1tigroup;! systems;ev2i1;ck fil-a,na daily;r0Hy;dbury,pital o1rl's jr;ne;aGbc,eCfAl6mw,ni,o2p,r1;exiteeWos;ei3mbardiJston 1;glo1pizza;be;ng;ack & deckFo2ue c1;roX;ckbuster video,omingda1;le; g1g1;oodriN;cht3e ge0n & jer2rkshire hathaw1;ay;ryH;el;nana republ3s1xt5y5;f,kin robbi1;ns;ic;bXcSdidRerosmith,ig,lLmFnheuser-busEol,ppleAr7s3t&t,v2y1;er;is,on;hland2s1;n,ociated F; o1;il;by4g2m1;co;os; compu2bee1;'s;te1;rs;ch;c,d,erican3t1;!r1;ak; ex1;pre1;ss; 4catel2t1;air;!-luce1;nt;jazeera,qae1;da;as;/dc,a3er,t1;ivisi1;on;demy of scienc0;es;ba,c", @@ -4413,7 +4418,7 @@ }; var seq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", - cache = seq.split("").reduce(function (n, o, e) { + cache$1 = seq.split("").reduce(function (n, o, e) { return n[o] = e, n; }, {}), toAlphaCode = function toAlphaCode(n) { @@ -4434,7 +4439,7 @@ return t; }, fromAlphaCode = function fromAlphaCode(n) { - if (void 0 !== cache[n]) return cache[n]; + if (void 0 !== cache$1[n]) return cache$1[n]; var o = 0, e = 1, t = 36, @@ -4511,15 +4516,15 @@ return n.match(":") && symbols(o), toArray(o); }; - var unpack_1 = unpack, - unpack_1$1 = function unpack_1$1(n) { + var unpack_1$1 = unpack, + unpack_1$1$1 = function unpack_1$1$1(n) { var o = n.split("|").reduce(function (n, o) { var e = o.split("¦"); return n[e[0]] = e[1], n; }, {}), e = {}; return Object.keys(o).forEach(function (n) { - var t = unpack_1(o[n]); + var t = unpack_1$1(o[n]); "true" === n && (n = !0); for (var _o2 = 0; _o2 < t.length; _o2++) { @@ -4529,10 +4534,10 @@ }), e; }; - var efrtUnpack_min = unpack_1$1; + var efrtUnpack_min = unpack_1$1$1; //words that can't be compressed, for whatever reason - var misc$1 = { + var misc = { // numbers '20th century fox': 'Organization', // '3m': 'Organization', @@ -4661,7 +4666,7 @@ var buildOut = function buildOut(world) { //our bag of words - var lexicon = Object.assign({}, misc$1); // start adding words to the lex + var lexicon = Object.assign({}, misc); // start adding words to the lex Object.keys(_data).forEach(function (tag) { var wordsObj = efrtUnpack_min(_data[tag]); // this part sucks @@ -4675,7 +4680,7 @@ return lexicon; }; - var unpack_1$2 = { + var unpack_1 = { buildOut: buildOut, addWords: addWords }; @@ -4804,7 +4809,7 @@ // used in verbs().conjugate() // but also added to our lexicon //use shorter key-names - var mapping = { + var mapping$1 = { g: 'Gerund', prt: 'Participle', perf: 'PerfectTense', @@ -5510,7 +5515,7 @@ var str = conjugations[inf][key]; //swap-in infinitives for '_' str = str.replace('_', inf); - var full = mapping[key]; + var full = mapping$1[key]; _final[full] = str; }); //over-write original @@ -5523,7 +5528,7 @@ var conjugations_1 = conjugations; - var endsWith = { + var endsWith$1 = { b: [{ reg: /([^aeiou][aeiou])b$/i, repl: { @@ -5780,7 +5785,7 @@ } }] }; - var suffixes = endsWith; + var suffixes$1 = endsWith$1; var posMap = { pr: 'PresentTense', @@ -5807,12 +5812,12 @@ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var c = str[str.length - 1]; - if (suffixes.hasOwnProperty(c) === true) { - for (var r = 0; r < suffixes[c].length; r += 1) { - var reg = suffixes[c][r].reg; + if (suffixes$1.hasOwnProperty(c) === true) { + for (var r = 0; r < suffixes$1[c].length; r += 1) { + var reg = suffixes$1[c][r].reg; if (reg.test(str) === true) { - return doTransform(str, suffixes[c][r]); + return doTransform(str, suffixes$1[c][r]); } } } @@ -5863,7 +5868,7 @@ //we assume the input word is a proper infinitive - var conjugate = function conjugate() { + var conjugate$2 = function conjugate() { var inf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var world = arguments.length > 1 ? arguments[1] : undefined; var found = {}; // 1. look at irregulars @@ -5896,12 +5901,12 @@ return found; }; - var conjugate_1 = conjugate; // console.log(conjugate('bake')) + var conjugate_1$1 = conjugate$2; // console.log(conjugate('bake')) //turn 'quick' into 'quickest' - var do_rules = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /oud$/, /...p$/]; - var dont_rules = [/ary$/]; - var irregulars = { + var do_rules$1 = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /oud$/, /...p$/]; + var dont_rules$1 = [/ary$/]; + var irregulars$5 = { nice: 'nicest', late: 'latest', hard: 'hardest', @@ -5914,7 +5919,7 @@ big: 'biggest', large: 'largest' }; - var transforms = [{ + var transforms$2 = [{ reg: /y$/i, repl: 'iest' }, { @@ -5933,27 +5938,27 @@ var to_superlative = function to_superlative(str) { //irregulars - if (irregulars.hasOwnProperty(str)) { - return irregulars[str]; + if (irregulars$5.hasOwnProperty(str)) { + return irregulars$5[str]; } //known transforms - for (var i = 0; i < transforms.length; i++) { - if (transforms[i].reg.test(str)) { - return str.replace(transforms[i].reg, transforms[i].repl); + for (var i = 0; i < transforms$2.length; i++) { + if (transforms$2[i].reg.test(str)) { + return str.replace(transforms$2[i].reg, transforms$2[i].repl); } } //dont-rules - for (var _i = 0; _i < dont_rules.length; _i++) { - if (dont_rules[_i].test(str) === true) { + for (var _i = 0; _i < dont_rules$1.length; _i++) { + if (dont_rules$1[_i].test(str) === true) { return null; } } //do-rules - for (var _i2 = 0; _i2 < do_rules.length; _i2++) { - if (do_rules[_i2].test(str) === true) { + for (var _i2 = 0; _i2 < do_rules$1.length; _i2++) { + if (do_rules$1[_i2].test(str) === true) { if (str.charAt(str.length - 1) === 'e') { return str + 'st'; } @@ -5968,9 +5973,9 @@ var toSuperlative = to_superlative; //turn 'quick' into 'quickly' - var do_rules$1 = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /old$/, /oud$/, /e[ae]p$/]; - var dont_rules$1 = [/ary$/, /ous$/]; - var irregulars$1 = { + var do_rules = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /old$/, /oud$/, /e[ae]p$/]; + var dont_rules = [/ary$/, /ous$/]; + var irregulars$4 = { grey: 'greyer', gray: 'grayer', green: 'greener', @@ -5998,8 +6003,8 @@ var to_comparative = function to_comparative(str) { //known-irregulars - if (irregulars$1.hasOwnProperty(str)) { - return irregulars$1[str]; + if (irregulars$4.hasOwnProperty(str)) { + return irregulars$4[str]; } //known-transforms @@ -6010,15 +6015,15 @@ } //dont-patterns - for (var _i = 0; _i < dont_rules$1.length; _i++) { - if (dont_rules$1[_i].test(str) === true) { + for (var _i = 0; _i < dont_rules.length; _i++) { + if (dont_rules[_i].test(str) === true) { return null; } } //do-patterns - for (var _i2 = 0; _i2 < do_rules$1.length; _i2++) { - if (do_rules$1[_i2].test(str) === true) { + for (var _i2 = 0; _i2 < do_rules.length; _i2++) { + if (do_rules[_i2].test(str) === true) { return str + 'er'; } } //easy-one @@ -6033,7 +6038,7 @@ var toComparative = to_comparative; - var fns$1 = { + var fns = { toSuperlative: toSuperlative, toComparative: toComparative }; @@ -6042,14 +6047,14 @@ var conjugate$1 = function conjugate(w) { var res = {}; // 'greatest' - var sup = fns$1.toSuperlative(w); + var sup = fns.toSuperlative(w); if (sup) { res.Superlative = sup; } // 'greater' - var comp = fns$1.toComparative(w); + var comp = fns.toComparative(w); if (comp) { res.Comparative = comp; @@ -6058,10 +6063,10 @@ return res; }; - var adjectives = conjugate$1; + var adjectives$2 = conjugate$1; /** patterns for turning 'bus' to 'buses'*/ - var suffixes$1 = { + var suffixes = { a: [[/(antenn|formul|nebul|vertebr|vit)a$/i, '$1ae'], [/([ti])a$/i, '$1a']], e: [[/(kn|l|w)ife$/i, '$1ives'], [/(hive)$/i, '$1s'], [/([m|l])ouse$/i, '$1ice'], [/([m|l])ice$/i, '$1ice']], f: [[/^(dwar|handkerchie|hoo|scar|whar)f$/i, '$1ves'], [/^((?:ca|e|ha|(?:our|them|your)?se|she|wo)l|lea|loa|shea|thie)f$/i, '$1ves']], @@ -6074,19 +6079,19 @@ y: [[/([^aeiouy]|qu)y$/i, '$1ies']], z: [[/(quiz)$/i, '$1zes']] }; - var _rules = suffixes$1; + var _rules$2 = suffixes; var addE = /(x|ch|sh|s|z)$/; var trySuffix = function trySuffix(str) { var c = str[str.length - 1]; - if (_rules.hasOwnProperty(c) === true) { - for (var i = 0; i < _rules[c].length; i += 1) { - var reg = _rules[c][i][0]; + if (_rules$2.hasOwnProperty(c) === true) { + for (var i = 0; i < _rules$2[c].length; i += 1) { + var reg = _rules$2[c][i][0]; if (reg.test(str) === true) { - return str.replace(reg, _rules[c][i][1]); + return str.replace(reg, _rules$2[c][i][1]); } } } @@ -6398,7 +6403,7 @@ return null; }; - var toInfinitive = function toInfinitive(str, world, tense) { + var toInfinitive$1 = function toInfinitive(str, world, tense) { if (!str) { return ''; } //1. look at known irregulars @@ -6436,19 +6441,19 @@ return str; }; - var toInfinitive_1 = toInfinitive; + var toInfinitive_1$1 = toInfinitive$1; - var irregulars$2 = { + var irregulars$3 = { nouns: plurals, verbs: conjugations_1 }; //these behaviours are configurable & shared across some plugins - var transforms$2 = { - conjugate: conjugate_1, - adjectives: adjectives, + var transforms = { + conjugate: conjugate_1$1, + adjectives: adjectives$2, toPlural: toPlural, toSingular: toSingular_1, - toInfinitive: toInfinitive_1 + toInfinitive: toInfinitive_1$1 }; var _isVerbose = false; /** all configurable linguistic data */ @@ -6470,7 +6475,7 @@ }); Object.defineProperty(this, 'irregulars', { enumerable: false, - value: irregulars$2, + value: irregulars$3, writable: true }); Object.defineProperty(this, 'tags', { @@ -6480,7 +6485,7 @@ }); Object.defineProperty(this, 'transforms', { enumerable: false, - value: transforms$2, + value: transforms, writable: true }); Object.defineProperty(this, 'taggers', { @@ -6496,7 +6501,7 @@ } }); // add our compressed data to lexicon - this.words = unpack_1$2.buildOut(this); // add our irregulars to lexicon + this.words = unpack_1.buildOut(this); // add our irregulars to lexicon addIrregulars_1(this); } @@ -6526,7 +6531,7 @@ w = w.toLowerCase().trim(); cleaned[w] = tag; }); - unpack_1$2.addWords(cleaned, this.words, this); + unpack_1.addWords(cleaned, this.words, this); } /** add new custom conjugations */ @@ -6582,7 +6587,7 @@ }(); // ¯\_(:/)_/¯ - var clone$1 = function clone(obj) { + var clone = function clone(obj) { return JSON.parse(JSON.stringify(obj)); }; /** produce a deep-copy of all lingustic data */ @@ -6594,8 +6599,8 @@ w2.words = Object.assign({}, this.words); w2.hasCompound = Object.assign({}, this.hasCompound); //these ones are nested: - w2.irregulars = clone$1(this.irregulars); - w2.tags = clone$1(this.tags); // these are functions + w2.irregulars = clone(this.irregulars); + w2.tags = clone(this.tags); // these are functions w2.transforms = this.transforms; w2.taggers = this.taggers; @@ -6606,7 +6611,7 @@ /** return the root, first document */ - var _01Utils$1 = createCommonjsModule(function (module, exports) { + var _01Utils = createCommonjsModule(function (module, exports) { exports.all = function () { return this.parents()[0] || this; }; @@ -6845,7 +6850,7 @@ }); // cache the easier conditions up-front - var cacheRequired = function cacheRequired(reg) { + var cacheRequired$1 = function cacheRequired(reg) { var needTags = []; var needWords = []; reg.forEach(function (obj) { @@ -6868,9 +6873,9 @@ }; // try to pre-fail as many matches as possible, without doing them - var failFast$1 = function failFast(doc, regs) { + var failFast = function failFast(doc, regs) { if (doc._cache && doc._cache.set === true) { - var _cacheRequired = cacheRequired(regs), + var _cacheRequired = cacheRequired$1(regs), words = _cacheRequired.words, tags = _cacheRequired.tags; //check required words @@ -6892,7 +6897,7 @@ return true; }; - var _failFast = failFast$1; + var _failFast = failFast; var _03Match = createCommonjsModule(function (module, exports) { /** return a new Doc, with this one as a parent */ @@ -7167,7 +7172,7 @@ /** Give all terms the given tag */ - var tag$1 = function tag(tags, why) { + var tag = function tag(tags, why) { if (!tags) { return this; } @@ -7178,7 +7183,7 @@ /** Only apply tag to terms if it is consistent with current tags */ - var tagSafe$1 = function tagSafe(tags, why) { + var tagSafe = function tagSafe(tags, why) { if (!tags) { return this; } @@ -7189,7 +7194,7 @@ /** Remove this term from the given terms */ - var unTag$1 = function unTag(tags, why) { + var unTag = function unTag(tags, why) { var _this = this; this.list.forEach(function (p) { @@ -7202,7 +7207,7 @@ /** return only the terms that can be this tag*/ - var canBe$2 = function canBe(tag) { + var canBe = function canBe(tag) { if (!tag) { return this; } @@ -7215,10 +7220,10 @@ }; var _04Tag = { - tag: tag$1, - tagSafe: tagSafe$1, - unTag: unTag$1, - canBe: canBe$2 + tag: tag, + tagSafe: tagSafe, + unTag: unTag, + canBe: canBe }; /* run each phrase through a function, and create a new document */ @@ -7550,7 +7555,7 @@ }); /** freeze the current state of the document, for speed-purposes*/ - var cache$1 = function cache(options) { + var cache = function cache(options) { var _this = this; options = options || {}; @@ -7603,11 +7608,11 @@ }; var _07Cache = { - cache: cache$1, + cache: cache, uncache: uncache }; - var titleCase$3 = function titleCase(str) { + var titleCase$1 = function titleCase(str) { return str.charAt(0).toUpperCase() + str.substr(1); }; /** substitute-in new content */ @@ -7655,7 +7660,7 @@ } else if (typeof input === 'string') { //input is a string if (options.keepCase !== false && p.terms(0).isTitleCase()) { - input = titleCase$3(input); + input = titleCase$1(input); } newPhrases = _01Tokenizer(input, _this.world, _this.pool()); //tag the new phrases @@ -7689,7 +7694,7 @@ /** search and replace match with new content */ - var replace$1 = function replace(match, _replace, options) { + var replace = function replace(match, _replace, options) { // if there's no 2nd param, use replaceWith if (_replace === undefined) { return this.replaceWith(match, options); @@ -7701,7 +7706,7 @@ var _01Replace = { replaceWith: replaceWith, - replace: replace$1 + replace: replace }; var _02Insert = createCommonjsModule(function (module, exports) { @@ -7852,7 +7857,7 @@ }; /** return the document as text */ - var text$1 = function text(options) { + var text = function text(options) { var _this = this; options = options || {}; //are we showing every phrase? @@ -7888,7 +7893,7 @@ }; var _01Text = { - text: text$1 + text: text }; // get all character startings in doc @@ -8296,7 +8301,7 @@ out: out }; - var methods$2 = { + var methods$6 = { /** alphabetical order */ alpha: function alpha(a, b) { var left = a.text('clean'); @@ -8401,8 +8406,8 @@ }; //aliases - methods$2.alphabetical = methods$2.alpha; - methods$2.wordcount = methods$2.wordCount; // aliases for sequential ordering + methods$6.alphabetical = methods$6.alpha; + methods$6.wordcount = methods$6.wordCount; // aliases for sequential ordering var seqNames = { index: true, @@ -8425,7 +8430,7 @@ return sortSequential(this); } - input = methods$2[input] || input; // apply sort method on each phrase + input = methods$6[input] || input; // apply sort method on each phrase if (typeof input === 'function') { this.list = this.list.sort(input); @@ -8445,7 +8450,7 @@ /** remove any duplicate matches */ - var unique$4 = function unique() { + var unique$1 = function unique() { var list = [].concat(this.list); var obj = {}; list = list.filter(function (p) { @@ -8464,12 +8469,12 @@ var _01Sort = { sort: sort, reverse: reverse, - unique: unique$4 + unique: unique$1 }; var isPunct = /[\[\]{}⟨⟩:,،、‒–—―…‹›«»‐\-;\/⁄·*\•^†‡°¡¿※№÷׺ª%‰=‱¶§~|‖¦©℗®℠™¤₳฿]/g; var quotes = /['‘’“”"′″‴]+/g; - var methods$3 = { + var methods$5 = { // cleanup newlines and extra spaces whitespace: function whitespace(doc) { var termArr = doc.list.map(function (ts) { @@ -8559,7 +8564,7 @@ }); } }; - var _methods = methods$3; + var _methods = methods$5; var defaults = { // light @@ -8582,7 +8587,7 @@ honorifics: false // pronouns: true, }; - var mapping$1 = { + var mapping = { light: {}, medium: { "case": true, @@ -8592,7 +8597,7 @@ adverbs: true } }; - mapping$1.heavy = Object.assign({}, mapping$1.medium, { + mapping.heavy = Object.assign({}, mapping.medium, { possessives: true, verbs: true, nouns: true, @@ -8604,7 +8609,7 @@ options = options || {}; // support named forms if (typeof options === 'string') { - options = mapping$1[options] || {}; + options = mapping[options] || {}; } // set defaults @@ -9174,13 +9179,13 @@ contract: contract }; - var methods$4 = Object.assign({}, _01Utils$1, _02Accessors, _03Match, _04Tag, _05Loops, _06Lookup, _07Cache, _01Replace, _02Insert, _01Text, _02Json, _03Out, _01Sort, _02Normalize, _03Split, _04Case, _05Whitespace, _06Join, _07Contract); + var methods$4 = Object.assign({}, _01Utils, _02Accessors, _03Match, _04Tag, _05Loops, _06Lookup, _07Cache, _01Replace, _02Insert, _01Text, _02Json, _03Out, _01Sort, _02Normalize, _03Split, _04Case, _05Whitespace, _06Join, _07Contract); - var methods$5 = {}; // allow helper methods like .adjectives() and .adverbs() + var methods$3 = {}; // allow helper methods like .adjectives() and .adverbs() var arr = [['terms', '.'], ['hyphenated', '@hasHyphen .'], ['adjectives', '#Adjective'], ['hashTags', '#HashTag'], ['emails', '#Email'], ['emoji', '#Emoji'], ['emoticons', '#Emoticon'], ['atMentions', '#AtMention'], ['urls', '#Url'], ['adverbs', '#Adverb'], ['pronouns', '#Pronoun'], ['conjunctions', '#Conjunction'], ['prepositions', '#Preposition']]; arr.forEach(function (a) { - methods$5[a[0]] = function (n) { + methods$3[a[0]] = function (n) { var m = this.match(a[1]); if (typeof n === 'number') { @@ -9191,12 +9196,12 @@ }; }); // aliases - methods$5.emojis = methods$5.emoji; - methods$5.atmentions = methods$5.atMentions; - methods$5.words = methods$5.terms; + methods$3.emojis = methods$3.emoji; + methods$3.atmentions = methods$3.atMentions; + methods$3.words = methods$3.terms; /** return anything tagged as a phone number */ - methods$5.phoneNumbers = function (n) { + methods$3.phoneNumbers = function (n) { var m = this.splitAfter('@hasComma'); m = m.match('#PhoneNumber+'); @@ -9209,7 +9214,7 @@ /** Deprecated: please use compromise-numbers plugin */ - methods$5.money = function (n) { + methods$3.money = function (n) { var m = this.match('#Money #Currency?'); if (typeof n === 'number') { @@ -9221,7 +9226,7 @@ /** return all cities, countries, addresses, and regions */ - methods$5.places = function (n) { + methods$3.places = function (n) { // don't split 'paris, france' var keep = this.match('(#City && @hasComma) (#Region|#Country)'); // but split the other commas @@ -9240,7 +9245,7 @@ /** return all schools, businesses and institutions */ - methods$5.organizations = function (n) { + methods$3.organizations = function (n) { var m = this.clauses(); m = m.match('#Organization+'); @@ -9252,7 +9257,7 @@ }; //combine them with .topics() method - methods$5.entities = function (n) { + methods$3.entities = function (n) { var r = this.clauses(); // Find people, places, and organizations var yup = r.people(); @@ -9271,9 +9276,9 @@ }; //aliases - methods$5.things = methods$5.entities; - methods$5.topics = methods$5.entities; - var _simple = methods$5; + methods$3.things = methods$3.entities; + methods$3.topics = methods$3.entities; + var _simple = methods$3; var underOver = /^(under|over)-?/; /** match a word-sequence, like 'super bowl' in the lexicon */ @@ -9410,7 +9415,7 @@ }; - var _02Punctuation$1 = checkPunctuation; + var _02Punctuation = checkPunctuation; //these are regexes applied to t.text, instead of t.clean // order matters. @@ -9473,7 +9478,7 @@ var romanNumValid = /^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/; // https://stackoverflow.com/a/267405/168877 //try each of the ^regexes in our list - var checkRegex = function checkRegex(term, world) { + var checkRegex$1 = function checkRegex(term, world) { var str = term.text; // do them all! for (var r = 0; r < startsWith.length; r += 1) { @@ -9490,99 +9495,99 @@ } }; - var _03Prefixes = checkRegex; + var _03Prefixes = checkRegex$1; //regex suffix patterns and their most common parts of speech, //built using wordnet, by spencer kelly. //this mapping shrinks-down the uglified build - var Adj = 'Adjective'; - var Inf = 'Infinitive'; - var Pres = 'PresentTense'; - var Sing = 'Singular'; - var Past = 'PastTense'; + var Adj$1 = 'Adjective'; + var Inf$1 = 'Infinitive'; + var Pres$1 = 'PresentTense'; + var Sing$1 = 'Singular'; + var Past$1 = 'PastTense'; var Adverb = 'Adverb'; var Exp = 'Expression'; - var Actor = 'Actor'; + var Actor$1 = 'Actor'; var Verb = 'Verb'; - var Noun = 'Noun'; - var Last = 'LastName'; //the order here matters. + var Noun$1 = 'Noun'; + var Last$1 = 'LastName'; //the order here matters. //regexes indexed by mandated last-character - var endsWith$1 = { - a: [[/.[aeiou]na$/, Noun], [/.[oau][wvl]ska$/, Last], //polish (female) - [/.[^aeiou]ica$/, Sing], [/^([hyj]a)+$/, Exp] //hahah + var endsWith = { + a: [[/.[aeiou]na$/, Noun$1], [/.[oau][wvl]ska$/, Last$1], //polish (female) + [/.[^aeiou]ica$/, Sing$1], [/^([hyj]a)+$/, Exp] //hahah ], - c: [[/.[^aeiou]ic$/, Adj]], + c: [[/.[^aeiou]ic$/, Adj$1]], d: [//==-ed== //double-consonant - [/[aeiou](pp|ll|ss|ff|gg|tt|rr|bb|nn|mm)ed$/, Past], //popped, planned + [/[aeiou](pp|ll|ss|ff|gg|tt|rr|bb|nn|mm)ed$/, Past$1], //popped, planned //double-vowel - [/.[aeo]{2}[bdgmnprvz]ed$/, Past], //beeped, mooned, veered + [/.[aeo]{2}[bdgmnprvz]ed$/, Past$1], //beeped, mooned, veered //-hed - [/.[aeiou][sg]hed$/, Past], //stashed, sighed + [/.[aeiou][sg]hed$/, Past$1], //stashed, sighed //-rd - [/.[aeiou]red$/, Past], //stored - [/.[aeiou]r?ried$/, Past], //buried + [/.[aeiou]red$/, Past$1], //stored + [/.[aeiou]r?ried$/, Past$1], //buried //-led - [/.[bcdgtr]led$/, Past], //startled, rumbled - [/.[aoui]f?led$/, Past], //impaled, stifled + [/.[bcdgtr]led$/, Past$1], //startled, rumbled + [/.[aoui]f?led$/, Past$1], //impaled, stifled //-sed - [/.[iao]sed$/, Past], //franchised - [/[aeiou]n?[cs]ed$/, Past], //laced, lanced + [/.[iao]sed$/, Past$1], //franchised + [/[aeiou]n?[cs]ed$/, Past$1], //laced, lanced //-med - [/[aeiou][rl]?[mnf]ed$/, Past], //warmed, attained, engulfed + [/[aeiou][rl]?[mnf]ed$/, Past$1], //warmed, attained, engulfed //-ked - [/[aeiou][ns]?c?ked$/, Past], //hooked, masked + [/[aeiou][ns]?c?ked$/, Past$1], //hooked, masked //-ged - [/[aeiou][nl]?ged$/, Past], //engaged + [/[aeiou][nl]?ged$/, Past$1], //engaged //-ted - [/.[tdbwxz]ed$/, Past], //bribed, boxed - [/[^aeiou][aeiou][tvx]ed$/, Past], //boxed + [/.[tdbwxz]ed$/, Past$1], //bribed, boxed + [/[^aeiou][aeiou][tvx]ed$/, Past$1], //boxed //-ied - [/.[cdlmnprstv]ied$/, Past], //rallied - [/[^aeiou]ard$/, Sing], //card - [/[aeiou][^aeiou]id$/, Adj], [/.[vrl]id$/, Adj]], - e: [[/.[lnr]ize$/, Inf], [/.[^aeiou]ise$/, Inf], [/.[aeiou]te$/, Inf], [/.[^aeiou][ai]ble$/, Adj], [/.[^aeiou]eable$/, Adj], [/.[ts]ive$/, Adj]], - h: [[/.[^aeiouf]ish$/, Adj], [/.v[iy]ch$/, Last], //east-europe + [/.[cdlmnprstv]ied$/, Past$1], //rallied + [/[^aeiou]ard$/, Sing$1], //card + [/[aeiou][^aeiou]id$/, Adj$1], [/.[vrl]id$/, Adj$1]], + e: [[/.[lnr]ize$/, Inf$1], [/.[^aeiou]ise$/, Inf$1], [/.[aeiou]te$/, Inf$1], [/.[^aeiou][ai]ble$/, Adj$1], [/.[^aeiou]eable$/, Adj$1], [/.[ts]ive$/, Adj$1]], + h: [[/.[^aeiouf]ish$/, Adj$1], [/.v[iy]ch$/, Last$1], //east-europe [/^ug?h+$/, Exp], //uhh [/^uh[ -]?oh$/, Exp] //uhoh ], - i: [[/.[oau][wvl]ski$/, Last] //polish (male) + i: [[/.[oau][wvl]ski$/, Last$1] //polish (male) ], k: [[/^(k){2}$/, Exp] //kkkk ], - l: [[/.[gl]ial$/, Adj], [/.[^aeiou]ful$/, Adj], [/.[nrtumcd]al$/, Adj], [/.[^aeiou][ei]al$/, Adj]], - m: [[/.[^aeiou]ium$/, Sing], [/[^aeiou]ism$/, Sing], [/^h*u*m+$/, Exp], //mmmmmmm / ummmm / huuuuuummmmmm + l: [[/.[gl]ial$/, Adj$1], [/.[^aeiou]ful$/, Adj$1], [/.[nrtumcd]al$/, Adj$1], [/.[^aeiou][ei]al$/, Adj$1]], + m: [[/.[^aeiou]ium$/, Sing$1], [/[^aeiou]ism$/, Sing$1], [/^h*u*m+$/, Exp], //mmmmmmm / ummmm / huuuuuummmmmm [/^\d+ ?[ap]m$/, 'Date']], - n: [[/.[lsrnpb]ian$/, Adj], [/[^aeiou]ician$/, Actor], [/[aeiou][ktrp]in$/, 'Gerund'] // 'cookin', 'hootin' + n: [[/.[lsrnpb]ian$/, Adj$1], [/[^aeiou]ician$/, Actor$1], [/[aeiou][ktrp]in$/, 'Gerund'] // 'cookin', 'hootin' ], o: [[/^no+$/, Exp], //noooo [/^(yo)+$/, Exp], //yoyo [/^woo+[pt]?$/, Exp] //woo ], - r: [[/.[bdfklmst]ler$/, 'Noun'], [/[aeiou][pns]er$/, Sing], [/[^i]fer$/, Inf], [/.[^aeiou][ao]pher$/, Actor], [/.[lk]er$/, 'Noun'], [/.ier$/, 'Comparative']], - t: [[/.[di]est$/, 'Superlative'], [/.[icldtgrv]ent$/, Adj], [/[aeiou].*ist$/, Adj], [/^[a-z]et$/, Verb]], - s: [[/.[^aeiou]ises$/, Pres], [/.[rln]ates$/, Pres], [/.[^z]ens$/, Verb], [/.[lstrn]us$/, Sing], [/.[aeiou]sks$/, Pres], //masks - [/.[aeiou]kes$/, Pres], //bakes - [/[aeiou][^aeiou]is$/, Sing], [/[a-z]\'s$/, Noun], [/^yes+$/, Exp] //yessss + r: [[/.[bdfklmst]ler$/, 'Noun'], [/[aeiou][pns]er$/, Sing$1], [/[^i]fer$/, Inf$1], [/.[^aeiou][ao]pher$/, Actor$1], [/.[lk]er$/, 'Noun'], [/.ier$/, 'Comparative']], + t: [[/.[di]est$/, 'Superlative'], [/.[icldtgrv]ent$/, Adj$1], [/[aeiou].*ist$/, Adj$1], [/^[a-z]et$/, Verb]], + s: [[/.[^aeiou]ises$/, Pres$1], [/.[rln]ates$/, Pres$1], [/.[^z]ens$/, Verb], [/.[lstrn]us$/, Sing$1], [/.[aeiou]sks$/, Pres$1], //masks + [/.[aeiou]kes$/, Pres$1], //bakes + [/[aeiou][^aeiou]is$/, Sing$1], [/[a-z]\'s$/, Noun$1], [/^yes+$/, Exp] //yessss ], - v: [[/.[^aeiou][ai][kln]ov$/, Last] //east-europe + v: [[/.[^aeiou][ai][kln]ov$/, Last$1] //east-europe ], - y: [[/.[cts]hy$/, Adj], [/.[st]ty$/, Adj], [/.[gk]y$/, Adj], [/.[tnl]ary$/, Adj], [/.[oe]ry$/, Sing], [/[rdntkbhs]ly$/, Adverb], [/...lly$/, Adverb], [/[bszmp]{2}y$/, Adj], [/.(gg|bb|zz)ly$/, Adj], [/.[ai]my$/, Adj], [/[ea]{2}zy$/, Adj], [/.[^aeiou]ity$/, Sing]] + y: [[/.[cts]hy$/, Adj$1], [/.[st]ty$/, Adj$1], [/.[gk]y$/, Adj$1], [/.[tnl]ary$/, Adj$1], [/.[oe]ry$/, Sing$1], [/[rdntkbhs]ly$/, Adverb], [/...lly$/, Adverb], [/[bszmp]{2}y$/, Adj$1], [/.(gg|bb|zz)ly$/, Adj$1], [/.[ai]my$/, Adj$1], [/[ea]{2}zy$/, Adj$1], [/.[^aeiou]ity$/, Sing$1]] }; //just a foolish lookup of known suffixes - var Adj$1 = 'Adjective'; - var Inf$1 = 'Infinitive'; - var Pres$1 = 'PresentTense'; - var Sing$1 = 'Singular'; - var Past$1 = 'PastTense'; + var Adj = 'Adjective'; + var Inf = 'Infinitive'; + var Pres = 'PresentTense'; + var Sing = 'Singular'; + var Past = 'PastTense'; var Avb = 'Adverb'; var Plrl = 'Plural'; - var Actor$1 = 'Actor'; + var Actor = 'Actor'; var Vb = 'Verb'; - var Noun$1 = 'Noun'; - var Last$1 = 'LastName'; + var Noun = 'Noun'; + var Last = 'LastName'; var Modal = 'Modal'; var Place = 'Place'; // find any issues - https://observablehq.com/@spencermountain/suffix-word-lookup @@ -9590,121 +9595,121 @@ null, //1 { //2-letter - ea: Sing$1, - ia: Noun$1, - ic: Adj$1, + ea: Sing, + ia: Noun, + ic: Adj, ly: Avb, "'n": Vb, "'t": Vb }, { //3-letter - oed: Past$1, - ued: Past$1, - xed: Past$1, + oed: Past, + ued: Past, + xed: Past, ' so': Avb, "'ll": Modal, "'re": 'Copula', - azy: Adj$1, - eer: Noun$1, + azy: Adj, + eer: Noun, end: Vb, - ped: Past$1, - ffy: Adj$1, - ify: Inf$1, + ped: Past, + ffy: Adj, + ify: Inf, ing: 'Gerund', //likely to be converted to Adj after lexicon pass - ize: Inf$1, - lar: Adj$1, - mum: Adj$1, - nes: Pres$1, - nny: Adj$1, - oid: Adj$1, - ous: Adj$1, - que: Adj$1, - rol: Sing$1, - sis: Sing$1, - zes: Pres$1 + ize: Inf, + lar: Adj, + mum: Adj, + nes: Pres, + nny: Adj, + oid: Adj, + ous: Adj, + que: Adj, + rol: Sing, + sis: Sing, + zes: Pres }, { //4-letter - amed: Past$1, - aped: Past$1, - ched: Past$1, - lked: Past$1, - nded: Past$1, - cted: Past$1, - dged: Past$1, - akis: Last$1, + amed: Past, + aped: Past, + ched: Past, + lked: Past, + nded: Past, + cted: Past, + dged: Past, + akis: Last, //greek - cede: Inf$1, - chuk: Last$1, + cede: Inf, + chuk: Last, //east-europe - czyk: Last$1, + czyk: Last, //polish (male) - ects: Pres$1, + ects: Pres, ends: Vb, - enko: Last$1, + enko: Last, //east-europe - ette: Sing$1, - fies: Pres$1, + ette: Sing, + fies: Pres, fore: Avb, - gate: Inf$1, - gone: Adj$1, + gate: Inf, + gone: Adj, ices: Plrl, ints: Plrl, ines: Plrl, ions: Plrl, less: Avb, - llen: Adj$1, - made: Adj$1, - nsen: Last$1, + llen: Adj, + made: Adj, + nsen: Last, //norway - oses: Pres$1, + oses: Pres, ould: Modal, - some: Adj$1, - sson: Last$1, + some: Adj, + sson: Last, //swedish male - tage: Inf$1, + tage: Inf, teen: 'Value', - tion: Sing$1, - tive: Adj$1, - tors: Noun$1, - vice: Sing$1 + tion: Sing, + tive: Adj, + tors: Noun, + vice: Sing }, { //5-letter - tized: Past$1, - urned: Past$1, - eased: Past$1, + tized: Past, + urned: Past, + eased: Past, ances: Plrl, - bound: Adj$1, + bound: Adj, ettes: Plrl, fully: Avb, - ishes: Pres$1, + ishes: Pres, ities: Plrl, - marek: Last$1, + marek: Last, //polish (male) - nssen: Last$1, + nssen: Last, //norway - ology: Noun$1, + ology: Noun, ports: Plrl, - rough: Adj$1, - tches: Pres$1, + rough: Adj, + tches: Pres, tieth: 'Ordinal', tures: Plrl, wards: Avb, where: Avb }, { //6-letter - auskas: Last$1, + auskas: Last, //lithuania - keeper: Actor$1, - logist: Actor$1, + keeper: Actor, + logist: Actor, teenth: 'Value' }, { //7-letter - opoulos: Last$1, + opoulos: Last, //greek borough: Place, //Hillsborough - sdottir: Last$1 //swedish female + sdottir: Last //swedish female }]; @@ -9712,8 +9717,8 @@ var str = term.clean; var _char = str[str.length - 1]; - if (endsWith$1.hasOwnProperty(_char) === true) { - var regs = endsWith$1[_char]; + if (endsWith.hasOwnProperty(_char) === true) { + var regs = endsWith[_char]; for (var r = 0; r < regs.length; r += 1) { if (regs[r][0].test(str) === true) { @@ -9745,12 +9750,12 @@ }; //all-the-way-down! - var checkRegex$1 = function checkRegex(term, world) { + var checkRegex = function checkRegex(term, world) { knownSuffixes(term, world); endRegexs(term, world); }; - var _04Suffixes = checkRegex$1; + var _04Suffixes = checkRegex; //just some of the most common emoticons //faster than @@ -9876,7 +9881,7 @@ var steps = { lexicon: _01Lexicon, - punctuation: _02Punctuation$1, + punctuation: _02Punctuation, regex: _03Prefixes, suffix: _04Suffixes, emoji: _05Emoji @@ -10085,7 +10090,7 @@ var _01Neighbours = checkNeighbours; - var titleCase$4 = /^[A-Z][a-z'\u00C0-\u00FF]/; + var titleCase = /^[A-Z][a-z'\u00C0-\u00FF]/; var hasNumber = /[0-9]/; /** look for any grammar signals based on capital/lowercase */ @@ -10097,7 +10102,7 @@ for (var i = 1; i < terms.length; i++) { var term = terms[i]; - if (titleCase$4.test(term.text) === true && hasNumber.test(term.text) === false && term.tags.Date === undefined) { + if (titleCase.test(term.text) === true && hasNumber.test(term.text) === false && term.tags.Date === undefined) { term.tag('ProperNoun', 'titlecase-noun', world); } } @@ -10133,13 +10138,13 @@ var _03Stem = checkPrefix; //similar to plural/singularize rules, but not the same - var isPlural = [/(^v)ies$/i, /ises$/i, /ives$/i, /(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /(buffal|tomat|tornad)oes$/i, /(analy|ba|diagno|parenthe|progno|synop|the)ses$/i, /(vert|ind|cort)ices$/i, /(matr|append)ices$/i, /(x|ch|ss|sh|s|z|o)es$/i, /is$/i, /men$/i, /news$/i, /.tia$/i, /(^f)ves$/i, /(lr)ves$/i, /(^aeiouy|qu)ies$/i, /(m|l)ice$/i, /(cris|ax|test)es$/i, /(alias|status)es$/i, /ics$/i]; //similar to plural/singularize rules, but not the same + var isPlural$3 = [/(^v)ies$/i, /ises$/i, /ives$/i, /(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /(buffal|tomat|tornad)oes$/i, /(analy|ba|diagno|parenthe|progno|synop|the)ses$/i, /(vert|ind|cort)ices$/i, /(matr|append)ices$/i, /(x|ch|ss|sh|s|z|o)es$/i, /is$/i, /men$/i, /news$/i, /.tia$/i, /(^f)ves$/i, /(lr)ves$/i, /(^aeiouy|qu)ies$/i, /(m|l)ice$/i, /(cris|ax|test)es$/i, /(alias|status)es$/i, /ics$/i]; //similar to plural/singularize rules, but not the same - var isSingular = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /s[aeiou]+ns$/i, // sans, siens + var isSingular$1 = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /s[aeiou]+ns$/i, // sans, siens /(^aeiouy|qu)y$/i, /(x|ch|ss|sh|z)$/i, /(matr|vert|ind|cort)(ix|ex)$/i, /(m|l)ouse$/i, /(m|l)ice$/i, /(antenn|formul|nebul|vertebr|vit)a$/i, /.sis$/i, /^(?!talis|.*hu)(.*)man$/i]; - var isPlural_1 = { - isSingular: isSingular, - isPlural: isPlural + var isPlural_1$2 = { + isSingular: isSingular$1, + isPlural: isPlural$3 }; var noPlurals = ['Uncountable', 'Pronoun', 'Place', 'Value', 'Person', 'Month', 'WeekDay', 'Holiday']; @@ -10169,7 +10174,7 @@ } // isPlural suffix rules - if (isPlural_1.isPlural.find(function (reg) { + if (isPlural_1$2.isPlural.find(function (reg) { return reg.test(str); })) { t.tag('Plural', 'plural-rules', world); @@ -10177,7 +10182,7 @@ } // isSingular suffix rules - if (isPlural_1.isSingular.find(function (reg) { + if (isPlural_1$2.isSingular.find(function (reg) { return reg.test(str); })) { t.tag('Singular', 'singular-rules', world); @@ -10271,14 +10276,14 @@ var _05Organizations = tagOrgs; - var oneLetterAcronym$1 = /^[A-Z]('s|,)?$/; + var oneLetterAcronym = /^[A-Z]('s|,)?$/; var periodSeperated = /([A-Z]\.){2}[A-Z]?/i; var oneLetterWord = { I: true, A: true }; - var isAcronym$2 = function isAcronym(term, world) { + var isAcronym = function isAcronym(term, world) { var str = term.reduced; // a known acronym like fbi if (term.tags.Acronym) { @@ -10315,10 +10320,10 @@ } //non-period ones are harder - if (term.isUpperCase() && isAcronym$2(term, world)) { + if (term.isUpperCase() && isAcronym(term, world)) { term.tag('Acronym', 'acronym-step', world); term.tag('Noun', 'acronym-infer', world); - } else if (!oneLetterWord.hasOwnProperty(term.text) && oneLetterAcronym$1.test(term.text)) { + } else if (!oneLetterWord.hasOwnProperty(term.text) && oneLetterAcronym.test(term.text)) { term.tag('Acronym', 'one-letter-acronym', world); term.tag('Noun', 'one-letter-infer', world); } //if it's a organization, @@ -10373,7 +10378,7 @@ var _02Fallbacks = fallbacks; var hasNegative = /n't$/; - var irregulars$3 = { + var irregulars$2 = { "won't": ['will', 'not'], wont: ['will', 'not'], "can't": ['can', 'not'], @@ -10403,8 +10408,8 @@ var checkNegative = function checkNegative(term, phrase) { //check named-ones - if (irregulars$3.hasOwnProperty(term.clean) === true) { - return irregulars$3[term.clean]; + if (irregulars$2.hasOwnProperty(term.clean) === true) { + return irregulars$2[term.clean]; } //this word needs it's own logic: @@ -10423,7 +10428,7 @@ var _01Negative = checkNegative; - var contraction = /([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z]{1,2})$/i; //these ones don't seem to be ambiguous + var contraction$1 = /([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z]{1,2})$/i; //these ones don't seem to be ambiguous var easy = { ll: 'will', @@ -10434,7 +10439,7 @@ }; // var checkApostrophe = function checkApostrophe(term) { - var parts = term.text.match(contraction); + var parts = term.text.match(contraction$1); if (parts === null) { return null; @@ -10449,7 +10454,7 @@ var _02Simple = checkApostrophe; - var irregulars$4 = { + var irregulars$1 = { wanna: ['want', 'to'], gonna: ['going', 'to'], im: ['i', 'am'], @@ -10480,8 +10485,8 @@ var checkIrregulars = function checkIrregulars(term) { //check white-list - if (irregulars$4.hasOwnProperty(term.clean)) { - return irregulars$4[term.clean]; + if (irregulars$1.hasOwnProperty(term.clean)) { + return irregulars$1[term.clean]; } return null; @@ -10657,7 +10662,7 @@ var _06Ranges = checkRange; - var contraction$1 = /^(l|c|d|j|m|n|qu|s|t)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z\u00C0-\u00FF]+)$/i; // basic support for ungendered french contractions + var contraction = /^(l|c|d|j|m|n|qu|s|t)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z\u00C0-\u00FF]+)$/i; // basic support for ungendered french contractions // not perfect, but better than nothing, to support matching on french text. var french = { @@ -10682,7 +10687,7 @@ }; var checkFrench = function checkFrench(term) { - var parts = term.text.match(contraction$1); + var parts = term.text.match(contraction); if (parts === null || french.hasOwnProperty(parts[1]) === false) { return null; @@ -10782,8 +10787,26 @@ var miscCorrection = function miscCorrection(doc) { - //exactly like - var m = hasWord(doc, 'like'); + // imperative-form + var m = hasTag(doc, 'Infinitive'); + + if (m.found) { + // you eat? + m = m.ifNo('@hasQuestionMark'); // i speak + + m = m.ifNo('(i|we|they)'); // shut the door! + + m.match('[#Infinitive] (#Determiner|#Possessive) #Noun', 0).tag('Imperative', 'shut-the'); // go-fast + + m.match('^[#Infinitive] #Adverb?$', 0).tag('Imperative', 'go-fast'); // do not go + + m.match('[(do && #Infinitive)] not? #Verb', 0).tag('Imperative', 'do-not'); // do it + + m.match('[#Infinitive] (it|some)', 0).tag('Imperative', 'do-it'); + } //exactly like + + + m = hasWord(doc, 'like'); m.match('#Adverb like').notIf('(really|generally|typically|usually|sometimes|often|just) [like]').tag('Adverb', 'adverb-like'); //the orange. m = hasTag(doc, 'Adjective'); @@ -10828,7 +10851,7 @@ var fixMisc = miscCorrection; - var unique$5 = function unique(arr) { + var unique = function unique(arr) { var obj = {}; for (var i = 0; i < arr.length; i++) { @@ -10838,10 +10861,10 @@ return Object.keys(obj); }; - var _unique = unique$5; + var _unique = unique; // order matters - var list = [// ==== Mutliple tags ==== + var list$5 = [// ==== Mutliple tags ==== { match: 'too much', tag: 'Adverb Adjective', @@ -10983,7 +11006,7 @@ // reason: 'when-i-go-fishing', // }, ]; - var _01Misc = list; + var _01Misc = list$5; var _ambig = { // adverbs than can be adjectives @@ -11003,7 +11026,7 @@ }; var dates = "(".concat(_ambig.personDate.join('|'), ")"); - var list$1 = [// ==== Holiday ==== + var list$4 = [// ==== Holiday ==== { match: '#Holiday (day|eve)', tag: 'Holiday', @@ -11207,10 +11230,10 @@ tag: 'Date', reason: 'aug 20-21' }]; - var _02Dates = list$1; + var _02Dates = list$4; var adjectives$1 = "(".concat(_ambig.personAdjective.join('|'), ")"); - var list$2 = [// all fell apart + var list$3 = [// all fell apart { match: '[all] #Determiner? #Noun', group: 0, @@ -11322,8 +11345,14 @@ group: 0, tag: 'Adjective', reason: 'still-out' + }, // shut the door + { + match: '^[#Adjective] (the|your) #Noun', + group: 0, + tag: 'Infinitive', + reason: 'shut-the' }]; - var _03Adjective = list$2; + var _03Adjective = list$3; var _04Noun = [// ==== Plural ==== //there are reasons @@ -11651,14 +11680,18 @@ group: 0, tag: 'Noun', reason: 'goes-to-verb' - }, //a great run - // { match: '(a|an) #Adjective [(#Infinitive|#PresentTense)]', tag: 'Noun', reason: 'a|an2' }, - //a tv show + }, //a close watch on { - match: '(a|an) #Noun [#Infinitive]', + match: '(a|an) #Noun [#Infinitive] (#Preposition|#Noun)', group: 0, tag: 'Noun', reason: 'a-noun-inf' + }, //a tv show + { + match: '(a|an) #Noun [#Infinitive]$', + group: 0, + tag: 'Noun', + reason: 'a-noun-inf2' }, //do so { match: 'do [so]', @@ -11671,9 +11704,7 @@ group: 0, tag: 'Noun', reason: 'is-pres-noun' - }, // - // { match: '[#Infinitive] #Copula', group: 0, tag: 'Noun', reason: 'inf-copula' }, - //a close + }, //a close { match: '#Determiner #Adverb? [close]', group: 0, @@ -11722,7 +11753,7 @@ reason: 'co-noun' }]; - var adjectives$2 = "(".concat(_ambig.adverbAdjective.join('|'), ")"); + var adjectives = "(".concat(_ambig.adverbAdjective.join('|'), ")"); var _05Adverb = [//still good { match: '[still] #Adjective', @@ -11783,7 +11814,7 @@ reason: 'even-left' }, //cheering hard - dropped -ly's { - match: '#PresentTense [(hard|quick|long|bright|slow)]', + match: '(#PresentTense && !#Copula) [(hard|quick|long|bright|slow|fast|backwards|forwards)]', group: 0, tag: 'Adverb', reason: 'lazy-ly' @@ -11807,7 +11838,7 @@ reason: 'a-bit-cold' }, // dark green { - match: "[".concat(adjectives$2, "] #Adjective"), + match: "[".concat(adjectives, "] #Adjective"), group: 0, tag: 'Adverb', reason: 'dark-green' @@ -11919,8 +11950,8 @@ reason: 'a-is-one' }]; - var verbs$1 = "(".concat(_ambig.personVerb.join('|'), ")"); - var list$3 = [// adj -> gerund + var verbs = "(".concat(_ambig.personVerb.join('|'), ")"); + var list$2 = [// adj -> gerund // amusing his aunt { match: '[#Adjective] #Possessive #Noun', @@ -12157,12 +12188,12 @@ reason: 'compromises-are-possible' }, // would wade { - match: "#Modal [".concat(verbs$1, "]"), + match: "#Modal [".concat(verbs, "]"), group: 0, tag: 'Verb', reason: 'would-mark' }, { - match: "#Adverb [".concat(verbs$1, "]"), + match: "#Adverb [".concat(verbs, "]"), group: 0, tag: 'Verb', reason: 'really-mark' @@ -12174,12 +12205,12 @@ reason: 'to-mark' }, // wade smith { - match: "".concat(verbs$1, " #Person"), + match: "".concat(verbs, " #Person"), tag: 'Person', reason: 'rob-smith' }, // wade m. Cooper { - match: "".concat(verbs$1, " #Acronym #ProperNoun"), + match: "".concat(verbs, " #Acronym #ProperNoun"), tag: 'Person', reason: 'rob-a-smith' }, // damn them @@ -12199,9 +12230,9 @@ tag: 'Verb', reason: 'swear3-verb' }]; - var _07Verbs = list$3; + var _07Verbs = list$2; - var list$4 = [// ==== Region ==== + var list$1 = [// ==== Region ==== //West Norforlk { match: '(west|north|south|east|western|northern|southern|eastern)+ #Place', @@ -12244,7 +12275,7 @@ // // houston texas // { match: `[${places}] #Place`, group: 0, tag: 'Place', reason: 'paris-france' }, ]; - var _08Place = list$4; + var _08Place = list$1; var _09Org = [//John & Joe's { @@ -12291,10 +12322,10 @@ reason: 'noun-public-school' }]; - var nouns$1 = "(".concat(_ambig.personNoun.join('|'), ")"); + var nouns = "(".concat(_ambig.personNoun.join('|'), ")"); var months = "(".concat(_ambig.personMonth.join('|'), ")"); var places = "(".concat(_ambig.personPlace.join('|'), ")"); - var list$5 = [// ==== Honorific ==== + var list = [// ==== Honorific ==== { match: '[(1st|2nd|first|second)] #Honorific', group: 0, @@ -12452,13 +12483,13 @@ reason: 'bill-green' }, // faith smith { - match: "".concat(nouns$1, " #Person"), + match: "".concat(nouns, " #Person"), tag: 'Person', reason: 'ray-smith', safe: true }, // faith m. Smith { - match: "".concat(nouns$1, " #Acronym? #ProperNoun"), + match: "".concat(nouns, " #Acronym? #ProperNoun"), tag: 'Person', reason: 'ray-a-smith', safe: true @@ -12605,7 +12636,7 @@ tag: 'FirstName', reason: 'place-firstname' }]; - var _10People = list$5; + var _10People = list; var matches = []; matches = matches.concat(_01Misc); @@ -12619,7 +12650,7 @@ matches = matches.concat(_09Org); matches = matches.concat(_10People); // cache the easier conditions up-front - var cacheRequired$1 = function cacheRequired(reg) { + var cacheRequired = function cacheRequired(reg) { var needTags = []; var needWords = []; reg.forEach(function (obj) { @@ -12680,7 +12711,7 @@ } }); all.forEach(function (m) { - m.required = cacheRequired$1(m.reg); + m.required = cacheRequired(m.reg); return m; }); // console.log(all.length) // console.log(all[all.length - 1]) @@ -12782,7 +12813,7 @@ var _02Tagger = tagger; - var addMethod = function addMethod(Doc) { + var addMethod$a = function addMethod(Doc) { /** */ var Abbreviations = /*#__PURE__*/function (_Doc) { _inherits(Abbreviations, _Doc); @@ -12837,11 +12868,11 @@ return Doc; }; - var Abbreviations = addMethod; + var Abbreviations = addMethod$a; var hasPeriod = /\./; - var addMethod$1 = function addMethod(Doc) { + var addMethod$9 = function addMethod(Doc) { /** */ var Acronyms = /*#__PURE__*/function (_Doc) { _inherits(Acronyms, _Doc); @@ -12899,9 +12930,9 @@ return Doc; }; - var Acronyms = addMethod$1; + var Acronyms = addMethod$9; - var addMethod$2 = function addMethod(Doc) { + var addMethod$8 = function addMethod(Doc) { /** split into approximate sub-sentence phrases */ Doc.prototype.clauses = function (n) { // an awkward way to disambiguate a comma use @@ -12960,9 +12991,9 @@ return Doc; }; - var Clauses = addMethod$2; + var Clauses = addMethod$8; - var addMethod$3 = function addMethod(Doc) { + var addMethod$7 = function addMethod(Doc) { /** */ var Contractions = /*#__PURE__*/function (_Doc) { _inherits(Contractions, _Doc); @@ -13036,9 +13067,9 @@ return Doc; }; - var Contractions = addMethod$3; + var Contractions = addMethod$7; - var addMethod$4 = function addMethod(Doc) { + var addMethod$6 = function addMethod(Doc) { //pull it apart.. var parse = function parse(doc) { var things = doc.splitAfter('@hasComma').splitOn('(and|or) not?').not('(and|or) not?'); @@ -13166,7 +13197,7 @@ return Doc; }; - var Lists = addMethod$4; + var Lists = addMethod$6; var noPlural = '(#Pronoun|#Place|#Value|#Person|#Uncountable|#Month|#WeekDay|#Holiday|#Possessive)'; //certain words can't be plural, like 'peace' @@ -13185,7 +13216,7 @@ var hasPlural_1 = hasPlural; - var irregulars$5 = { + var irregulars = { hour: 'an', heir: 'an', heirloom: 'an', @@ -13228,8 +13259,8 @@ var str = doc.text('normal').trim(); //explicit irregular forms - if (irregulars$5.hasOwnProperty(str)) { - return irregulars$5[str]; + if (irregulars.hasOwnProperty(str)) { + return irregulars[str]; } //spelled-out acronyms @@ -13257,21 +13288,21 @@ var getArticle = makeArticle; //similar to plural/singularize rules, but not the same - var isPlural$1 = [/(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /men$/i, /.tia$/i, /(m|l)ice$/i]; //similar to plural/singularize rules, but not the same + var isPlural$2 = [/(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /men$/i, /.tia$/i, /(m|l)ice$/i]; //similar to plural/singularize rules, but not the same - var isSingular$1 = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /(^aeiouy|qu)y$/i, /(x|ch|ss|sh|z)$/i, /(matr|vert|ind|cort)(ix|ex)$/i, /(m|l)ouse$/i, /(m|l)ice$/i, /(antenn|formul|nebul|vertebr|vit)a$/i, /.sis$/i, /^(?!talis|.*hu)(.*)man$/i]; - var _rules$2 = { - isSingular: isSingular$1, - isPlural: isPlural$1 + var isSingular = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /(^aeiouy|qu)y$/i, /(x|ch|ss|sh|z)$/i, /(matr|vert|ind|cort)(ix|ex)$/i, /(m|l)ouse$/i, /(m|l)ice$/i, /(antenn|formul|nebul|vertebr|vit)a$/i, /.sis$/i, /^(?!talis|.*hu)(.*)man$/i]; + var _rules = { + isSingular: isSingular, + isPlural: isPlural$2 }; var endS = /s$/; // double-check this term, if it is not plural, or singular. // (this is a partial copy of ./tagger/fallbacks/plural) // fallback plural if it ends in an 's'. - var isPlural$2 = function isPlural(str) { + var isPlural$1 = function isPlural(str) { // isSingular suffix rules - if (_rules$2.isSingular.find(function (reg) { + if (_rules.isSingular.find(function (reg) { return reg.test(str); })) { return false; @@ -13283,7 +13314,7 @@ } // is it a plural like 'fungi'? - if (_rules$2.isPlural.find(function (reg) { + if (_rules.isPlural.find(function (reg) { return reg.test(str); })) { return true; @@ -13292,7 +13323,7 @@ return null; }; - var isPlural_1$1 = isPlural$2; + var isPlural_1$1 = isPlural$1; var exceptions = { he: 'his', @@ -13352,7 +13383,7 @@ var parse_1 = parse$1; - var methods$6 = { + var methods$2 = { /** overload the original json with noun information */ json: function json(options) { var n = null; @@ -13469,7 +13500,7 @@ return this; } }; - var methods_1 = methods$6; + var methods_1 = methods$2; var addMethod$5 = function addMethod(Doc) { /** */ @@ -13533,7 +13564,7 @@ var open = /\(/; var close = /\)/; - var addMethod$6 = function addMethod(Doc) { + var addMethod$4 = function addMethod(Doc) { /** anything between (these things) */ var Parentheses = /*#__PURE__*/function (_Doc) { _inherits(Parentheses, _Doc); @@ -13602,9 +13633,9 @@ return Doc; }; - var Parentheses = addMethod$6; + var Parentheses = addMethod$4; - var addMethod$7 = function addMethod(Doc) { + var addMethod$3 = function addMethod(Doc) { /** */ var Possessives = /*#__PURE__*/function (_Doc) { _inherits(Possessives, _Doc); @@ -13663,7 +13694,7 @@ return Doc; }; - var Possessives = addMethod$7; + var Possessives = addMethod$3; var pairs = { "\"": "\"", @@ -13707,7 +13738,7 @@ }; var hasOpen = RegExp('(' + Object.keys(pairs).join('|') + ')'); - var addMethod$8 = function addMethod(Doc) { + var addMethod$2 = function addMethod(Doc) { /** "these things" */ var Quotations = /*#__PURE__*/function (_Doc) { _inherits(Quotations, _Doc); @@ -13777,10 +13808,10 @@ return Doc; }; - var Quotations = addMethod$8; + var Quotations = addMethod$2; // walked => walk - turn a verb into it's root form - var toInfinitive$1 = function toInfinitive(parsed, world) { + var toInfinitive = function toInfinitive(parsed, world) { var verb = parsed.verb; // console.log(parsed) // verb.debug() //1. if it's already infinitive @@ -13809,7 +13840,7 @@ return world.transforms.toInfinitive(str, world, tense); }; - var toInfinitive_1$1 = toInfinitive$1; + var toInfinitive_1 = toInfinitive; // spencer walks -> singular // we walk -> plural @@ -13822,7 +13853,7 @@ // othertimes you need its subject 'we walk' vs 'i walk' - var isPlural$3 = function isPlural(parsed) { + var isPlural = function isPlural(parsed) { var vb = parsed.verb; if (vb.has('(are|were|does)') || parsed.auxiliary.has('(are|were|does)')) { @@ -13851,7 +13882,7 @@ return null; }; - var isPlural_1$2 = isPlural$3; + var isPlural_1 = isPlural; // #Copula : is -> 'is not' // #PastTense : walked -> did not walk @@ -13885,7 +13916,7 @@ if (vb.has('#PastTense')) { - var inf = toInfinitive_1$1(parsed, world); + var inf = toInfinitive_1(parsed, world); vb.replaceWith(inf, true); vb.prepend('did not'); return; @@ -13893,11 +13924,11 @@ if (vb.has('#PresentTense')) { - var _inf = toInfinitive_1$1(parsed, world); + var _inf = toInfinitive_1(parsed, world); vb.replaceWith(_inf, true); - if (isPlural_1$2(parsed)) { + if (isPlural_1(parsed)) { vb.prepend('do not'); } else { vb.prepend('does not'); @@ -13908,7 +13939,7 @@ if (vb.has('#Gerund')) { - var _inf2 = toInfinitive_1$1(parsed, world); + var _inf2 = toInfinitive_1(parsed, world); vb.replaceWith(_inf2, true); vb.prepend('not'); @@ -13916,7 +13947,7 @@ } //fallback 1: walk -> does not walk - if (isPlural_1$2(parsed)) { + if (isPlural_1(parsed)) { vb.prepend('does not'); return; } //fallback 2: walk -> do not walk @@ -13984,13 +14015,13 @@ return parsed; }; - var parse$2 = parseVerb; + var parse = parseVerb; /** too many special cases for is/was/will be*/ var toBe = function toBe(parsed) { var isI = false; - var plural = isPlural_1$2(parsed); + var plural = isPlural_1(parsed); var isNegative = parsed.negative.found; //account for 'i is' -> 'i am' irregular // if (vb.parent && vb.parent.has('i #Adverb? #Copula')) { // isI = true; @@ -14056,7 +14087,7 @@ var doModal_1 = doModal; - var conjugate$2 = function conjugate(parsed, world) { + var conjugate = function conjugate(parsed, world) { var verb = parsed.verb; //special handling of 'is', 'will be', etc. if (verb.has('#Copula') || verb.out('normal') === 'be' && parsed.auxiliary.has('will')) { @@ -14069,7 +14100,7 @@ var past = og.clone().replace('are', 'were'); var fut = og.clone().replace('are', 'will be'); - var _infinitive = toInfinitive_1$1(parsed, world); + var _infinitive = toInfinitive_1(parsed, world); var res = { PastTense: past.text(), @@ -14097,7 +14128,7 @@ var hasHyphen = parsed.verb.termList(0).hasHyphen(); - var infinitive = toInfinitive_1$1(parsed, world); + var infinitive = toInfinitive_1(parsed, world); if (!infinitive) { return {}; @@ -14149,46 +14180,12 @@ return forms; }; - var conjugate_1$1 = conjugate$2; - - // verb-phrases that are orders - 'close the door' - // these should not be conjugated - var isImperative = function isImperative(parsed) { - // do the dishes - if (parsed.auxiliary.has('do')) { - return true; - } // speak the truth - // if (parsed.verb.has('^#Infinitive')) { - // // 'i speak' is not imperative - // if (parsed.subject.has('(i|we|you|they)')) { - // return false - // } - // return true - // } - - - return false; - }; // // basically, don't conjugate it - // exports.toImperative = function (parsed) { - // let str = parsed.original.text() - // let res = { - // PastTense: str, - // PresentTense: str, - // FutureTense: str, - // Infinitive: str, - // } - // return res - // } - - - var imperative = { - isImperative: isImperative - }; + var conjugate_1 = conjugate; // if something is 'modal-ish' we are forced to use past-participle // ('i could drove' is wrong) - var useParticiple = function useParticiple(parsed) { + var useParticiple$1 = function useParticiple(parsed) { if (parsed.auxiliary.has('(could|should|would|may|can|must)')) { return true; } @@ -14212,7 +14209,7 @@ } // try to swap the main verb to its participle form - var obj = conjugate_1$1(parsed, world); + var obj = conjugate_1(parsed, world); var str = obj.Participle || obj.PastTense; if (str) { @@ -14243,13 +14240,12 @@ }; var participle = { - useParticiple: useParticiple, + useParticiple: useParticiple$1, toParticiple: toParticiple }; - var isImperative$1 = imperative.isImperative; var _toParticiple = participle.toParticiple, - useParticiple$1 = participle.useParticiple; // remove any tense-information in auxiliary verbs + useParticiple = participle.useParticiple; // remove any tense-information in auxiliary verbs var makeNeutral = function makeNeutral(parsed) { //remove tense-info from auxiliaries @@ -14262,7 +14258,7 @@ return parsed; }; - var methods$7 = { + var methods$1 = { /** overload the original json with verb information */ json: function json(options) { var _this = this; @@ -14283,7 +14279,7 @@ var res = []; this.forEach(function (p) { var json = p.json(options)[0]; - var parsed = parse$2(p); + var parsed = parse(p); json.parts = {}; Object.keys(parsed).forEach(function (k) { if (parsed[k] && parsed[k].isA === 'Doc') { @@ -14293,7 +14289,7 @@ } }); json.isNegative = p.has('#Negative'); - json.conjugations = conjugate_1$1(parsed, _this.world); + json.conjugations = conjugate_1(parsed, _this.world); res.push(json); }); @@ -14309,7 +14305,7 @@ var list = []; // look at internal adverbs this.forEach(function (vb) { - var advb = parse$2(vb).adverb; + var advb = parse(vb).adverb; if (advb.found) { list = list.concat(advb.list); @@ -14339,9 +14335,9 @@ var list = []; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - if (isPlural_1$2(parsed, _this2.world) === true) { + if (isPlural_1(parsed, _this2.world) === true) { list.push(vb.list[0]); } }); @@ -14354,9 +14350,9 @@ var list = []; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - if (isPlural_1$2(parsed, _this3.world) === false) { + if (isPlural_1(parsed, _this3.world) === false) { list.push(vb.list[0]); } }); @@ -14370,9 +14366,9 @@ var result = []; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var forms = conjugate_1$1(parsed, _this4.world); + var forms = conjugate_1(parsed, _this4.world); result.push(forms); }); @@ -14384,15 +14380,15 @@ var _this5 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); // should we support 'would swim' ➔ 'would have swam' + var parsed = parse(vb); // should we support 'would swim' ➔ 'would have swam' - if (useParticiple$1(parsed)) { + if (useParticiple(parsed)) { _toParticiple(parsed, _this5.world); return; } - if (isImperative$1(parsed)) { + if (vb.has('#Imperative')) { return; } // don't conjugate 'to be' @@ -14407,7 +14403,7 @@ return; } - var str = conjugate_1$1(parsed, _this5.world).PastTense; + var str = conjugate_1(parsed, _this5.world).PastTense; if (str) { parsed = makeNeutral(parsed); @@ -14422,9 +14418,9 @@ var _this6 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var obj = conjugate_1$1(parsed, _this6.world); + var obj = conjugate_1(parsed, _this6.world); var str = obj.PresentTense; // 'i look', not 'i looks' @@ -14460,13 +14456,13 @@ var _this7 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); // 'i should drive' is already future-enough + var parsed = parse(vb); // 'i should drive' is already future-enough - if (useParticiple$1(parsed)) { + if (useParticiple(parsed)) { return; } - var str = conjugate_1$1(parsed, _this7.world).FutureTense; + var str = conjugate_1(parsed, _this7.world).FutureTense; if (str) { parsed = makeNeutral(parsed); // avoid 'he would will go' @@ -14484,9 +14480,9 @@ var _this8 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var str = conjugate_1$1(parsed, _this8.world).Infinitive; + var str = conjugate_1(parsed, _this8.world).Infinitive; if (str) { vb.replaceWith(str, false); @@ -14501,9 +14497,9 @@ var _this9 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var str = conjugate_1$1(parsed, _this9.world).Gerund; + var str = conjugate_1(parsed, _this9.world).Gerund; if (str) { vb.replaceWith(str, false); @@ -14518,7 +14514,7 @@ var _this10 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); var noAux = !parsed.auxiliary.found; _toParticiple(parsed, _this10.world); // dirty trick to ensure our new auxiliary is found @@ -14543,6 +14539,11 @@ return this.ifNo('#Negative'); }, + /** return only commands - verbs in imperative mood */ + isImperative: function isImperative() { + return this["if"]('#Imperative'); + }, + /** add a 'not' to these verbs */ toNegative: function toNegative() { var _this11 = this; @@ -14550,7 +14551,7 @@ this.list.forEach(function (p) { var doc = _this11.buildFrom([p]); - var parsed = parse$2(doc); + var parsed = parse(doc); toNegative_1(parsed, doc.world); }); @@ -14582,7 +14583,7 @@ } }; - var addMethod$9 = function addMethod(Doc) { + var addMethod$1 = function addMethod(Doc) { /** */ var Verbs = /*#__PURE__*/function (_Doc) { _inherits(Verbs, _Doc); @@ -14599,7 +14600,7 @@ }(Doc); // add-in our methods - Object.assign(Verbs.prototype, methods$7); // aliases + Object.assign(Verbs.prototype, methods$1); // aliases Verbs.prototype.negate = Verbs.prototype.toNegative; @@ -14648,9 +14649,9 @@ return Doc; }; - var Verbs = addMethod$9; + var Verbs = addMethod$1; - var addMethod$a = function addMethod(Doc) { + var addMethod = function addMethod(Doc) { /** */ var People = /*#__PURE__*/function (_Doc) { _inherits(People, _Doc); @@ -14680,7 +14681,7 @@ return Doc; }; - var People = addMethod$a; + var People = addMethod; var subclass = [Abbreviations, Acronyms, Clauses, Contractions, Lists, Nouns, Parentheses, Possessives, Quotations, Verbs, People]; @@ -14698,7 +14699,7 @@ var Subset = extend; - var methods$8 = { + var methods = { misc: methods$4, selections: _simple }; @@ -14796,20 +14797,20 @@ return this.buildFrom(list); }; - Object.assign(Doc.prototype, methods$8.misc); - Object.assign(Doc.prototype, methods$8.selections); //add sub-classes + Object.assign(Doc.prototype, methods.misc); + Object.assign(Doc.prototype, methods.selections); //add sub-classes Subset(Doc); //aliases - var aliases$1 = { + var aliases = { untag: 'unTag', and: 'match', notIf: 'ifNo', only: 'if', onlyIf: 'if' }; - Object.keys(aliases$1).forEach(function (k) { - return Doc.prototype[k] = Doc.prototype[aliases$1[k]]; + Object.keys(aliases).forEach(function (k) { + return Doc.prototype[k] = Doc.prototype[aliases[k]]; }); var Doc_1 = Doc; diff --git a/builds/compromise.min.js b/builds/compromise.min.js index c9288515e..d500aefa1 100644 --- a/builds/compromise.min.js +++ b/builds/compromise.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).nlp=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;rr?n:r)+1;if(Math.abs(r-n)>(a||100))return a||100;for(var i,o,s,u,l,c,h=[],d=0;d4)return r;u=o===(s=t[i-1])?0:1,l=h[p-1][i]+1,(c=h[p][i-1]+1)1&&i>1&&o===t[i-2]&&e[p-2]===s&&(c=h[p-2][i-2]+u)2&&void 0!==arguments[2]?arguments[2]:3;if(e===t)return 1;if(e.lengtht.fuzzy)return!0;if(!0===t.soft&&(a=B(t.word,e.root))>t.fuzzy)return!0}return t.word===e.clean||t.word===e.text||t.word===e.reduced}return void 0!==t.tag?!0===e.tags[t.tag]:void 0!==t.method?"function"==typeof e[t.method]&&!0===e[t.method]():void 0!==t.regex?t.regex.test(e.clean):void 0!==t.fastOr?t.fastOr.hasOwnProperty(e.reduced)||t.fastOr.hasOwnProperty(e.text):void 0!==t.choices&&("and"===t.operator?t.choices.every((function(t){return O(e,t,r,n)})):t.choices.some((function(t){return O(e,t,r,n)})))},z=O=function(e,t,r,n){var a=G(e,t,r,n);return!0===t.negative?!a:a},T={},V={doesMatch:function(e,t,r){return z(this,e,t,r)},isAcronym:function(){return b(this.text)},isImplicit:function(){return""===this.text&&Boolean(this.implicit)},isKnown:function(){return Object.keys(this.tags).some((function(e){return!0!==T[e]}))},setRoot:function(e){var t=e.transforms,r=this.implicit||this.clean;if(this.tags.Plural&&(r=t.toSingular(r,e)),this.tags.Verb&&!this.tags.Negative&&!this.tags.Infinitive){var n=null;this.tags.PastTense?n="PastTense":this.tags.Gerund?n="Gerund":this.tags.PresentTense?n="PresentTense":this.tags.Participle?n="Participle":this.tags.Actor&&(n="Actor"),r=t.toInfinitive(r,e,n)}this.root=r}},J=/[\s-]/,M=/^[A-Z-]+$/,S={textOut:function(e,t,r){e=e||{};var n=this.text,a=this.pre,i=this.post;return!0===e.reduced&&(n=this.reduced||""),!0===e.root&&(n=this.root||""),!0===e.implicit&&this.implicit&&(n=this.implicit||""),!0===e.normal&&(n=this.clean||this.text||""),!0===e.root&&(n=this.root||this.reduced||""),!0===e.unicode&&(n=g(n)),!0===e.titlecase&&(this.tags.ProperNoun&&!this.titleCase()||(this.tags.Acronym?n=n.toUpperCase():M.test(n)&&!this.tags.Acronym&&(n=n.toLowerCase()))),!0===e.lowercase&&(n=n.toLowerCase()),!0===e.acronyms&&this.tags.Acronym&&(n=n.replace(/\./g,"")),!0!==e.whitespace&&!0!==e.root||(a="",i=" ",!1!==J.test(this.post)&&!e.last||this.implicit||(i="")),!0!==e.punctuation||e.root||(!0===this.hasPost(".")?i="."+i:!0===this.hasPost("?")?i="?"+i:!0===this.hasPost("!")?i="!"+i:!0===this.hasPost(",")?i=","+i:!0===this.hasEllipses()&&(i="..."+i)),!0!==t&&(a=""),!0!==r&&(i=""),!0===e.abbreviations&&this.tags.Abbreviation&&(i=i.replace(/^\./,"")),a+n+i}},L={Auxiliary:1,Possessive:1},_=function(e,t){var r=Object.keys(e.tags),n=t.tags;return r=r.sort((function(e,t){return L[t]||!n[t]?-1:n[t]?n[e]?n[e].lineage.length>n[t].lineage.length?1:n[e].isA.length>n[t].isA.length?-1:0:0:1}))},K={text:!0,tags:!0,implicit:!0,whitespace:!0,clean:!1,id:!1,index:!1,offset:!1,bestTag:!1},q={json:function(e,t){e=e||{};var r={};return(e=Object.assign({},K,e)).text&&(r.text=this.text),e.normal&&(r.normal=this.clean),e.tags&&(r.tags=Object.keys(this.tags)),e.clean&&(r.clean=this.clean),(e.id||e.offset)&&(r.id=this.id),e.implicit&&null!==this.implicit&&(r.implicit=this.implicit),e.whitespace&&(r.pre=this.pre,r.post=this.post),e.bestTag&&(r.bestTag=_(this,t)[0]),r}},R=Object.assign({},I,F,V,S,q);function W(){return"undefined"!=typeof window&&window.document}var U=function(e,t){for(e=e.toString();e.length0&&void 0!==arguments[0]?arguments[0]:"";t(this,e),r=String(r);var n=N(r);this.text=n.text||"",this.clean=n.clean,this.reduced=n.reduced,this.root=null,this.implicit=null,this.pre=n.pre||"",this.post=n.post||"",this.tags={},this.prev=null,this.next=null,this.id=c(n.clean),this.isA="Term",n.alias&&(this.alias=n.alias)}return n(e,[{key:"set",value:function(e){var t=N(e);return this.text=t.text,this.clean=t.clean,this}}]),e}();oe.prototype.clone=function(){var e=new oe(this.text);return e.pre=this.pre,e.post=this.post,e.clean=this.clean,e.reduced=this.reduced,e.root=this.root,e.implicit=this.implicit,e.tags=Object.assign({},this.tags),e},Object.assign(oe.prototype,R),Object.assign(oe.prototype,ie);var se=oe,ue={terms:function(e){if(0===this.length)return[];if(this.cache.terms)return void 0!==e?this.cache.terms[e]:this.cache.terms;for(var t=[this.pool.get(this.start)],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;"string"==typeof e&&(e="normal"===e?{whitespace:!0,unicode:!0,lowercase:!0,punctuation:!0,acronyms:!0,abbreviations:!0,implicit:!0,normal:!0}:"clean"===e?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,normal:!0}:"reduced"===e?{punctuation:!1,titlecase:!1,lowercase:!0,whitespace:!0,unicode:!0,implicit:!0,reduced:!0}:"implicit"===e?{punctuation:!0,implicit:!0,whitespace:!0,trim:!0}:"root"===e?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,root:!0}:{});var n=this.terms(),a=!1;n[0]&&null===n[0].prev&&null===n[n.length-1].next&&(a=!0);var i=n.reduce((function(i,o,s){if(0===s&&""===o.text&&null!==o.implicit&&!e.implicit)return i;e.last=r&&s===n.length-1;var u=!0,l=!0;return!1===a&&(0===s&&t&&(u=!1),s===n.length-1&&r&&(l=!1)),i+o.textOut(e,u,l)}),"");return!0===a&&r&&(i=le(i)),!0===e.trim&&(i=i.trim()),i}},he={trim:function(){var e=this.terms();if(e.length>0){e[0].pre=e[0].pre.replace(/^\s+/,"");var t=e[e.length-1];t.post=t.post.replace(/\s+$/,"")}return this}},de=/[.?!]\s*$/,ge=function(e,t){t[0].pre=e[0].pre;var r,n,a=e[e.length-1],i=t[t.length-1];i.post=(r=a.post,n=i.post,de.test(n)?n+r.match(/\s*$/):r),a.post="",""===a.post&&(a.post+=" ")},pe=function(e,t,r){var n=e.terms(),a=t.terms();ge(n,a),function(e,t,r){var n=e[e.length-1],a=t[t.length-1],i=n.next;n.next=t[0].id,a.next=i,i&&(r.get(i).prev=a.id);var o=e[0].id;o&&(t[0].prev=o)}(n,a,e.pool);var i=[e],o=e.start,s=[r];return(s=s.concat(r.parents())).forEach((function(e){var t=e.list.filter((function(e){return e.hasId(o)}));i=i.concat(t)})),(i=function(e){return e.filter((function(t,r){return e.indexOf(t)===r}))}(i)).forEach((function(e){e.length+=t.length})),e.cache={},e},fe=/ /,me=function(e,t,r){var n=e.start,a=t.terms();!function(e){var t=e[e.length-1];!1===fe.test(t.post)&&(t.post+=" ")}(a),function(e,t,r){var n=r[r.length-1];n.next=e.start;var a=e.pool,i=a.get(e.start);i.prev&&(a.get(i.prev).next=t.start),r[0].prev=e.terms(0).prev,e.terms(0).prev=n.id}(e,t,a);var i=[e],o=[r];return(o=o.concat(r.parents())).forEach((function(e){var r=e.list.filter((function(e){return e.hasId(n)||e.hasId(t.start)}));i=i.concat(r)})),(i=function(e){return e.filter((function(t,r){return e.indexOf(t)===r}))}(i)).forEach((function(e){e.length+=t.length,e.start===n&&(e.start=t.start),e.cache={}})),e},ve=function(e,t){var r=t.pool(),n=e.terms(),a=r.get(n[0].prev)||{},i=r.get(n[n.length-1].next)||{};n[0].implicit&&a.implicit&&(a.set(a.implicit),a.post+=" "),function(e,t,r,n){var a=e.parents();a.push(e),a.forEach((function(e){var a=e.list.find((function(e){return e.hasId(t)}));a&&(a.length-=r,a.start===t&&(a.start=n.id),a.cache={})})),e.list=e.list.filter((function(e){return!(!e.start||!e.length)}))}(t,e.start,e.length,i),a&&(a.next=i.id),i&&(i.prev=a.id)},be={append:function(e,t){return pe(this,e,t),this},prepend:function(e,t){return me(this,e,t),this},delete:function(e){return ve(this,e),this},replace:function(e,t){var r=this.length;pe(this,e,t);var n=this.buildFrom(this.start,this.length);n.length=r,ve(n,t)},splitOn:function(e){var t=this.terms(),r={before:null,match:null,after:null},n=t.findIndex((function(t){return t.id===e.start}));if(-1===n)return r;var a=t.slice(0,n);a.length>0&&(r.before=this.buildFrom(a[0].id,a.length));var i=t.slice(n,n+e.length);i.length>0&&(r.match=this.buildFrom(i[0].id,i.length));var o=t.slice(n+e.length,t.length);return o.length>0&&(r.after=this.buildFrom(o[0].id,o.length,this.pool)),r}},ye={json:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r={};return e.text&&(r.text=this.text()),e.normal&&(r.normal=this.text("normal")),e.clean&&(r.clean=this.text("clean")),e.reduced&&(r.reduced=this.text("reduced")),e.implicit&&(r.implicit=this.text("implicit")),e.root&&(r.root=this.text("root")),e.trim&&(r.text&&(r.text=r.text.trim()),r.normal&&(r.normal=r.normal.trim()),r.reduced&&(r.reduced=r.reduced.trim())),e.terms&&(!0===e.terms&&(e.terms={}),r.terms=this.terms().map((function(r){return r.json(e.terms,t)}))),r}},we={lookAhead:function(e){e||(e=".*");var t=this.pool,r=[],n=this.terms();return function e(n){var a=t.get(n);a&&(r.push(a),a.prev&&e(a.next))}(n[n.length-1].next),0===r.length?[]:this.buildFrom(r[0].id,r.length).match(e)},lookBehind:function(e){e||(e=".*");var t=this.pool,r=[];return function e(n){var a=t.get(n);a&&(r.push(a),a.prev&&e(a.prev))}(t.get(this.start).prev),0===r.length?[]:this.buildFrom(r[r.length-1].id,r.length).match(e)}},ke=Object.assign({},ue,ce,he,be,ye,we),Ae=function(e,t){if(0===t.length)return!0;for(var r=0;r0)return!0;if(!0===n.anything&&!0===n.negative)return!0}return!1},De=x((function(e,t){t.getGreedy=function(e,t){for(var r=Object.assign({},e.regs[e.r],{start:!1,end:!1}),n=e.t;e.t1&&void 0!==arguments[1]?arguments[1]:0,n=e.regs[e.r],a=!1,i=0;it&&(t=r.length),n}))&&t},t.getGroup=function(e,t,r){if(e.groups[e.groupId])return e.groups[e.groupId];var n=e.terms[t].id;return e.groups[e.groupId]={group:String(r),start:n,length:0},e.groups[e.groupId]}})),$e=function(e,t,r,n){for(var a={t:0,terms:e,r:0,regs:t,groups:{},start_i:r,phrase_length:n,hasGroup:!1,groupId:null,previousGroup:null};a.ra.t)return null;if(!0===i.end&&a.start_i+a.t!==n)return null}if(!0===a.hasGroup){var f=De.getGroup(a,d,i.named);a.t>1&&i.greedy?f.length+=a.t-d:f.length++}}else{if(i.negative){var m=Object.assign({},i);if(m.negative=!1,!0===a.terms[a.t].doesMatch(m,a.start_i+a.t,a.phrase_length))return null}if(!0!==i.optional){if(a.terms[a.t].isImplicit()&&t[a.r-1]&&a.terms[a.t+1]){if(a.terms[a.t-1]&&a.terms[a.t-1].implicit===t[a.r-1].word)return null;if(a.terms[a.t+1].doesMatch(i,a.start_i+a.t,a.phrase_length)){a.t+=2;continue}}return null}}}else{var v=De.greedyTo(a,t[a.r+1]);if(void 0!==i.min&&v-a.ti.max){a.t=a.t+i.max;continue}if(null===v)return null;!0===a.hasGroup&&(De.getGroup(a,a.t,i.named).length=v-a.t),a.t=v}}return{match:a.terms.slice(0,a.t),groups:a.groups}},Pe=function(e,t,r){if(!r||0===r.length)return r;if(t.some((function(e){return e.end}))){var n=e[e.length-1];r=r.filter((function(e){return-1!==e.match.indexOf(n)}))}return r},He=/\{([0-9]+,?[0-9]*)\}/,je=/&&/,Ee=new RegExp(/^<(\S+)>/),Ne=function(e){return e[e.length-1]},xe=function(e){return e[0]},Ie=function(e){return e.substr(1)},Fe=function(e){return e.substr(0,e.length-1)},Ce=function(e){return e=Ie(e),e=Fe(e)},Be=function e(t){for(var r,n={},a=0;a<2;a+=1){if("$"===Ne(t)&&(n.end=!0,t=Fe(t)),"^"===xe(t)&&(n.start=!0,t=Ie(t)),("["===xe(t)||"]"===Ne(t))&&(n.named=!0,"["===xe(t)?n.groupType="]"===Ne(t)?"single":"start":n.groupType="end",t=(t=t.replace(/^\[/,"")).replace(/\]$/,""),"<"===xe(t))){var i=Ee.exec(t);i.length>=2&&(n.named=i[1],t=t.replace(i[0],""))}if("+"===Ne(t)&&(n.greedy=!0,t=Fe(t)),"*"!==t&&"*"===Ne(t)&&"\\*"!==t&&(n.greedy=!0,t=Fe(t)),"?"===Ne(t)&&(n.optional=!0,t=Fe(t)),"!"===xe(t)&&(n.negative=!0,t=Ie(t)),"("===xe(t)&&")"===Ne(t)){je.test(t)?(n.choices=t.split(je),n.operator="and"):(n.choices=t.split("|"),n.operator="or"),n.choices[0]=Ie(n.choices[0]);var o=n.choices.length-1;n.choices[o]=Fe(n.choices[o]),n.choices=n.choices.map((function(e){return e.trim()})),n.choices=n.choices.filter((function(e){return e})),n.choices=n.choices.map((function(t){return t.split(/ /g).map(e)})),t=""}if("/"===xe(t)&&"/"===Ne(t))return t=Ce(t),n.regex=new RegExp(t),n;if("~"===xe(t)&&"~"===Ne(t))return t=Ce(t),n.soft=!0,n.word=t,n}return!0===He.test(t)&&(t=t.replace(He,(function(e,t){var r=t.split(/,/g);return 1===r.length?(n.min=Number(r[0]),n.max=Number(r[0])):(n.min=Number(r[0]),n.max=Number(r[1]||999)),n.greedy=!0,n.optional=!0,""}))),"#"===xe(t)?(n.tag=Ie(t),n.tag=(r=n.tag).charAt(0).toUpperCase()+r.substr(1),n):"@"===xe(t)?(n.method=Ie(t),n):"."===t?(n.anything=!0,n):"*"===t?(n.anything=!0,n.greedy=!0,n.optional=!0,n):(t&&(t=(t=t.replace("\\*","*")).replace("\\.","."),n.word=t.toLowerCase()),n)},Oe=function(e){for(var t,r=!1,n=-1,a=0;a1&&void 0!==arguments[1]?arguments[1]:{},r=e.filter((function(e){return e.groupType})).length;return r>0&&(e=Oe(e)),t.fuzzy||(e=Ge(e)),e},Te=/[^[a-z]]\//g,Ve=function(e){return"[object Array]"===Object.prototype.toString.call(e)},Je=function(e){var t=e.split(/([\^\[\!]*(?:<\S+>)?\(.*?\)[?+*]*\]?\$?)/);return t=t.map((function(e){return e.trim()})),Te.test(e)&&(t=function(e){return e.forEach((function(t,r){var n=t.match(Te);null!==n&&1===n.length&&e[r+1]&&(e[r]+=e[r+1],e[r+1]="",null!==(n=e[r].match(Te))&&1===n.length&&(e[r]+=e[r+2],e[r+2]=""))})),e=e.filter((function(e){return e}))}(t)),t},Me=function(e){var t=[];return e.forEach((function(e){if(/\(.*\)/.test(e))t.push(e);else{var r=e.split(" ");r=r.filter((function(e){return e})),t=t.concat(r)}})),t},Se=function(e){return[{choices:e.map((function(e){return[{word:e}]})),operator:"or"}]},Le=function(e){if(!e||!e.list||!e.list[0])return[];var t=[];return e.list.forEach((function(e){var r=[];e.terms().forEach((function(e){r.push(e.id)})),t.push(r)})),[{idBlocks:t}]},_e=function(e,t){return!0===t.fuzzy&&(t.fuzzy=.85),"number"==typeof t.fuzzy&&(e=e.map((function(e){return t.fuzzy>0&&e.word&&(e.fuzzy=t.fuzzy),e.choices&&e.choices.forEach((function(e){e.forEach((function(e){e.fuzzy=t.fuzzy}))})),e}))),e},Ke=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||""===t)return[];if("object"===e(t)){if(Ve(t)){if(0===t.length||!t[0])return[];if("object"===e(t[0]))return t;if("string"==typeof t[0])return Se(t)}return t&&"Doc"===t.isA?Le(t):[]}"number"==typeof t&&(t=String(t));var n=Je(t);return n=(n=Me(n)).map((function(e){return Be(e)})),n=ze(n,r),n=_e(n,r)},qe=function(e,t){for(var r=[],n=t[0].idBlocks,a=function(t){n.forEach((function(n){0!==n.length?n.every((function(r,n){return i=t,e[t+n].id===r}))&&(r.push({match:e.slice(t,t+n.length)}),t+=n.length-1):i=t})),i=t},i=0;i2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof t&&(t=Ke(t)),!0===Ae(e,t))return[];var n=t.filter((function(e){return!0!==e.optional&&!0!==e.negative})).length,a=e.terms(),i=[];if(t[0].idBlocks){var o=qe(a,t);if(o&&o.length>0)return Pe(a,t,o)}if(!0===t[0].start){var s=$e(a,t,0,a.length);return s&&s.match&&s.match.length>0&&(s.match=s.match.filter((function(e){return e})),i.push(s)),Pe(a,t,i)}for(var u=0;ua.length);u+=1){var l=$e(a.slice(u),t,u,a.length);if(l&&l.match&&l.match.length>0&&(u+=l.match.length-1,l.match=l.match.filter((function(e){return e})),i.push(l),!0===r))return Pe(a,t,i)}return Pe(a,t,i)},We=function(e,t){var r={};Re(e,t).forEach((function(e){e.match.forEach((function(e){r[e.id]=!0}))}));var n=e.terms(),a=[],i=[];return n.forEach((function(e){!0!==r[e.id]?i.push(e):i.length>0&&(a.push(i),i=[])})),i.length>0&&a.push(i),a},Ue={match:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Re(this,e,r);return n=n.map((function(e){var r=e.match,n=e.groups,a=t.buildFrom(r[0].id,r.length,n);return a.cache.terms=r,a}))},has:function(e){return Re(this,e,!0).length>0},not:function(e){var t=this,r=We(this,e);return r=r.map((function(e){return t.buildFrom(e[0].id,e.length)}))},canBe:function(e,t){for(var r=this,n=[],a=this.terms(),i=!1,o=0;o0})).map((function(e){return r.buildFrom(e[0].id,e.length)}))}},Qe=function e(r,n,a){t(this,e),this.start=r,this.length=n,this.isA="Phrase",Object.defineProperty(this,"pool",{enumerable:!1,writable:!0,value:a}),Object.defineProperty(this,"cache",{enumerable:!1,writable:!0,value:{}}),Object.defineProperty(this,"groups",{enumerable:!1,writable:!0,value:{}})};Qe.prototype.buildFrom=function(e,t,r){var n=new Qe(e,t,this.pool);return r&&Object.keys(r).length>0?n.groups=r:n.groups=this.groups,n},Object.assign(Qe.prototype,Ue),Object.assign(Qe.prototype,ke);var Ze={term:"terms"};Object.keys(Ze).forEach((function(e){return Qe.prototype[e]=Qe.prototype[Ze[e]]}));var Xe=Qe,Ye=function(){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),Object.defineProperty(this,"words",{enumerable:!1,value:r})}return n(e,[{key:"add",value:function(e){return this.words[e.id]=e,this}},{key:"get",value:function(e){return this.words[e]}},{key:"remove",value:function(e){delete this.words[e]}},{key:"merge",value:function(e){return Object.assign(this.words,e.words),this}},{key:"stats",value:function(){return{words:Object.keys(this.words).length}}}]),e}();Ye.prototype.clone=function(){var e=this,t=Object.keys(this.words).reduce((function(t,r){var n=e.words[r].clone();return t[n.id]=n,t}),{});return new Ye(t)};var et=Ye,tt=function(e){e.forEach((function(t,r){r>0&&(t.prev=e[r-1].id),e[r+1]&&(t.next=e[r+1].id)}))},rt=/(\S.+?[.!?\u203D\u2E18\u203C\u2047-\u2049])(?=\s+|$)/g,nt=/\S/,at=/[ .][A-Z]\.? *$/i,it=/(?:\u2026|\.{2,}) *$/,ot=/((?:\r?\n|\r)+)/,st=/[a-z0-9\u00C0-\u00FF\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/i,ut=/^\s+/,lt=function(e,t){if(!0===at.test(e))return!1;if(!0===it.test(e))return!1;if(!1===st.test(e))return!1;var r=e.replace(/[.!?\u203D\u2E18\u203C\u2047-\u2049] *$/,"").split(" "),n=r[r.length-1].toLowerCase();return!t.hasOwnProperty(n)},ct=function(e,t){var r=t.cache.abbreviations;e=e||"";var n=[],a=[];if(!(e=String(e))||"string"!=typeof e||!1===nt.test(e))return n;for(var i=function(e){for(var t=[],r=e.split(ot),n=0;n0&&(n.push(l),a[u]="")}if(0===n.length)return[e];for(var c=1;c0?(t[t.length-1]+=i,t.push(s)):t.push(i+s),i=""):i+=s}return i&&(0===t.length&&(t[0]=""),t[t.length-1]+=i),t=(t=function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=null;"string"!=typeof e&&("number"==typeof e?e=String(e):yt(e)&&(n=e)),n=(n=n||ct(e,t)).map((function(e){return bt(e)})),r=r||new et;var a=n.map((function(e){e=e.map((function(e){var t=new se(e);return r.add(t),t})),tt(e);var t=new Xe(e[0].id,e.length,r);return t.cache.terms=e,t}));return a},kt=function(e,t){var r=new et;return e.map((function(e,n){var a=e.terms.map((function(a,i){var o=new se(a.text);return o.pre=void 0!==a.pre?a.pre:"",void 0===a.post&&(a.post=" ",i>=e.terms.length-1&&(a.post=". ",n>=e.terms.length-1&&(a.post="."))),o.post=void 0!==a.post?a.post:" ",a.tags&&a.tags.forEach((function(e){return o.tag(e,"",t)})),r.add(o),o}));return tt(a),new Xe(a[0].id,a.length,r)}))},At=["Person","Place","Organization"],Dt={Noun:{notA:["Verb","Adjective","Adverb"]},Singular:{isA:"Noun",notA:"Plural"},ProperNoun:{isA:"Noun"},Person:{isA:["ProperNoun","Singular"],notA:["Place","Organization","Date"]},FirstName:{isA:"Person"},MaleName:{isA:"FirstName",notA:["FemaleName","LastName"]},FemaleName:{isA:"FirstName",notA:["MaleName","LastName"]},LastName:{isA:"Person",notA:["FirstName"]},NickName:{isA:"Person",notA:["FirstName","LastName"]},Honorific:{isA:"Noun",notA:["FirstName","LastName","Value"]},Place:{isA:"Singular",notA:["Person","Organization"]},Country:{isA:["Place","ProperNoun"],notA:["City"]},City:{isA:["Place","ProperNoun"],notA:["Country"]},Region:{isA:["Place","ProperNoun"]},Address:{isA:"Place"},Organization:{isA:["Singular","ProperNoun"],notA:["Person","Place"]},SportsTeam:{isA:"Organization"},School:{isA:"Organization"},Company:{isA:"Organization"},Plural:{isA:"Noun",notA:["Singular"]},Uncountable:{isA:"Noun"},Pronoun:{isA:"Noun",notA:At},Actor:{isA:"Noun",notA:At},Activity:{isA:"Noun",notA:["Person","Place"]},Unit:{isA:"Noun",notA:At},Demonym:{isA:["Noun","ProperNoun"],notA:At},Possessive:{isA:"Noun"}},$t={Verb:{notA:["Noun","Adjective","Adverb","Value"]},PresentTense:{isA:"Verb",notA:["PastTense","FutureTense"]},Infinitive:{isA:"PresentTense",notA:["PastTense","Gerund"]},Gerund:{isA:"PresentTense",notA:["PastTense","Copula","FutureTense"]},PastTense:{isA:"Verb",notA:["FutureTense"]},FutureTense:{isA:"Verb"},Copula:{isA:"Verb"},Modal:{isA:"Verb",notA:["Infinitive"]},PerfectTense:{isA:"Verb",notA:"Gerund"},Pluperfect:{isA:"Verb"},Participle:{isA:"PastTense"},PhrasalVerb:{isA:"Verb"},Particle:{isA:"PhrasalVerb"},Auxiliary:{notA:["Noun","Adjective","Value"]}},Pt={Value:{notA:["Verb","Adjective","Adverb"]},Ordinal:{isA:"Value",notA:["Cardinal"]},Cardinal:{isA:"Value",notA:["Ordinal"]},Fraction:{isA:"Value",notA:["Noun"]},RomanNumeral:{isA:"Cardinal",notA:["Ordinal","TextValue"]},TextValue:{isA:"Value",notA:["NumericValue"]},NumericValue:{isA:"Value",notA:["TextValue"]},Money:{isA:"Cardinal"},Percent:{isA:"Value"}},Ht=["Noun","Verb","Adjective","Adverb","Value","QuestionWord"],jt={Adjective:{notA:["Noun","Verb","Adverb","Value"]},Comparable:{isA:["Adjective"]},Comparative:{isA:["Adjective"]},Superlative:{isA:["Adjective"],notA:["Comparative"]},NumberRange:{isA:["Contraction"]},Adverb:{notA:["Noun","Verb","Adjective","Value"]},Date:{notA:["Verb","Conjunction","Adverb","Preposition","Adjective"]},Month:{isA:["Date","Singular"],notA:["Year","WeekDay","Time"]},WeekDay:{isA:["Date","Noun"]},Time:{isA:["Date"],notA:["AtMention"]},Determiner:{notA:Ht},Conjunction:{notA:Ht},Preposition:{notA:Ht},QuestionWord:{notA:["Determiner"]},Currency:{isA:["Noun"]},Expression:{notA:["Noun","Adjective","Verb","Adverb"]},Abbreviation:{},Url:{notA:["HashTag","PhoneNumber","Verb","Adjective","Value","AtMention","Email"]},PhoneNumber:{notA:["HashTag","Verb","Adjective","Value","AtMention","Email"]},HashTag:{},AtMention:{isA:["Noun"],notA:["HashTag","Verb","Adjective","Value","Email"]},Emoji:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Emoticon:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Email:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Acronym:{notA:["Plural","RomanNumeral"]},Negative:{notA:["Noun","Adjective","Value"]},Condition:{notA:["Verb","Adjective","Noun","Value"]}},Et={Noun:"blue",Verb:"green",Negative:"green",Date:"red",Value:"red",Adjective:"magenta",Preposition:"cyan",Conjunction:"cyan",Determiner:"cyan",Adverb:"cyan"},Nt=function(e){return Object.keys(e).forEach((function(t){e[t].color?e[t].color=e[t].color:Et[t]?e[t].color=Et[t]:e[t].isA.some((function(r){return!!Et[r]&&(e[t].color=Et[r],!0)}))})),e},xt=function(e){return Object.keys(e).forEach((function(t){for(var r=e[t],n=r.isA.length,a=0;a=0;i--,a*=36){var o=e.charCodeAt(i)-48;o>10&&(o-=7),t+=o*a}return t},Jt=function(e,t,r){var n=Vt(t);return n1&&(r.hasCompound[i[0]]=!0),void 0===_t[a]?void 0!==t[n]?("string"==typeof t[n]&&(t[n]=[t[n]]),"string"==typeof a?t[n].push(a):t[n]=t[n].concat(a)):t[n]=a:_t[a](t,n,r)}))},qt=function(e){var t=Object.assign({},Lt);return Object.keys(Gt).forEach((function(r){var n=St(Gt[r]);Object.keys(n).forEach((function(e){n[e]=r})),Kt(n,t,e)})),t},Rt=Kt,Wt=function(e){for(var t=e.irregulars.nouns,r=Object.keys(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=e[e.length-1];if(!0===tr.hasOwnProperty(t))for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r={};return t&&t.irregulars&&!0===t.irregulars.verbs.hasOwnProperty(e)&&(r=Object.assign({},t.irregulars.verbs[e])),void 0===(r=Object.assign({},ar(e),r)).Gerund&&(r.Gerund=or.Gerund(e)),void 0===r.PastTense&&(r.PastTense=or.PastTense(e)),void 0===r.PresentTense&&(r.PresentTense=or.PresentTense(e)),r},ur=[/ght$/,/nge$/,/ough$/,/ain$/,/uel$/,/[au]ll$/,/ow$/,/oud$/,/...p$/],lr=[/ary$/],cr={nice:"nicest",late:"latest",hard:"hardest",inner:"innermost",outer:"outermost",far:"furthest",worse:"worst",bad:"worst",good:"best",big:"biggest",large:"largest"},hr=[{reg:/y$/i,repl:"iest"},{reg:/([aeiou])t$/i,repl:"$1ttest"},{reg:/([aeou])de$/i,repl:"$1dest"},{reg:/nge$/i,repl:"ngest"},{reg:/([aeiou])te$/i,repl:"$1test"}],dr=[/ght$/,/nge$/,/ough$/,/ain$/,/uel$/,/[au]ll$/,/ow$/,/old$/,/oud$/,/e[ae]p$/],gr=[/ary$/,/ous$/],pr={grey:"greyer",gray:"grayer",green:"greener",yellow:"yellower",red:"redder",good:"better",well:"better",bad:"worse",sad:"sadder",big:"bigger"},fr=[{reg:/y$/i,repl:"ier"},{reg:/([aeiou])t$/i,repl:"$1tter"},{reg:/([aeou])de$/i,repl:"$1der"},{reg:/nge$/i,repl:"nger"}],mr={toSuperlative:function(e){if(cr.hasOwnProperty(e))return cr[e];for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=t.irregulars.nouns;if(r.hasOwnProperty(e))return r[e];var n=wr(e);return null!==n?n:yr.test(e)?e+"es":e+"s"},Ar=[[/([^v])ies$/i,"$1y"],[/ises$/i,"isis"],[/(kn|[^o]l|w)ives$/i,"$1ife"],[/^((?:ca|e|ha|(?:our|them|your)?se|she|wo)l|lea|loa|shea|thie)ves$/i,"$1f"],[/^(dwar|handkerchie|hoo|scar|whar)ves$/i,"$1f"],[/(antenn|formul|nebul|vertebr|vit)ae$/i,"$1a"],[/(octop|vir|radi|nucle|fung|cact|stimul)(i)$/i,"$1us"],[/(buffal|tomat|tornad)(oes)$/i,"$1o"],[/(eas)es$/i,"$1e"],[/(..[aeiou]s)es$/i,"$1"],[/(vert|ind|cort)(ices)$/i,"$1ex"],[/(matr|append)(ices)$/i,"$1ix"],[/(x|ch|ss|sh|z|o)es$/i,"$1"],[/men$/i,"man"],[/(n)ews$/i,"$1ews"],[/([ti])a$/i,"$1um"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/(s)eries$/i,"$1eries"],[/(m)ovies$/i,"$1ovie"],[/([m|l])ice$/i,"$1ouse"],[/(cris|ax|test)es$/i,"$1is"],[/(alias|status)es$/i,"$1"],[/(ss)$/i,"$1"],[/(ics)$/i,"$1"],[/s$/i,""]],Dr=function(e,t){var r,n=t.irregulars.nouns,a=(r=n,Object.keys(r).reduce((function(e,t){return e[r[t]]=t,e}),{}));if(a.hasOwnProperty(e))return a[e];for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof t&&"number"!=typeof t&&null!==t||(t={group:t});var r=Ke(e,t);if(0===r.length)return this.buildFrom([]);if(!1===Or(this,r))return this.buildFrom([]);var n=this.list.reduce((function(e,t){return e.concat(t.match(r))}),[]);return void 0!==t.group&&null!==t.group&&""!==t.group?this.buildFrom(n).groups(t.group):this.buildFrom(n)},t.not=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);if(0===r.length||!1===Or(this,r))return this;var n=this.list.reduce((function(e,t){return e.concat(t.not(r))}),[]);return this.buildFrom(n)},t.matchOne=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);if(!1===Or(this,r))return this.buildFrom([]);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);if(!1===Or(this,r))return this.buildFrom([]);var n=this.list.filter((function(e){return!0===e.has(r)}));return this.buildFrom(n)},t.ifNo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t),n=this.list.filter((function(e){return!1===e.has(r)}));return this.buildFrom(n)},t.has=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);return!1!==Or(this,r)&&this.list.some((function(e){return!0===e.has(r)}))},t.lookAhead=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e||(e=".*");var r=Ke(e,t),n=[];return this.list.forEach((function(e){n=n.concat(e.lookAhead(r))})),n=n.filter((function(e){return e})),this.buildFrom(n)},t.lookAfter=t.lookAhead,t.lookBehind=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e||(e=".*");var r=Ke(e,t),n=[];return this.list.forEach((function(e){n=n.concat(e.lookBehind(r))})),n=n.filter((function(e){return e})),this.buildFrom(n)},t.lookBefore=t.lookBehind,t.before=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t),n=this.if(r).list,a=n.map((function(e){var t=e.terms().map((function(e){return e.id})),n=e.match(r)[0],a=t.indexOf(n.start);return 0===a||-1===a?null:e.buildFrom(e.start,a)}));return a=a.filter((function(e){return null!==e})),this.buildFrom(a)},t.after=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t),n=this.if(r).list,a=n.map((function(e){var t=e.terms(),n=t.map((function(e){return e.id})),a=e.match(r)[0],i=n.indexOf(a.start);if(-1===i||!t[i+a.length])return null;var o=t[i+a.length].id,s=e.length-i-a.length;return e.buildFrom(o,s)}));return a=a.filter((function(e){return null!==e})),this.buildFrom(a)},t.hasAfter=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookAfter(e,t).found}))},t.hasBefore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookBefore(e,t).found}))}})),zr=function(e,t,r,n){var a=[];"string"==typeof e&&(a=e.split(" ")),t.list.forEach((function(i){var o=i.terms();!0===r&&(o=o.filter((function(r){return r.canBe(e,t.world)}))),o.forEach((function(r,i){a.length>1?a[i]&&"."!==a[i]&&r.tag(a[i],n,t.world):r.tag(e,n,t.world)}))}))},Tr={tag:function(e,t){return e?(zr(e,this,!1,t),this):this},tagSafe:function(e,t){return e?(zr(e,this,!0,t),this):this},unTag:function(e,t){var r=this;return this.list.forEach((function(n){n.terms().forEach((function(n){return n.unTag(e,t,r.world)}))})),this},canBe:function(e){if(!e)return this;var t=this.world,r=this.list.reduce((function(r,n){return r.concat(n.canBe(e,t))}),[]);return this.buildFrom(r)}},Vr={map:function(t){var r=this;if(!t)return this;var n=this.list.map((function(e,n){var a=r.buildFrom([e]);a.from=null;var i=t(a,n);return i&&i.list&&i.list[0]?i.list[0]:i}));return 0===(n=n.filter((function(e){return e}))).length?this.buildFrom(n):"object"!==e(n[0])||"Phrase"!==n[0].isA?n:this.buildFrom(n)},forEach:function(e,t){var r=this;return e?(this.list.forEach((function(n,a){var i=r.buildFrom([n]);!0===t&&(i.from=null),e(i,a)})),this):this},filter:function(e){var t=this;if(!e)return this;var r=this.list.filter((function(r,n){var a=t.buildFrom([r]);return a.from=null,e(a,n)}));return this.buildFrom(r)},find:function(e){var t=this;if(!e)return this;var r=this.list.find((function(r,n){var a=t.buildFrom([r]);return a.from=null,e(a,n)}));return r?this.buildFrom([r]):void 0},some:function(e){var t=this;return e?this.list.some((function(r,n){var a=t.buildFrom([r]);return a.from=null,e(a,n)})):this},random:function(e){if(!this.found)return this;var t=Math.floor(Math.random()*this.list.length);if(void 0===e){var r=[this.list[t]];return this.buildFrom(r)}return t+e>this.length&&(t=(t=this.length-e)<0?0:t),this.slice(t,t+e)}},Jr=function(e){return e.split(/[ -]/g)},Mr=function(e,t,r){for(var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r={};return e.forEach((function(e,n){var a=!0;void 0!==t[n]&&(a=t[n]),e=(e=(e||"").toLowerCase()).replace(/[,;.!?]+$/,"");var i=Jr(e).map((function(e){return e.trim()}));r[i[0]]=r[i[0]]||{},1===i.length?r[i[0]].value=a:(r[i[0]].more=r[i[0]].more||[],r[i[0]].more.push({rest:i.slice(1),value:a}))})),r}(e,t),a=[],i=function(e){for(var t=r.list[e],i=t.terms().map((function(e){return e.reduced})),o=function(e){void 0!==n[i[e]]&&(void 0!==n[i[e]].more&&n[i[e]].more.forEach((function(r){void 0!==i[e+r.rest.length]&&(!0===r.rest.every((function(t,r){return t===i[e+r+1]}))&&a.push({id:t.terms()[e].id,value:r.value,length:r.rest.length+1}))})),void 0!==n[i[e]].value&&a.push({id:t.terms()[e].id,value:n[i[e]].value,length:1}))},s=0;s1&&void 0!==arguments[1]?arguments[1]:{};return t?(!0===n&&(n={keepTags:!0}),!1===n&&(n={keepTags:!1}),n=n||{},this.uncache(),this.list.forEach((function(a){var i,o=t;if("function"==typeof t&&(o=t(a)),o&&"object"===e(o)&&"Doc"===o.isA)i=o.list,r.pool().merge(o.pool());else{if("string"!=typeof o)return;!1!==n.keepCase&&a.terms(0).isTitleCase()&&(o=_r(o)),i=wt(o,r.world,r.pool());var s=r.buildFrom(i);s.tagger(),i=s.list}if(!0===n.keepTags){var u=a.json({terms:{tags:!0}}).terms;i[0].terms().forEach((function(e,t){u[t]&&e.tagSafe(u[t].tags,"keptTag",r.world)}))}a.replace(i[0],r)})),this):this.delete()},replace:function(e,t,r){return void 0===t?this.replaceWith(e,r):(this.match(e).replaceWith(t,r),this)}},qr=x((function(e,t){var r=function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},n=function(e,t){var r=wt(e,t.world)[0],n=t.buildFrom([r]);return n.tagger(),t.list=n.list,t};t.append=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t?this.found?(this.uncache(),this.list.forEach((function(n){var a;r(t)&&"Doc"===t.isA?a=t.list[0].clone():"string"==typeof t&&(a=wt(t,e.world,e.pool())[0]),e.buildFrom([a]).tagger(),n.append(a,e)})),this):n(t,this):this},t.insertAfter=t.append,t.insertAt=t.append,t.prepend=function(e){var t=this;return e?this.found?(this.uncache(),this.list.forEach((function(n){var a;r(e)&&"Doc"===e.isA?a=e.list[0].clone():"string"==typeof e&&(a=wt(e,t.world,t.pool())[0]),t.buildFrom([a]).tagger(),n.prepend(a,t)})),this):n(e,this):this},t.insertBefore=t.prepend,t.concat=function(){this.uncache();for(var e=this.list.slice(0),t=0;t0&&void 0!==arguments[0]?arguments[0]:{};if("number"==typeof t&&this.list[t])return this.list[t].json(r);!0===(t=n(t)).root&&this.list.forEach((function(t){t.terms().forEach((function(t){null===t.root&&t.setRoot(e.world)}))}));var a=this.list.map((function(r){return r.json(t,e.world)}));if((t.terms.offset||t.offset||t.terms.index||t.index)&&Ur(this,a,t),t.frequency||t.freq||t.count){var i={};this.list.forEach((function(e){var t=e.text("reduced");i[t]=i[t]||0,i[t]+=1})),this.list.forEach((function(e,t){a[t].count=i[e.text("reduced")]}))}if(t.unique){var o={};a=a.filter((function(e){return!0!==o[e.reduced]&&(o[e.reduced]=!0,!0)}))}return a},t.data=t.json})),Zr=x((function(e){var t="",r=function(e,t){for(e=e.toString();e.lengtht.count?-1:e.countn?1:0},length:function(e,t){var r=e.text().trim().length,n=t.text().trim().length;return rn?-1:0},wordCount:function(e,t){var r=e.wordCount(),n=t.wordCount();return rn?-1:0}};en.alphabetical=en.alpha,en.wordcount=en.wordCount;var tn={index:!0,sequence:!0,seq:!0,sequential:!0,chron:!0,chronological:!0},rn={sort:function(e){return"freq"===(e=e||"alpha")||"frequency"===e||"topk"===e?(r={},n={case:!0,punctuation:!1,whitespace:!0,unicode:!0},(t=this).list.forEach((function(e){var t=e.text(n);r[t]=r[t]||0,r[t]+=1})),t.list.sort((function(e,t){var a=r[e.text(n)],i=r[t.text(n)];return ai?-1:0})),t):tn.hasOwnProperty(e)?function(e){var t={};return e.json({terms:{offset:!0}}).forEach((function(e){t[e.terms[0].id]=e.terms[0].offset.start})),e.list=e.list.sort((function(e,r){return t[e.start]>t[r.start]?1:t[e.start]0){a+=o;continue}}if(void 0===r[i]||!0!==r.hasOwnProperty(i))if(i===e[a].reduced||!0!==r.hasOwnProperty(e[a].reduced)){if(!0===kn.test(i)){var s=i.replace(kn,"");!0===r.hasOwnProperty(s)&&e[a].tag(r[s],"noprefix-lexicon",t)}}else e[a].tag(r[e[a].reduced],"lexicon",t);else e[a].tag(r[i],"lexicon",t)}return e},$n=/[\'‘’‛‵′`´]$/,Pn=/^(m|k|cm|km|m)\/(s|h|hr)$/,Hn=[[/^[\w\.]+@[\w\.]+\.[a-z]{2,3}$/,"Email"],[/^#[a-z0-9_\u00C0-\u00FF]{2,}$/,"HashTag"],[/^@1?[0-9](am|pm)$/i,"Time"],[/^@1?[0-9]:[0-9]{2}(am|pm)?$/i,"Time"],[/^@\w{2,}$/,"AtMention"],[/^(https?:\/\/|www\.)\w+\.[a-z]{2,3}/,"Url"],[/^[\w./]+\.(com|net|gov|org|ly|edu|info|biz|ru|jp|de|in|uk|br)/,"Url"],[/^'[0-9]{2}$/,"Year"],[/^[012]?[0-9](:[0-5][0-9])(:[0-5][0-9])$/,"Time"],[/^[012]?[0-9](:[0-5][0-9])?(:[0-5][0-9])? ?(am|pm)$/i,"Time"],[/^[012]?[0-9](:[0-5][0-9])(:[0-5][0-9])? ?(am|pm)?$/i,"Time"],[/^[PMCE]ST$/,"Time"],[/^utc ?[+-]?[0-9]+?$/,"Time"],[/^[a-z0-9]*? o\'?clock$/,"Time"],[/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}/i,"Date"],[/^[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,4}$/,"Date"],[/^[0-9]{1,4}\/[0-9]{1,2}\/[0-9]{1,4}$/,"Date"],[/^[0-9]{1,4}-[a-z]{2,9}-[0-9]{1,4}$/i,"Date"],[/^ma?c\'.*/,"LastName"],[/^o\'[drlkn].*/,"LastName"],[/^ma?cd[aeiou]/,"LastName"],[/^(lol)+[sz]$/,"Expression"],[/^woo+a*?h?$/,"Expression"],[/^(un|de|re)\\-[a-z\u00C0-\u00FF]{2}/,"Verb"],[/^[0-9]{1,4}\.[0-9]{1,2}\.[0-9]{1,4}$/,"Date"],[/^[0-9]{3}-[0-9]{4}$/,"PhoneNumber"],[/^(\+?[0-9][ -])?[0-9]{3}[ -]?[0-9]{3}-[0-9]{4}$/,"PhoneNumber"],[/^[-+]?[\$\xA2-\xA5\u058F\u060B\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20BD\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6][-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?(k|m|b|bn)?\+?$/,["Money","Value"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?[\$\xA2-\xA5\u058F\u060B\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20BD\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6]\+?$/,["Money","Value"]],[/^[-+]?[\$£]?[0-9]([0-9,.])+?(usd|eur|jpy|gbp|cad|aud|chf|cny|hkd|nzd|kr|rub)$/i,["Money","Value"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?\+?$/,["Cardinal","NumericValue"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?(st|nd|rd|r?th)$/,["Ordinal","NumericValue"]],[/^\.[0-9]+\+?$/,["Cardinal","NumericValue"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?%\+?$/,["Percent","Cardinal","NumericValue"]],[/^\.[0-9]+%$/,["Percent","Cardinal","NumericValue"]],[/^[0-9]{1,4}\/[0-9]{1,4}(st|nd|rd|th)?s?$/,["Fraction","NumericValue"]],[/^[0-9.]{1,2}[-–][0-9]{1,2}$/,["Value","NumberRange"]],[/^[0-9.]{1,3}(st|nd|rd|th)?[-–][0-9\.]{1,3}(st|nd|rd|th)?$/,"NumberRange"],[/^[0-9.]+([a-z]{1,4})$/,"Value"]],jn=/^[IVXLCDM]{2,}$/,En=/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/,Nn="Adjective",xn="Infinitive",In="PresentTense",Fn="Singular",Cn="PastTense",Bn="Adverb",On="Expression",Gn="Actor",zn="Verb",Tn="Noun",Vn="LastName",Jn={a:[[/.[aeiou]na$/,Tn],[/.[oau][wvl]ska$/,Vn],[/.[^aeiou]ica$/,Fn],[/^([hyj]a)+$/,On]],c:[[/.[^aeiou]ic$/,Nn]],d:[[/[aeiou](pp|ll|ss|ff|gg|tt|rr|bb|nn|mm)ed$/,Cn],[/.[aeo]{2}[bdgmnprvz]ed$/,Cn],[/.[aeiou][sg]hed$/,Cn],[/.[aeiou]red$/,Cn],[/.[aeiou]r?ried$/,Cn],[/.[bcdgtr]led$/,Cn],[/.[aoui]f?led$/,Cn],[/.[iao]sed$/,Cn],[/[aeiou]n?[cs]ed$/,Cn],[/[aeiou][rl]?[mnf]ed$/,Cn],[/[aeiou][ns]?c?ked$/,Cn],[/[aeiou][nl]?ged$/,Cn],[/.[tdbwxz]ed$/,Cn],[/[^aeiou][aeiou][tvx]ed$/,Cn],[/.[cdlmnprstv]ied$/,Cn],[/[^aeiou]ard$/,Fn],[/[aeiou][^aeiou]id$/,Nn],[/.[vrl]id$/,Nn]],e:[[/.[lnr]ize$/,xn],[/.[^aeiou]ise$/,xn],[/.[aeiou]te$/,xn],[/.[^aeiou][ai]ble$/,Nn],[/.[^aeiou]eable$/,Nn],[/.[ts]ive$/,Nn]],h:[[/.[^aeiouf]ish$/,Nn],[/.v[iy]ch$/,Vn],[/^ug?h+$/,On],[/^uh[ -]?oh$/,On]],i:[[/.[oau][wvl]ski$/,Vn]],k:[[/^(k){2}$/,On]],l:[[/.[gl]ial$/,Nn],[/.[^aeiou]ful$/,Nn],[/.[nrtumcd]al$/,Nn],[/.[^aeiou][ei]al$/,Nn]],m:[[/.[^aeiou]ium$/,Fn],[/[^aeiou]ism$/,Fn],[/^h*u*m+$/,On],[/^\d+ ?[ap]m$/,"Date"]],n:[[/.[lsrnpb]ian$/,Nn],[/[^aeiou]ician$/,Gn],[/[aeiou][ktrp]in$/,"Gerund"]],o:[[/^no+$/,On],[/^(yo)+$/,On],[/^woo+[pt]?$/,On]],r:[[/.[bdfklmst]ler$/,"Noun"],[/[aeiou][pns]er$/,Fn],[/[^i]fer$/,xn],[/.[^aeiou][ao]pher$/,Gn],[/.[lk]er$/,"Noun"],[/.ier$/,"Comparative"]],t:[[/.[di]est$/,"Superlative"],[/.[icldtgrv]ent$/,Nn],[/[aeiou].*ist$/,Nn],[/^[a-z]et$/,zn]],s:[[/.[^aeiou]ises$/,In],[/.[rln]ates$/,In],[/.[^z]ens$/,zn],[/.[lstrn]us$/,Fn],[/.[aeiou]sks$/,In],[/.[aeiou]kes$/,In],[/[aeiou][^aeiou]is$/,Fn],[/[a-z]\'s$/,Tn],[/^yes+$/,On]],v:[[/.[^aeiou][ai][kln]ov$/,Vn]],y:[[/.[cts]hy$/,Nn],[/.[st]ty$/,Nn],[/.[gk]y$/,Nn],[/.[tnl]ary$/,Nn],[/.[oe]ry$/,Fn],[/[rdntkbhs]ly$/,Bn],[/...lly$/,Bn],[/[bszmp]{2}y$/,Nn],[/.(gg|bb|zz)ly$/,Nn],[/.[ai]my$/,Nn],[/[ea]{2}zy$/,Nn],[/.[^aeiou]ity$/,Fn]]},Mn="Adjective",Sn="Infinitive",Ln="PresentTense",_n="Singular",Kn="PastTense",qn="Adverb",Rn="Plural",Wn="Actor",Un="Verb",Qn="Noun",Zn="LastName",Xn="Modal",Yn=[null,null,{ea:_n,ia:Qn,ic:Mn,ly:qn,"'n":Un,"'t":Un},{oed:Kn,ued:Kn,xed:Kn," so":qn,"'ll":Xn,"'re":"Copula",azy:Mn,eer:Qn,end:Un,ped:Kn,ffy:Mn,ify:Sn,ing:"Gerund",ize:Sn,lar:Mn,mum:Mn,nes:Ln,nny:Mn,oid:Mn,ous:Mn,que:Mn,rol:_n,sis:_n,zes:Ln},{amed:Kn,aped:Kn,ched:Kn,lked:Kn,nded:Kn,cted:Kn,dged:Kn,akis:Zn,cede:Sn,chuk:Zn,czyk:Zn,ects:Ln,ends:Un,enko:Zn,ette:_n,fies:Ln,fore:qn,gate:Sn,gone:Mn,ices:Rn,ints:Rn,ines:Rn,ions:Rn,less:qn,llen:Mn,made:Mn,nsen:Zn,oses:Ln,ould:Xn,some:Mn,sson:Zn,tage:Sn,teen:"Value",tion:_n,tive:Mn,tors:Qn,vice:_n},{tized:Kn,urned:Kn,eased:Kn,ances:Rn,bound:Mn,ettes:Rn,fully:qn,ishes:Ln,ities:Rn,marek:Zn,nssen:Zn,ology:Qn,ports:Rn,rough:Mn,tches:Ln,tieth:"Ordinal",tures:Rn,wards:qn,where:qn},{auskas:Zn,keeper:Wn,logist:Wn,teenth:"Value"},{opoulos:Zn,borough:"Place",sdottir:Zn}],ea={":(":!0,":)":!0,":P":!0,":p":!0,":O":!0,":3":!0,":|":!0,":/":!0,":\\":!0,":$":!0,":*":!0,":@":!0,":-(":!0,":-)":!0,":-P":!0,":-p":!0,":-O":!0,":-3":!0,":-|":!0,":-/":!0,":-\\":!0,":-$":!0,":-*":!0,":-@":!0,":^(":!0,":^)":!0,":^P":!0,":^p":!0,":^O":!0,":^3":!0,":^|":!0,":^/":!0,":^\\":!0,":^$":!0,":^*":!0,":^@":!0,"):":!0,"(:":!0,"$:":!0,"*:":!0,")-:":!0,"(-:":!0,"$-:":!0,"*-:":!0,")^:":!0,"(^:":!0,"$^:":!0,"*^:":!0,"<3":!0,"2){var a=n.clean[n.clean.length-2];if("s"===a)return void n.tag(["Possessive","Noun"],"end-tick",r);"n"===a&&n.tag(["Gerund"],"chillin",r)}Pn.test(n.text)&&n.tag("Unit","per-sec",r)},regex:function(e,t){for(var r=e.text,n=0;n=2&&jn.test(r)&&En.test(r)&&e.tag("RomanNumeral","xvii",t)},suffix:function(e,t){!function(e,t){var r=e.clean.length,n=7;r<=n&&(n=r-1);for(var a=n;a>1;a-=1){var i=e.clean.substr(r-a,r);if(!0===Yn[i.length].hasOwnProperty(i)){var o=Yn[i.length][i];e.tagSafe(o,"suffix -"+i,t);break}}}(e,t),function(e,t){var r=e.clean,n=r[r.length-1];if(!0===Jn.hasOwnProperty(n))for(var a=Jn[n],i=0;i35)}(n=(n=n.trim()).replace(/[.!?,]$/,""))&&(e.tag("Emoji","comma-emoji",t),e.text=n,e.pre=e.pre.replace(":",""),e.post=e.post.replace(":","")),e.text.match(ta)&&(e.tag("Emoji","unicode-emoji",t),e.text=n),!0===(r=(r=n).replace(/^[:;]/,":"),ea.hasOwnProperty(r))&&(e.tag("Emoticon","emoticon-emoji",t),e.text=n)}},na=function(e,t){var r=e.world;ra.lexicon(t,r);for(var n=0;n3&&void 0!==r[n]&&!0===r.hasOwnProperty(n)&&e.tag(r[n],"stem-"+n,t)}}))},pa={isSingular:[/(ax|test)is$/i,/(octop|vir|radi|nucle|fung|cact|stimul)us$/i,/(octop|vir)i$/i,/(rl)f$/i,/(alias|status)$/i,/(bu)s$/i,/(al|ad|at|er|et|ed|ad)o$/i,/(ti)um$/i,/(ti)a$/i,/sis$/i,/(?:(^f)fe|(lr)f)$/i,/hive$/i,/s[aeiou]+ns$/i,/(^aeiouy|qu)y$/i,/(x|ch|ss|sh|z)$/i,/(matr|vert|ind|cort)(ix|ex)$/i,/(m|l)ouse$/i,/(m|l)ice$/i,/(antenn|formul|nebul|vertebr|vit)a$/i,/.sis$/i,/^(?!talis|.*hu)(.*)man$/i],isPlural:[/(^v)ies$/i,/ises$/i,/ives$/i,/(antenn|formul|nebul|vertebr|vit)ae$/i,/(octop|vir|radi|nucle|fung|cact|stimul)i$/i,/(buffal|tomat|tornad)oes$/i,/(analy|ba|diagno|parenthe|progno|synop|the)ses$/i,/(vert|ind|cort)ices$/i,/(matr|append)ices$/i,/(x|ch|ss|sh|s|z|o)es$/i,/is$/i,/men$/i,/news$/i,/.tia$/i,/(^f)ves$/i,/(lr)ves$/i,/(^aeiouy|qu)ies$/i,/(m|l)ice$/i,/(cris|ax|test)es$/i,/(alias|status)es$/i,/ics$/i]},fa=["Uncountable","Pronoun","Place","Value","Person","Month","WeekDay","Holiday"],ma=[/ss$/,/sis$/,/[^aeiou][uo]s$/,/'s$/],va=[/i$/,/ae$/],ba=function(e,t){if(e.tags.Noun&&!e.tags.Acronym){var r=e.clean;if(e.tags.Singular||e.tags.Plural)return;if(r.length<=3)return void e.tag("Singular","short-singular",t);if(fa.find((function(t){return e.tags[t]})))return;if(pa.isPlural.find((function(e){return e.test(r)})))return void e.tag("Plural","plural-rules",t);if(pa.isSingular.find((function(e){return e.test(r)})))return void e.tag("Singular","singular-rules",t);if(!0===/s$/.test(r)){if(ma.find((function(e){return e.test(r)})))return;return void e.tag("Plural","plural-fallback",t)}if(va.find((function(e){return e.test(r)})))return;e.tag("Singular","singular-fallback",t)}},ya=["academy","administration","agence","agences","agencies","agency","airlines","airways","army","assoc","associates","association","assurance","authority","autorite","aviation","bank","banque","board","boys","brands","brewery","brotherhood","brothers","building society","bureau","cafe","caisse","capital","care","cathedral","center","central bank","centre","chemicals","choir","chronicle","church","circus","clinic","clinique","club","co","coalition","coffee","collective","college","commission","committee","communications","community","company","comprehensive","computers","confederation","conference","conseil","consulting","containers","corporation","corps","corp","council","crew","daily news","data","departement","department","department store","departments","design","development","directorate","division","drilling","education","eglise","electric","electricity","energy","ensemble","enterprise","enterprises","entertainment","estate","etat","evening news","faculty","federation","financial","fm","foundation","fund","gas","gazette","girls","government","group","guild","health authority","herald","holdings","hospital","hotel","hotels","inc","industries","institut","institute","institute of technology","institutes","insurance","international","interstate","investment","investments","investors","journal","laboratory","labs","liberation army","limited","local authority","local health authority","machines","magazine","management","marine","marketing","markets","media","memorial","mercantile exchange","ministere","ministry","military","mobile","motor","motors","musee","museum","news","news service","observatory","office","oil","optical","orchestra","organization","partners","partnership","people's party","petrol","petroleum","pharmacare","pharmaceutical","pharmaceuticals","pizza","plc","police","polytechnic","post","power","press","productions","quartet","radio","regional authority","regional health authority","reserve","resources","restaurant","restaurants","savings","school","securities","service","services","social club","societe","society","sons","standard","state police","state university","stock exchange","subcommittee","syndicat","systems","telecommunications","telegraph","television","times","tribunal","tv","union","university","utilities","workers"].reduce((function(e,t){return e[t]="Noun",e}),{}),wa=function(e){return!!e.tags.Noun&&(!(e.tags.Pronoun||e.tags.Comma||e.tags.Possessive)&&!!(e.tags.Organization||e.tags.Acronym||e.tags.Place||e.titleCase()))},ka=/^[A-Z]('s|,)?$/,Aa=/([A-Z]\.){2}[A-Z]?/i,Da={I:!0,A:!0},$a={neighbours:sa,case:ca,stem:ga,plural:ba,organizations:function(e,t){for(var r=0;r5)&&e.isAcronym()}(e,t)?(e.tag("Acronym","acronym-step",t),e.tag("Noun","acronym-infer",t)):!Da.hasOwnProperty(e.text)&&ka.test(e.text)&&(e.tag("Acronym","one-letter-acronym",t),e.tag("Noun","one-letter-infer",t)),e.tags.Organization&&e.text.length<=3&&e.tag("Acronym","acronym-org",t),e.tags.Organization&&e.isUpperCase()&&e.text.length<=6&&e.tag("Acronym","acronym-org-case",t))}))}},Pa=function(e,t){var r=e.world;return $a.neighbours(t,r),$a.case(e),$a.stem(t,r),t.forEach((function(t){!1===t.isKnown()&&t.tag("Noun","noun-fallback",e.world)})),$a.organizations(t,r),$a.acronyms(t,r),t.forEach((function(t){$a.plural(t,e.world)})),e},Ha=/n't$/,ja={"won't":["will","not"],wont:["will","not"],"can't":["can","not"],cant:["can","not"],cannot:["can","not"],"shan't":["should","not"],dont:["do","not"],dun:["do","not"]},Ea=function(e,t){return!0===ja.hasOwnProperty(e.clean)?ja[e.clean]:"ain't"===e.clean||"aint"===e.clean?function(e,t){var r=t.terms(),n=r.indexOf(e),a=r.slice(0,n).find((function(e){return e.tags.Noun}));return a&&a.tags.Plural?["are","not"]:["is","not"]}(e,t):!0===Ha.test(e.clean)?[e.clean.replace(Ha,""),"not"]:null},Na=/([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z]{1,2})$/i,xa={ll:"will",ve:"have",re:"are",m:"am","n't":"not"},Ia=function(e){var t=e.text.match(Na);return null===t?null:xa.hasOwnProperty(t[2])?[t[1],xa[t[2]]]:null},Fa={wanna:["want","to"],gonna:["going","to"],im:["i","am"],alot:["a","lot"],ive:["i","have"],imma:["I","will"],"where'd":["where","did"],whered:["where","did"],"when'd":["when","did"],whend:["when","did"],howd:["how","did"],whatd:["what","did"],dunno:["do","not","know"],brb:["be","right","back"],gtg:["got","to","go"],irl:["in","real","life"],tbh:["to","be","honest"],imo:["in","my","opinion"],til:["today","i","learned"],rn:["right","now"],twas:["it","was"],"@":["at"]},Ca=function(e){return Fa.hasOwnProperty(e.clean)?Fa[e.clean]:null},Ba=/([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]s$/i,Oa={that:!0,there:!0},Ga={here:!0,there:!0,everywhere:!0},za=function(e,t,r){var n=e.text.match(Ba);if(null!==n){if(!0===function(e,t){if(e.tags.Possessive)return!0;if(e.tags.Pronoun||e.tags.QuestionWord)return!1;if(Oa.hasOwnProperty(e.reduced))return!1;var r=t.get(e.next);if(!r)return!0;if(r.tags.Verb)return!!r.tags.Infinitive||!!r.tags.PresentTense;if(r.tags.Noun)return!0!==Ga.hasOwnProperty(r.reduced);var n=t.get(r.next);return!(!n||!n.tags.Noun||n.tags.Pronoun)||(r.tags.Adjective||r.tags.Adverb||r.tags.Verb,!1)}(e,t.pool))return e.tag("#Possessive","isPossessive",r),null;if(null!==n)return function(e,t){var r=t.terms(),n=r.indexOf(e);return r.slice(n+1,n+3).find((function(e){return e.tags.PastTense}))}(e,t)?[n[1],"has"]:[n[1],"is"]}return null},Ta=/[a-z\u00C0-\u00FF]'d$/,Va={how:!0,what:!0},Ja=function(e,t){if(Ta.test(e.clean)){for(var r=e.clean.replace(/'d$/,""),n=t.terms(),a=n.indexOf(e),i=n.slice(a+1,a+4),o=0;o0?fi=fi.concat(t):fi.push(e)})),fi.forEach((function(e){var t,r,n;return e.required=(t=e.reg,r=[],n=[],t.forEach((function(e){!0!==e.optional&&!0!==e.negative&&(void 0!==e.tag&&r.push(e.tag),void 0!==e.word&&n.push(e.word))})),{tags:Xa(r),words:Xa(n)}),e}));var mi=fi,vi=function(e){mi.forEach((function(t){var r=[];t.required.words.forEach((function(t){r.push(e._cache.words[t]||[])})),t.required.tags.forEach((function(t){r.push(e._cache.tags[t]||[])}));var n=function(e){if(0===e.length)return[];var t={};e.forEach((function(e){e=Xa(e);for(var r=0;r5&&e.match("#Verb+").length>=2}));if(u.found){var l=u.splitAfter("#Noun .* #Verb .* #Noun+");n=n.splitOn(l.eq(0))}return"number"==typeof t&&(n=n.get(t)),new e(n.list,this,this.world)},e},$i=function(e){var r=function(e){a(i,e);var r=u(i);function i(e,n,a){var o;return t(this,i),(o=r.call(this,e,n,a)).contracted=null,o}return n(i,[{key:"expand",value:function(){return this.list.forEach((function(e){var t=e.terms(),r=t[0].isTitleCase();t.forEach((function(e,r){e.set(e.implicit||e.text),e.implicit=void 0,r1&&void 0!==arguments[1]?arguments[1]:{},n=this.match("(#City && @hasComma) (#Region|#Country)"),a=this.not(n).splitAfter("@hasComma"),i=(a=a.concat(n)).quotations();return i.found&&(a=a.splitOn(i.eq(0))),a=a.match("#Noun+ (of|by)? the? #Noun+?"),!0!==t.keep_anaphora&&(a=(a=(a=(a=a.not("#Pronoun")).not("(there|these)")).not("(#Month|#WeekDay)")).not("(my|our|your|their|her|his)")),a=a.not("(of|for|by|the)$"),"number"==typeof e&&(a=a.get(e)),new r(a.list,this,this.world)},e},Vi=/\(/,Ji=/\)/,Mi=function(e){var r=function(e){a(i,e);var r=u(i);function i(){return t(this,i),r.apply(this,arguments)}return n(i,[{key:"unwrap",value:function(){return this.list.forEach((function(e){var t=e.terms(0);t.pre=t.pre.replace(Vi,"");var r=e.lastTerm();r.post=r.post.replace(Ji,"")})),this}}]),i}(e);return e.prototype.parentheses=function(e){var t=[];return this.list.forEach((function(e){for(var r=e.terms(),n=0;n0}}),Object.defineProperty(this,"length",{get:function(){return i.list.length}}),Object.defineProperty(this,"isA",{get:function(){return"Doc"}})}return n(e,[{key:"tagger",value:function(){return yi(this)}},{key:"pool",value:function(){return this.list.length>0?this.list[0].pool:this.all().list[0].pool}}]),e}();so.prototype.buildFrom=function(e){return e=e.map((function(e){return e.clone(!0)})),new so(e,this,this.world)},so.prototype.fromText=function(e){var t=wt(e,this.world,this.pool());return this.buildFrom(t)},Object.assign(so.prototype,oo.misc),Object.assign(so.prototype,oo.selections),io(so);var uo={untag:"unTag",and:"match",notIf:"ifNo",only:"if",onlyIf:"if"};Object.keys(uo).forEach((function(e){return so.prototype[e]=so.prototype[uo[e]]}));var lo=so,co=function(e){var t=e.termList();return Dn(t,e.world),e.world.taggers.forEach((function(t){t(e)})),e};return function e(t){var r=t,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;t&&r.addWords(t);var n=wt(e,r),a=new lo(n,null,r);return a.tagger(),a};return n.tokenize=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=r;t&&((n=n.clone()).words={},n.addWords(t));var a=wt(e,n),i=new lo(a,null,n);return(t||i.world.taggers.length>0)&&co(i),i},n.extend=function(e){return e(lo,r,this,Xe,se,et),this},n.fromJSON=function(e){var t=kt(e,r);return new lo(t,null,r)},n.clone=function(){return e(r.clone())},n.verbose=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return r.verbose(e),this},n.world=function(){return r},n.parseMatch=function(e,t){return Ke(e,t)},n.version="13.10.0",n.import=n.load,n.plugin=n.extend,n}(new Fr)})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).nlp=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;rr?n:r)+1;if(Math.abs(r-n)>(a||100))return a||100;for(var i,o,s,u,l,c,h=[],d=0;d4)return r;u=o===(s=t[i-1])?0:1,l=h[p-1][i]+1,(c=h[p][i-1]+1)1&&i>1&&o===t[i-2]&&e[p-2]===s&&(c=h[p-2][i-2]+u)2&&void 0!==arguments[2]?arguments[2]:3;if(e===t)return 1;if(e.lengtht.fuzzy)return!0;if(!0===t.soft&&(a=B(t.word,e.root))>t.fuzzy)return!0}return t.word===e.clean||t.word===e.text||t.word===e.reduced}return void 0!==t.tag?!0===e.tags[t.tag]:void 0!==t.method?"function"==typeof e[t.method]&&!0===e[t.method]():void 0!==t.regex?t.regex.test(e.clean):void 0!==t.fastOr?t.fastOr.hasOwnProperty(e.reduced)||t.fastOr.hasOwnProperty(e.text):void 0!==t.choices&&("and"===t.operator?t.choices.every((function(t){return O(e,t,r,n)})):t.choices.some((function(t){return O(e,t,r,n)})))},z=O=function(e,t,r,n){var a=G(e,t,r,n);return!0===t.negative?!a:a},T={},V={doesMatch:function(e,t,r){return z(this,e,t,r)},isAcronym:function(){return b(this.text)},isImplicit:function(){return""===this.text&&Boolean(this.implicit)},isKnown:function(){return Object.keys(this.tags).some((function(e){return!0!==T[e]}))},setRoot:function(e){var t=e.transforms,r=this.implicit||this.clean;if(this.tags.Plural&&(r=t.toSingular(r,e)),this.tags.Verb&&!this.tags.Negative&&!this.tags.Infinitive){var n=null;this.tags.PastTense?n="PastTense":this.tags.Gerund?n="Gerund":this.tags.PresentTense?n="PresentTense":this.tags.Participle?n="Participle":this.tags.Actor&&(n="Actor"),r=t.toInfinitive(r,e,n)}this.root=r}},J=/[\s-]/,M=/^[A-Z-]+$/,S={textOut:function(e,t,r){e=e||{};var n=this.text,a=this.pre,i=this.post;return!0===e.reduced&&(n=this.reduced||""),!0===e.root&&(n=this.root||""),!0===e.implicit&&this.implicit&&(n=this.implicit||""),!0===e.normal&&(n=this.clean||this.text||""),!0===e.root&&(n=this.root||this.reduced||""),!0===e.unicode&&(n=g(n)),!0===e.titlecase&&(this.tags.ProperNoun&&!this.titleCase()||(this.tags.Acronym?n=n.toUpperCase():M.test(n)&&!this.tags.Acronym&&(n=n.toLowerCase()))),!0===e.lowercase&&(n=n.toLowerCase()),!0===e.acronyms&&this.tags.Acronym&&(n=n.replace(/\./g,"")),!0!==e.whitespace&&!0!==e.root||(a="",i=" ",!1!==J.test(this.post)&&!e.last||this.implicit||(i="")),!0!==e.punctuation||e.root||(!0===this.hasPost(".")?i="."+i:!0===this.hasPost("?")?i="?"+i:!0===this.hasPost("!")?i="!"+i:!0===this.hasPost(",")?i=","+i:!0===this.hasEllipses()&&(i="..."+i)),!0!==t&&(a=""),!0!==r&&(i=""),!0===e.abbreviations&&this.tags.Abbreviation&&(i=i.replace(/^\./,"")),a+n+i}},L={Auxiliary:1,Possessive:1},_=function(e,t){var r=Object.keys(e.tags),n=t.tags;return r=r.sort((function(e,t){return L[t]||!n[t]?-1:n[t]?n[e]?n[e].lineage.length>n[t].lineage.length?1:n[e].isA.length>n[t].isA.length?-1:0:0:1}))},K={text:!0,tags:!0,implicit:!0,whitespace:!0,clean:!1,id:!1,index:!1,offset:!1,bestTag:!1},q={json:function(e,t){e=e||{};var r={};return(e=Object.assign({},K,e)).text&&(r.text=this.text),e.normal&&(r.normal=this.clean),e.tags&&(r.tags=Object.keys(this.tags)),e.clean&&(r.clean=this.clean),(e.id||e.offset)&&(r.id=this.id),e.implicit&&null!==this.implicit&&(r.implicit=this.implicit),e.whitespace&&(r.pre=this.pre,r.post=this.post),e.bestTag&&(r.bestTag=_(this,t)[0]),r}},R=Object.assign({},x,F,V,S,q);function W(){return"undefined"!=typeof window&&window.document}var Q=function(e,t){for(e=e.toString();e.length0&&void 0!==arguments[0]?arguments[0]:"";t(this,e),r=String(r);var n=I(r);this.text=n.text||"",this.clean=n.clean,this.reduced=n.reduced,this.root=null,this.implicit=null,this.pre=n.pre||"",this.post=n.post||"",this.tags={},this.prev=null,this.next=null,this.id=c(n.clean),this.isA="Term",n.alias&&(this.alias=n.alias)}return n(e,[{key:"set",value:function(e){var t=I(e);return this.text=t.text,this.clean=t.clean,this}}]),e}();oe.prototype.clone=function(){var e=new oe(this.text);return e.pre=this.pre,e.post=this.post,e.clean=this.clean,e.reduced=this.reduced,e.root=this.root,e.implicit=this.implicit,e.tags=Object.assign({},this.tags),e},Object.assign(oe.prototype,R),Object.assign(oe.prototype,ie);var se=oe,ue={terms:function(e){if(0===this.length)return[];if(this.cache.terms)return void 0!==e?this.cache.terms[e]:this.cache.terms;for(var t=[this.pool.get(this.start)],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;"string"==typeof e&&(e="normal"===e?{whitespace:!0,unicode:!0,lowercase:!0,punctuation:!0,acronyms:!0,abbreviations:!0,implicit:!0,normal:!0}:"clean"===e?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,normal:!0}:"reduced"===e?{punctuation:!1,titlecase:!1,lowercase:!0,whitespace:!0,unicode:!0,implicit:!0,reduced:!0}:"implicit"===e?{punctuation:!0,implicit:!0,whitespace:!0,trim:!0}:"root"===e?{titlecase:!1,lowercase:!0,punctuation:!0,whitespace:!0,unicode:!0,implicit:!0,root:!0}:{});var n=this.terms(),a=!1;n[0]&&null===n[0].prev&&null===n[n.length-1].next&&(a=!0);var i=n.reduce((function(i,o,s){if(0===s&&""===o.text&&null!==o.implicit&&!e.implicit)return i;e.last=r&&s===n.length-1;var u=!0,l=!0;return!1===a&&(0===s&&t&&(u=!1),s===n.length-1&&r&&(l=!1)),i+o.textOut(e,u,l)}),"");return!0===a&&r&&(i=le(i)),!0===e.trim&&(i=i.trim()),i}},he={trim:function(){var e=this.terms();if(e.length>0){e[0].pre=e[0].pre.replace(/^\s+/,"");var t=e[e.length-1];t.post=t.post.replace(/\s+$/,"")}return this}},de=/[.?!]\s*$/,ge=function(e,t){t[0].pre=e[0].pre;var r,n,a=e[e.length-1],i=t[t.length-1];i.post=(r=a.post,n=i.post,de.test(n)?n+r.match(/\s*$/):r),a.post="",""===a.post&&(a.post+=" ")},pe=function(e,t,r){var n=e.terms(),a=t.terms();ge(n,a),function(e,t,r){var n=e[e.length-1],a=t[t.length-1],i=n.next;n.next=t[0].id,a.next=i,i&&(r.get(i).prev=a.id);var o=e[0].id;o&&(t[0].prev=o)}(n,a,e.pool);var i=[e],o=e.start,s=[r];return(s=s.concat(r.parents())).forEach((function(e){var t=e.list.filter((function(e){return e.hasId(o)}));i=i.concat(t)})),(i=function(e){return e.filter((function(t,r){return e.indexOf(t)===r}))}(i)).forEach((function(e){e.length+=t.length})),e.cache={},e},fe=/ /,me=function(e,t,r){var n=e.start,a=t.terms();!function(e){var t=e[e.length-1];!1===fe.test(t.post)&&(t.post+=" ")}(a),function(e,t,r){var n=r[r.length-1];n.next=e.start;var a=e.pool,i=a.get(e.start);i.prev&&(a.get(i.prev).next=t.start),r[0].prev=e.terms(0).prev,e.terms(0).prev=n.id}(e,t,a);var i=[e],o=[r];return(o=o.concat(r.parents())).forEach((function(e){var r=e.list.filter((function(e){return e.hasId(n)||e.hasId(t.start)}));i=i.concat(r)})),(i=function(e){return e.filter((function(t,r){return e.indexOf(t)===r}))}(i)).forEach((function(e){e.length+=t.length,e.start===n&&(e.start=t.start),e.cache={}})),e},ve=function(e,t){var r=t.pool(),n=e.terms(),a=r.get(n[0].prev)||{},i=r.get(n[n.length-1].next)||{};n[0].implicit&&a.implicit&&(a.set(a.implicit),a.post+=" "),function(e,t,r,n){var a=e.parents();a.push(e),a.forEach((function(e){var a=e.list.find((function(e){return e.hasId(t)}));a&&(a.length-=r,a.start===t&&(a.start=n.id),a.cache={})})),e.list=e.list.filter((function(e){return!(!e.start||!e.length)}))}(t,e.start,e.length,i),a&&(a.next=i.id),i&&(i.prev=a.id)},be={append:function(e,t){return pe(this,e,t),this},prepend:function(e,t){return me(this,e,t),this},delete:function(e){return ve(this,e),this},replace:function(e,t){var r=this.length;pe(this,e,t);var n=this.buildFrom(this.start,this.length);n.length=r,ve(n,t)},splitOn:function(e){var t=this.terms(),r={before:null,match:null,after:null},n=t.findIndex((function(t){return t.id===e.start}));if(-1===n)return r;var a=t.slice(0,n);a.length>0&&(r.before=this.buildFrom(a[0].id,a.length));var i=t.slice(n,n+e.length);i.length>0&&(r.match=this.buildFrom(i[0].id,i.length));var o=t.slice(n+e.length,t.length);return o.length>0&&(r.after=this.buildFrom(o[0].id,o.length,this.pool)),r}},ye={json:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r={};return e.text&&(r.text=this.text()),e.normal&&(r.normal=this.text("normal")),e.clean&&(r.clean=this.text("clean")),e.reduced&&(r.reduced=this.text("reduced")),e.implicit&&(r.implicit=this.text("implicit")),e.root&&(r.root=this.text("root")),e.trim&&(r.text&&(r.text=r.text.trim()),r.normal&&(r.normal=r.normal.trim()),r.reduced&&(r.reduced=r.reduced.trim())),e.terms&&(!0===e.terms&&(e.terms={}),r.terms=this.terms().map((function(r){return r.json(e.terms,t)}))),r}},we={lookAhead:function(e){e||(e=".*");var t=this.pool,r=[],n=this.terms();return function e(n){var a=t.get(n);a&&(r.push(a),a.prev&&e(a.next))}(n[n.length-1].next),0===r.length?[]:this.buildFrom(r[0].id,r.length).match(e)},lookBehind:function(e){e||(e=".*");var t=this.pool,r=[];return function e(n){var a=t.get(n);a&&(r.push(a),a.prev&&e(a.prev))}(t.get(this.start).prev),0===r.length?[]:this.buildFrom(r[r.length-1].id,r.length).match(e)}},ke=Object.assign({},ue,ce,he,be,ye,we),Ae=function(e,t){if(0===t.length)return!0;for(var r=0;r0)return!0;if(!0===n.anything&&!0===n.negative)return!0}return!1},De=N((function(e,t){t.getGreedy=function(e,t){for(var r=Object.assign({},e.regs[e.r],{start:!1,end:!1}),n=e.t;e.t1&&void 0!==arguments[1]?arguments[1]:0,n=e.regs[e.r],a=!1,i=0;it&&(t=r.length),n}))&&t},t.getGroup=function(e,t,r){if(e.groups[e.groupId])return e.groups[e.groupId];var n=e.terms[t].id;return e.groups[e.groupId]={group:String(r),start:n,length:0},e.groups[e.groupId]}})),$e=function(e,t,r,n){for(var a={t:0,terms:e,r:0,regs:t,groups:{},start_i:r,phrase_length:n,hasGroup:!1,groupId:null,previousGroup:null};a.ra.t)return null;if(!0===i.end&&a.start_i+a.t!==n)return null}if(!0===a.hasGroup){var f=De.getGroup(a,d,i.named);a.t>1&&i.greedy?f.length+=a.t-d:f.length++}}else{if(i.negative){var m=Object.assign({},i);if(m.negative=!1,!0===a.terms[a.t].doesMatch(m,a.start_i+a.t,a.phrase_length))return null}if(!0!==i.optional){if(a.terms[a.t].isImplicit()&&t[a.r-1]&&a.terms[a.t+1]){if(a.terms[a.t-1]&&a.terms[a.t-1].implicit===t[a.r-1].word)return null;if(a.terms[a.t+1].doesMatch(i,a.start_i+a.t,a.phrase_length)){a.t+=2;continue}}return null}}}else{var v=De.greedyTo(a,t[a.r+1]);if(void 0!==i.min&&v-a.ti.max){a.t=a.t+i.max;continue}if(null===v)return null;!0===a.hasGroup&&(De.getGroup(a,a.t,i.named).length=v-a.t),a.t=v}}return{match:a.terms.slice(0,a.t),groups:a.groups}},Pe=function(e,t,r){if(!r||0===r.length)return r;if(t.some((function(e){return e.end}))){var n=e[e.length-1];r=r.filter((function(e){return-1!==e.match.indexOf(n)}))}return r},He=/\{([0-9]+,?[0-9]*)\}/,je=/&&/,Ee=new RegExp(/^<(\S+)>/),Ie=function(e){return e[e.length-1]},Ne=function(e){return e[0]},xe=function(e){return e.substr(1)},Fe=function(e){return e.substr(0,e.length-1)},Ce=function(e){return e=xe(e),e=Fe(e)},Be=function e(t){for(var r,n={},a=0;a<2;a+=1){if("$"===Ie(t)&&(n.end=!0,t=Fe(t)),"^"===Ne(t)&&(n.start=!0,t=xe(t)),("["===Ne(t)||"]"===Ie(t))&&(n.named=!0,"["===Ne(t)?n.groupType="]"===Ie(t)?"single":"start":n.groupType="end",t=(t=t.replace(/^\[/,"")).replace(/\]$/,""),"<"===Ne(t))){var i=Ee.exec(t);i.length>=2&&(n.named=i[1],t=t.replace(i[0],""))}if("+"===Ie(t)&&(n.greedy=!0,t=Fe(t)),"*"!==t&&"*"===Ie(t)&&"\\*"!==t&&(n.greedy=!0,t=Fe(t)),"?"===Ie(t)&&(n.optional=!0,t=Fe(t)),"!"===Ne(t)&&(n.negative=!0,t=xe(t)),"("===Ne(t)&&")"===Ie(t)){je.test(t)?(n.choices=t.split(je),n.operator="and"):(n.choices=t.split("|"),n.operator="or"),n.choices[0]=xe(n.choices[0]);var o=n.choices.length-1;n.choices[o]=Fe(n.choices[o]),n.choices=n.choices.map((function(e){return e.trim()})),n.choices=n.choices.filter((function(e){return e})),n.choices=n.choices.map((function(t){return t.split(/ /g).map(e)})),t=""}if("/"===Ne(t)&&"/"===Ie(t))return t=Ce(t),n.regex=new RegExp(t),n;if("~"===Ne(t)&&"~"===Ie(t))return t=Ce(t),n.soft=!0,n.word=t,n}return!0===He.test(t)&&(t=t.replace(He,(function(e,t){var r=t.split(/,/g);return 1===r.length?(n.min=Number(r[0]),n.max=Number(r[0])):(n.min=Number(r[0]),n.max=Number(r[1]||999)),n.greedy=!0,n.optional=!0,""}))),"#"===Ne(t)?(n.tag=xe(t),n.tag=(r=n.tag).charAt(0).toUpperCase()+r.substr(1),n):"@"===Ne(t)?(n.method=xe(t),n):"."===t?(n.anything=!0,n):"*"===t?(n.anything=!0,n.greedy=!0,n.optional=!0,n):(t&&(t=(t=t.replace("\\*","*")).replace("\\.","."),n.word=t.toLowerCase()),n)},Oe=function(e){for(var t,r=!1,n=-1,a=0;a1&&void 0!==arguments[1]?arguments[1]:{},r=e.filter((function(e){return e.groupType})).length;return r>0&&(e=Oe(e)),t.fuzzy||(e=Ge(e)),e},Te=/[^[a-z]]\//g,Ve=function(e){return"[object Array]"===Object.prototype.toString.call(e)},Je=function(e){var t=e.split(/([\^\[\!]*(?:<\S+>)?\(.*?\)[?+*]*\]?\$?)/);return t=t.map((function(e){return e.trim()})),Te.test(e)&&(t=function(e){return e.forEach((function(t,r){var n=t.match(Te);null!==n&&1===n.length&&e[r+1]&&(e[r]+=e[r+1],e[r+1]="",null!==(n=e[r].match(Te))&&1===n.length&&(e[r]+=e[r+2],e[r+2]=""))})),e=e.filter((function(e){return e}))}(t)),t},Me=function(e){var t=[];return e.forEach((function(e){if(/\(.*\)/.test(e))t.push(e);else{var r=e.split(" ");r=r.filter((function(e){return e})),t=t.concat(r)}})),t},Se=function(e){return[{choices:e.map((function(e){return[{word:e}]})),operator:"or"}]},Le=function(e){if(!e||!e.list||!e.list[0])return[];var t=[];return e.list.forEach((function(e){var r=[];e.terms().forEach((function(e){r.push(e.id)})),t.push(r)})),[{idBlocks:t}]},_e=function(e,t){return!0===t.fuzzy&&(t.fuzzy=.85),"number"==typeof t.fuzzy&&(e=e.map((function(e){return t.fuzzy>0&&e.word&&(e.fuzzy=t.fuzzy),e.choices&&e.choices.forEach((function(e){e.forEach((function(e){e.fuzzy=t.fuzzy}))})),e}))),e},Ke=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||""===t)return[];if("object"===e(t)){if(Ve(t)){if(0===t.length||!t[0])return[];if("object"===e(t[0]))return t;if("string"==typeof t[0])return Se(t)}return t&&"Doc"===t.isA?Le(t):[]}"number"==typeof t&&(t=String(t));var n=Je(t);return n=(n=Me(n)).map((function(e){return Be(e)})),n=ze(n,r),n=_e(n,r)},qe=function(e,t){for(var r=[],n=t[0].idBlocks,a=function(t){n.forEach((function(n){0!==n.length?n.every((function(r,n){return i=t,e[t+n].id===r}))&&(r.push({match:e.slice(t,t+n.length)}),t+=n.length-1):i=t})),i=t},i=0;i2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof t&&(t=Ke(t)),!0===Ae(e,t))return[];var n=t.filter((function(e){return!0!==e.optional&&!0!==e.negative})).length,a=e.terms(),i=[];if(t[0].idBlocks){var o=qe(a,t);if(o&&o.length>0)return Pe(a,t,o)}if(!0===t[0].start){var s=$e(a,t,0,a.length);return s&&s.match&&s.match.length>0&&(s.match=s.match.filter((function(e){return e})),i.push(s)),Pe(a,t,i)}for(var u=0;ua.length);u+=1){var l=$e(a.slice(u),t,u,a.length);if(l&&l.match&&l.match.length>0&&(u+=l.match.length-1,l.match=l.match.filter((function(e){return e})),i.push(l),!0===r))return Pe(a,t,i)}return Pe(a,t,i)},We=function(e,t){var r={};Re(e,t).forEach((function(e){e.match.forEach((function(e){r[e.id]=!0}))}));var n=e.terms(),a=[],i=[];return n.forEach((function(e){!0!==r[e.id]?i.push(e):i.length>0&&(a.push(i),i=[])})),i.length>0&&a.push(i),a},Qe={match:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Re(this,e,r);return n=n.map((function(e){var r=e.match,n=e.groups,a=t.buildFrom(r[0].id,r.length,n);return a.cache.terms=r,a}))},has:function(e){return Re(this,e,!0).length>0},not:function(e){var t=this,r=We(this,e);return r=r.map((function(e){return t.buildFrom(e[0].id,e.length)}))},canBe:function(e,t){for(var r=this,n=[],a=this.terms(),i=!1,o=0;o0})).map((function(e){return r.buildFrom(e[0].id,e.length)}))}},Ue=function e(r,n,a){t(this,e),this.start=r,this.length=n,this.isA="Phrase",Object.defineProperty(this,"pool",{enumerable:!1,writable:!0,value:a}),Object.defineProperty(this,"cache",{enumerable:!1,writable:!0,value:{}}),Object.defineProperty(this,"groups",{enumerable:!1,writable:!0,value:{}})};Ue.prototype.buildFrom=function(e,t,r){var n=new Ue(e,t,this.pool);return r&&Object.keys(r).length>0?n.groups=r:n.groups=this.groups,n},Object.assign(Ue.prototype,Qe),Object.assign(Ue.prototype,ke);var Ze={term:"terms"};Object.keys(Ze).forEach((function(e){return Ue.prototype[e]=Ue.prototype[Ze[e]]}));var Xe=Ue,Ye=function(){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),Object.defineProperty(this,"words",{enumerable:!1,value:r})}return n(e,[{key:"add",value:function(e){return this.words[e.id]=e,this}},{key:"get",value:function(e){return this.words[e]}},{key:"remove",value:function(e){delete this.words[e]}},{key:"merge",value:function(e){return Object.assign(this.words,e.words),this}},{key:"stats",value:function(){return{words:Object.keys(this.words).length}}}]),e}();Ye.prototype.clone=function(){var e=this,t=Object.keys(this.words).reduce((function(t,r){var n=e.words[r].clone();return t[n.id]=n,t}),{});return new Ye(t)};var et=Ye,tt=function(e){e.forEach((function(t,r){r>0&&(t.prev=e[r-1].id),e[r+1]&&(t.next=e[r+1].id)}))},rt=/(\S.+?[.!?\u203D\u2E18\u203C\u2047-\u2049])(?=\s+|$)/g,nt=/\S/,at=/[ .][A-Z]\.? *$/i,it=/(?:\u2026|\.{2,}) *$/,ot=/((?:\r?\n|\r)+)/,st=/[a-z0-9\u00C0-\u00FF\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/i,ut=/^\s+/,lt=function(e,t){if(!0===at.test(e))return!1;if(!0===it.test(e))return!1;if(!1===st.test(e))return!1;var r=e.replace(/[.!?\u203D\u2E18\u203C\u2047-\u2049] *$/,"").split(" "),n=r[r.length-1].toLowerCase();return!t.hasOwnProperty(n)},ct=function(e,t){var r=t.cache.abbreviations;e=e||"";var n=[],a=[];if(!(e=String(e))||"string"!=typeof e||!1===nt.test(e))return n;for(var i=function(e){for(var t=[],r=e.split(ot),n=0;n0&&(n.push(l),a[u]="")}if(0===n.length)return[e];for(var c=1;c0?(t[t.length-1]+=i,t.push(s)):t.push(i+s),i=""):i+=s}return i&&(0===t.length&&(t[0]=""),t[t.length-1]+=i),t=(t=function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=null;"string"!=typeof e&&("number"==typeof e?e=String(e):yt(e)&&(n=e)),n=(n=n||ct(e,t)).map((function(e){return bt(e)})),r=r||new et;var a=n.map((function(e){e=e.map((function(e){var t=new se(e);return r.add(t),t})),tt(e);var t=new Xe(e[0].id,e.length,r);return t.cache.terms=e,t}));return a},kt=function(e,t){var r=new et;return e.map((function(e,n){var a=e.terms.map((function(a,i){var o=new se(a.text);return o.pre=void 0!==a.pre?a.pre:"",void 0===a.post&&(a.post=" ",i>=e.terms.length-1&&(a.post=". ",n>=e.terms.length-1&&(a.post="."))),o.post=void 0!==a.post?a.post:" ",a.tags&&a.tags.forEach((function(e){return o.tag(e,"",t)})),r.add(o),o}));return tt(a),new Xe(a[0].id,a.length,r)}))},At=["Person","Place","Organization"],Dt={Noun:{notA:["Verb","Adjective","Adverb"]},Singular:{isA:"Noun",notA:"Plural"},ProperNoun:{isA:"Noun"},Person:{isA:["ProperNoun","Singular"],notA:["Place","Organization","Date"]},FirstName:{isA:"Person"},MaleName:{isA:"FirstName",notA:["FemaleName","LastName"]},FemaleName:{isA:"FirstName",notA:["MaleName","LastName"]},LastName:{isA:"Person",notA:["FirstName"]},NickName:{isA:"Person",notA:["FirstName","LastName"]},Honorific:{isA:"Noun",notA:["FirstName","LastName","Value"]},Place:{isA:"Singular",notA:["Person","Organization"]},Country:{isA:["Place","ProperNoun"],notA:["City"]},City:{isA:["Place","ProperNoun"],notA:["Country"]},Region:{isA:["Place","ProperNoun"]},Address:{isA:"Place"},Organization:{isA:["Singular","ProperNoun"],notA:["Person","Place"]},SportsTeam:{isA:"Organization"},School:{isA:"Organization"},Company:{isA:"Organization"},Plural:{isA:"Noun",notA:["Singular"]},Uncountable:{isA:"Noun"},Pronoun:{isA:"Noun",notA:At},Actor:{isA:"Noun",notA:At},Activity:{isA:"Noun",notA:["Person","Place"]},Unit:{isA:"Noun",notA:At},Demonym:{isA:["Noun","ProperNoun"],notA:At},Possessive:{isA:"Noun"}},$t={Verb:{notA:["Noun","Adjective","Adverb","Value"]},PresentTense:{isA:"Verb",notA:["PastTense","FutureTense"]},Infinitive:{isA:"PresentTense",notA:["PastTense","Gerund"]},Imperative:{isA:"Infinitive"},Gerund:{isA:"PresentTense",notA:["PastTense","Copula","FutureTense"]},PastTense:{isA:"Verb",notA:["FutureTense"]},FutureTense:{isA:"Verb"},Copula:{isA:"Verb"},Modal:{isA:"Verb",notA:["Infinitive"]},PerfectTense:{isA:"Verb",notA:"Gerund"},Pluperfect:{isA:"Verb"},Participle:{isA:"PastTense"},PhrasalVerb:{isA:"Verb"},Particle:{isA:"PhrasalVerb"},Auxiliary:{notA:["Noun","Adjective","Value"]}},Pt={Value:{notA:["Verb","Adjective","Adverb"]},Ordinal:{isA:"Value",notA:["Cardinal"]},Cardinal:{isA:"Value",notA:["Ordinal"]},Fraction:{isA:"Value",notA:["Noun"]},RomanNumeral:{isA:"Cardinal",notA:["Ordinal","TextValue"]},TextValue:{isA:"Value",notA:["NumericValue"]},NumericValue:{isA:"Value",notA:["TextValue"]},Money:{isA:"Cardinal"},Percent:{isA:"Value"}},Ht=["Noun","Verb","Adjective","Adverb","Value","QuestionWord"],jt={Adjective:{notA:["Noun","Verb","Adverb","Value"]},Comparable:{isA:["Adjective"]},Comparative:{isA:["Adjective"]},Superlative:{isA:["Adjective"],notA:["Comparative"]},NumberRange:{isA:["Contraction"]},Adverb:{notA:["Noun","Verb","Adjective","Value"]},Date:{notA:["Verb","Adverb","Preposition","Adjective"]},Month:{isA:["Date","Singular"],notA:["Year","WeekDay","Time"]},WeekDay:{isA:["Date","Noun"]},Time:{isA:["Date"],notA:["AtMention"]},Determiner:{notA:Ht},Conjunction:{notA:Ht},Preposition:{notA:Ht},QuestionWord:{notA:["Determiner"]},Currency:{isA:["Noun"]},Expression:{notA:["Noun","Adjective","Verb","Adverb"]},Abbreviation:{},Url:{notA:["HashTag","PhoneNumber","Verb","Adjective","Value","AtMention","Email"]},PhoneNumber:{notA:["HashTag","Verb","Adjective","Value","AtMention","Email"]},HashTag:{},AtMention:{isA:["Noun"],notA:["HashTag","Verb","Adjective","Value","Email"]},Emoji:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Emoticon:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Email:{notA:["HashTag","Verb","Adjective","Value","AtMention"]},Acronym:{notA:["Plural","RomanNumeral"]},Negative:{notA:["Noun","Adjective","Value"]},Condition:{notA:["Verb","Adjective","Noun","Value"]}},Et={Noun:"blue",Verb:"green",Negative:"green",Date:"red",Value:"red",Adjective:"magenta",Preposition:"cyan",Conjunction:"cyan",Determiner:"cyan",Adverb:"cyan"},It=function(e){return Object.keys(e).forEach((function(t){e[t].color?e[t].color=e[t].color:Et[t]?e[t].color=Et[t]:e[t].isA.some((function(r){return!!Et[r]&&(e[t].color=Et[r],!0)}))})),e},Nt=function(e){return Object.keys(e).forEach((function(t){for(var r=e[t],n=r.isA.length,a=0;a=0;i--,a*=36){var o=e.charCodeAt(i)-48;o>10&&(o-=7),t+=o*a}return t},Jt=function(e,t,r){var n=Vt(t);return n1&&(r.hasCompound[i[0]]=!0),void 0===_t[a]?void 0!==t[n]?("string"==typeof t[n]&&(t[n]=[t[n]]),"string"==typeof a?t[n].push(a):t[n]=t[n].concat(a)):t[n]=a:_t[a](t,n,r)}))},qt=function(e){var t=Object.assign({},Lt);return Object.keys(Gt).forEach((function(r){var n=St(Gt[r]);Object.keys(n).forEach((function(e){n[e]=r})),Kt(n,t,e)})),t},Rt=Kt,Wt=function(e){for(var t=e.irregulars.nouns,r=Object.keys(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=e[e.length-1];if(!0===tr.hasOwnProperty(t))for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r={};return t&&t.irregulars&&!0===t.irregulars.verbs.hasOwnProperty(e)&&(r=Object.assign({},t.irregulars.verbs[e])),void 0===(r=Object.assign({},ar(e),r)).Gerund&&(r.Gerund=or.Gerund(e)),void 0===r.PastTense&&(r.PastTense=or.PastTense(e)),void 0===r.PresentTense&&(r.PresentTense=or.PresentTense(e)),r},ur=[/ght$/,/nge$/,/ough$/,/ain$/,/uel$/,/[au]ll$/,/ow$/,/oud$/,/...p$/],lr=[/ary$/],cr={nice:"nicest",late:"latest",hard:"hardest",inner:"innermost",outer:"outermost",far:"furthest",worse:"worst",bad:"worst",good:"best",big:"biggest",large:"largest"},hr=[{reg:/y$/i,repl:"iest"},{reg:/([aeiou])t$/i,repl:"$1ttest"},{reg:/([aeou])de$/i,repl:"$1dest"},{reg:/nge$/i,repl:"ngest"},{reg:/([aeiou])te$/i,repl:"$1test"}],dr=[/ght$/,/nge$/,/ough$/,/ain$/,/uel$/,/[au]ll$/,/ow$/,/old$/,/oud$/,/e[ae]p$/],gr=[/ary$/,/ous$/],pr={grey:"greyer",gray:"grayer",green:"greener",yellow:"yellower",red:"redder",good:"better",well:"better",bad:"worse",sad:"sadder",big:"bigger"},fr=[{reg:/y$/i,repl:"ier"},{reg:/([aeiou])t$/i,repl:"$1tter"},{reg:/([aeou])de$/i,repl:"$1der"},{reg:/nge$/i,repl:"nger"}],mr={toSuperlative:function(e){if(cr.hasOwnProperty(e))return cr[e];for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=t.irregulars.nouns;if(r.hasOwnProperty(e))return r[e];var n=wr(e);return null!==n?n:yr.test(e)?e+"es":e+"s"},Ar=[[/([^v])ies$/i,"$1y"],[/ises$/i,"isis"],[/(kn|[^o]l|w)ives$/i,"$1ife"],[/^((?:ca|e|ha|(?:our|them|your)?se|she|wo)l|lea|loa|shea|thie)ves$/i,"$1f"],[/^(dwar|handkerchie|hoo|scar|whar)ves$/i,"$1f"],[/(antenn|formul|nebul|vertebr|vit)ae$/i,"$1a"],[/(octop|vir|radi|nucle|fung|cact|stimul)(i)$/i,"$1us"],[/(buffal|tomat|tornad)(oes)$/i,"$1o"],[/(eas)es$/i,"$1e"],[/(..[aeiou]s)es$/i,"$1"],[/(vert|ind|cort)(ices)$/i,"$1ex"],[/(matr|append)(ices)$/i,"$1ix"],[/(x|ch|ss|sh|z|o)es$/i,"$1"],[/men$/i,"man"],[/(n)ews$/i,"$1ews"],[/([ti])a$/i,"$1um"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/(s)eries$/i,"$1eries"],[/(m)ovies$/i,"$1ovie"],[/([m|l])ice$/i,"$1ouse"],[/(cris|ax|test)es$/i,"$1is"],[/(alias|status)es$/i,"$1"],[/(ss)$/i,"$1"],[/(ics)$/i,"$1"],[/s$/i,""]],Dr=function(e,t){var r,n=t.irregulars.nouns,a=(r=n,Object.keys(r).reduce((function(e,t){return e[r[t]]=t,e}),{}));if(a.hasOwnProperty(e))return a[e];for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof t&&"number"!=typeof t&&null!==t||(t={group:t});var r=Ke(e,t);if(0===r.length)return this.buildFrom([]);if(!1===Or(this,r))return this.buildFrom([]);var n=this.list.reduce((function(e,t){return e.concat(t.match(r))}),[]);return void 0!==t.group&&null!==t.group&&""!==t.group?this.buildFrom(n).groups(t.group):this.buildFrom(n)},t.not=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);if(0===r.length||!1===Or(this,r))return this;var n=this.list.reduce((function(e,t){return e.concat(t.not(r))}),[]);return this.buildFrom(n)},t.matchOne=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);if(!1===Or(this,r))return this.buildFrom([]);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);if(!1===Or(this,r))return this.buildFrom([]);var n=this.list.filter((function(e){return!0===e.has(r)}));return this.buildFrom(n)},t.ifNo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t),n=this.list.filter((function(e){return!1===e.has(r)}));return this.buildFrom(n)},t.has=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t);return!1!==Or(this,r)&&this.list.some((function(e){return!0===e.has(r)}))},t.lookAhead=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e||(e=".*");var r=Ke(e,t),n=[];return this.list.forEach((function(e){n=n.concat(e.lookAhead(r))})),n=n.filter((function(e){return e})),this.buildFrom(n)},t.lookAfter=t.lookAhead,t.lookBehind=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e||(e=".*");var r=Ke(e,t),n=[];return this.list.forEach((function(e){n=n.concat(e.lookBehind(r))})),n=n.filter((function(e){return e})),this.buildFrom(n)},t.lookBefore=t.lookBehind,t.before=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t),n=this.if(r).list,a=n.map((function(e){var t=e.terms().map((function(e){return e.id})),n=e.match(r)[0],a=t.indexOf(n.start);return 0===a||-1===a?null:e.buildFrom(e.start,a)}));return a=a.filter((function(e){return null!==e})),this.buildFrom(a)},t.after=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ke(e,t),n=this.if(r).list,a=n.map((function(e){var t=e.terms(),n=t.map((function(e){return e.id})),a=e.match(r)[0],i=n.indexOf(a.start);if(-1===i||!t[i+a.length])return null;var o=t[i+a.length].id,s=e.length-i-a.length;return e.buildFrom(o,s)}));return a=a.filter((function(e){return null!==e})),this.buildFrom(a)},t.hasAfter=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookAfter(e,t).found}))},t.hasBefore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.filter((function(r){return r.lookBefore(e,t).found}))}})),zr=function(e,t,r,n){var a=[];"string"==typeof e&&(a=e.split(" ")),t.list.forEach((function(i){var o=i.terms();!0===r&&(o=o.filter((function(r){return r.canBe(e,t.world)}))),o.forEach((function(r,i){a.length>1?a[i]&&"."!==a[i]&&r.tag(a[i],n,t.world):r.tag(e,n,t.world)}))}))},Tr={tag:function(e,t){return e?(zr(e,this,!1,t),this):this},tagSafe:function(e,t){return e?(zr(e,this,!0,t),this):this},unTag:function(e,t){var r=this;return this.list.forEach((function(n){n.terms().forEach((function(n){return n.unTag(e,t,r.world)}))})),this},canBe:function(e){if(!e)return this;var t=this.world,r=this.list.reduce((function(r,n){return r.concat(n.canBe(e,t))}),[]);return this.buildFrom(r)}},Vr={map:function(t){var r=this;if(!t)return this;var n=this.list.map((function(e,n){var a=r.buildFrom([e]);a.from=null;var i=t(a,n);return i&&i.list&&i.list[0]?i.list[0]:i}));return 0===(n=n.filter((function(e){return e}))).length?this.buildFrom(n):"object"!==e(n[0])||"Phrase"!==n[0].isA?n:this.buildFrom(n)},forEach:function(e,t){var r=this;return e?(this.list.forEach((function(n,a){var i=r.buildFrom([n]);!0===t&&(i.from=null),e(i,a)})),this):this},filter:function(e){var t=this;if(!e)return this;var r=this.list.filter((function(r,n){var a=t.buildFrom([r]);return a.from=null,e(a,n)}));return this.buildFrom(r)},find:function(e){var t=this;if(!e)return this;var r=this.list.find((function(r,n){var a=t.buildFrom([r]);return a.from=null,e(a,n)}));return r?this.buildFrom([r]):void 0},some:function(e){var t=this;return e?this.list.some((function(r,n){var a=t.buildFrom([r]);return a.from=null,e(a,n)})):this},random:function(e){if(!this.found)return this;var t=Math.floor(Math.random()*this.list.length);if(void 0===e){var r=[this.list[t]];return this.buildFrom(r)}return t+e>this.length&&(t=(t=this.length-e)<0?0:t),this.slice(t,t+e)}},Jr=function(e){return e.split(/[ -]/g)},Mr=function(e,t,r){for(var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r={};return e.forEach((function(e,n){var a=!0;void 0!==t[n]&&(a=t[n]),e=(e=(e||"").toLowerCase()).replace(/[,;.!?]+$/,"");var i=Jr(e).map((function(e){return e.trim()}));r[i[0]]=r[i[0]]||{},1===i.length?r[i[0]].value=a:(r[i[0]].more=r[i[0]].more||[],r[i[0]].more.push({rest:i.slice(1),value:a}))})),r}(e,t),a=[],i=function(e){for(var t=r.list[e],i=t.terms().map((function(e){return e.reduced})),o=function(e){void 0!==n[i[e]]&&(void 0!==n[i[e]].more&&n[i[e]].more.forEach((function(r){void 0!==i[e+r.rest.length]&&(!0===r.rest.every((function(t,r){return t===i[e+r+1]}))&&a.push({id:t.terms()[e].id,value:r.value,length:r.rest.length+1}))})),void 0!==n[i[e]].value&&a.push({id:t.terms()[e].id,value:n[i[e]].value,length:1}))},s=0;s1&&void 0!==arguments[1]?arguments[1]:{};return t?(!0===n&&(n={keepTags:!0}),!1===n&&(n={keepTags:!1}),n=n||{},this.uncache(),this.list.forEach((function(a){var i,o=t;if("function"==typeof t&&(o=t(a)),o&&"object"===e(o)&&"Doc"===o.isA)i=o.list,r.pool().merge(o.pool());else{if("string"!=typeof o)return;!1!==n.keepCase&&a.terms(0).isTitleCase()&&(o=_r(o)),i=wt(o,r.world,r.pool());var s=r.buildFrom(i);s.tagger(),i=s.list}if(!0===n.keepTags){var u=a.json({terms:{tags:!0}}).terms;i[0].terms().forEach((function(e,t){u[t]&&e.tagSafe(u[t].tags,"keptTag",r.world)}))}a.replace(i[0],r)})),this):this.delete()},replace:function(e,t,r){return void 0===t?this.replaceWith(e,r):(this.match(e).replaceWith(t,r),this)}},qr=N((function(e,t){var r=function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},n=function(e,t){var r=wt(e,t.world)[0],n=t.buildFrom([r]);return n.tagger(),t.list=n.list,t};t.append=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t?this.found?(this.uncache(),this.list.forEach((function(n){var a;r(t)&&"Doc"===t.isA?a=t.list[0].clone():"string"==typeof t&&(a=wt(t,e.world,e.pool())[0]),e.buildFrom([a]).tagger(),n.append(a,e)})),this):n(t,this):this},t.insertAfter=t.append,t.insertAt=t.append,t.prepend=function(e){var t=this;return e?this.found?(this.uncache(),this.list.forEach((function(n){var a;r(e)&&"Doc"===e.isA?a=e.list[0].clone():"string"==typeof e&&(a=wt(e,t.world,t.pool())[0]),t.buildFrom([a]).tagger(),n.prepend(a,t)})),this):n(e,this):this},t.insertBefore=t.prepend,t.concat=function(){this.uncache();for(var e=this.list.slice(0),t=0;t0&&void 0!==arguments[0]?arguments[0]:{};if("number"==typeof t&&this.list[t])return this.list[t].json(r);!0===(t=n(t)).root&&this.list.forEach((function(t){t.terms().forEach((function(t){null===t.root&&t.setRoot(e.world)}))}));var a=this.list.map((function(r){return r.json(t,e.world)}));if((t.terms.offset||t.offset||t.terms.index||t.index)&&Qr(this,a,t),t.frequency||t.freq||t.count){var i={};this.list.forEach((function(e){var t=e.text("reduced");i[t]=i[t]||0,i[t]+=1})),this.list.forEach((function(e,t){a[t].count=i[e.text("reduced")]}))}if(t.unique){var o={};a=a.filter((function(e){return!0!==o[e.reduced]&&(o[e.reduced]=!0,!0)}))}return a},t.data=t.json})),Zr=N((function(e){var t="",r=function(e,t){for(e=e.toString();e.lengtht.count?-1:e.countn?1:0},length:function(e,t){var r=e.text().trim().length,n=t.text().trim().length;return rn?-1:0},wordCount:function(e,t){var r=e.wordCount(),n=t.wordCount();return rn?-1:0}};en.alphabetical=en.alpha,en.wordcount=en.wordCount;var tn={index:!0,sequence:!0,seq:!0,sequential:!0,chron:!0,chronological:!0},rn={sort:function(e){return"freq"===(e=e||"alpha")||"frequency"===e||"topk"===e?(r={},n={case:!0,punctuation:!1,whitespace:!0,unicode:!0},(t=this).list.forEach((function(e){var t=e.text(n);r[t]=r[t]||0,r[t]+=1})),t.list.sort((function(e,t){var a=r[e.text(n)],i=r[t.text(n)];return ai?-1:0})),t):tn.hasOwnProperty(e)?function(e){var t={};return e.json({terms:{offset:!0}}).forEach((function(e){t[e.terms[0].id]=e.terms[0].offset.start})),e.list=e.list.sort((function(e,r){return t[e.start]>t[r.start]?1:t[e.start]0){a+=o;continue}}if(void 0===r[i]||!0!==r.hasOwnProperty(i))if(i===e[a].reduced||!0!==r.hasOwnProperty(e[a].reduced)){if(!0===kn.test(i)){var s=i.replace(kn,"");!0===r.hasOwnProperty(s)&&e[a].tag(r[s],"noprefix-lexicon",t)}}else e[a].tag(r[e[a].reduced],"lexicon",t);else e[a].tag(r[i],"lexicon",t)}return e},$n=/[\'‘’‛‵′`´]$/,Pn=/^(m|k|cm|km|m)\/(s|h|hr)$/,Hn=[[/^[\w\.]+@[\w\.]+\.[a-z]{2,3}$/,"Email"],[/^#[a-z0-9_\u00C0-\u00FF]{2,}$/,"HashTag"],[/^@1?[0-9](am|pm)$/i,"Time"],[/^@1?[0-9]:[0-9]{2}(am|pm)?$/i,"Time"],[/^@\w{2,}$/,"AtMention"],[/^(https?:\/\/|www\.)\w+\.[a-z]{2,3}/,"Url"],[/^[\w./]+\.(com|net|gov|org|ly|edu|info|biz|ru|jp|de|in|uk|br)/,"Url"],[/^'[0-9]{2}$/,"Year"],[/^[012]?[0-9](:[0-5][0-9])(:[0-5][0-9])$/,"Time"],[/^[012]?[0-9](:[0-5][0-9])?(:[0-5][0-9])? ?(am|pm)$/i,"Time"],[/^[012]?[0-9](:[0-5][0-9])(:[0-5][0-9])? ?(am|pm)?$/i,"Time"],[/^[PMCE]ST$/,"Time"],[/^utc ?[+-]?[0-9]+?$/,"Time"],[/^[a-z0-9]*? o\'?clock$/,"Time"],[/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}/i,"Date"],[/^[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,4}$/,"Date"],[/^[0-9]{1,4}\/[0-9]{1,2}\/[0-9]{1,4}$/,"Date"],[/^[0-9]{1,4}-[a-z]{2,9}-[0-9]{1,4}$/i,"Date"],[/^ma?c\'.*/,"LastName"],[/^o\'[drlkn].*/,"LastName"],[/^ma?cd[aeiou]/,"LastName"],[/^(lol)+[sz]$/,"Expression"],[/^woo+a*?h?$/,"Expression"],[/^(un|de|re)\\-[a-z\u00C0-\u00FF]{2}/,"Verb"],[/^[0-9]{1,4}\.[0-9]{1,2}\.[0-9]{1,4}$/,"Date"],[/^[0-9]{3}-[0-9]{4}$/,"PhoneNumber"],[/^(\+?[0-9][ -])?[0-9]{3}[ -]?[0-9]{3}-[0-9]{4}$/,"PhoneNumber"],[/^[-+]?[\$\xA2-\xA5\u058F\u060B\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20BD\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6][-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?(k|m|b|bn)?\+?$/,["Money","Value"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?[\$\xA2-\xA5\u058F\u060B\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20BD\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6]\+?$/,["Money","Value"]],[/^[-+]?[\$£]?[0-9]([0-9,.])+?(usd|eur|jpy|gbp|cad|aud|chf|cny|hkd|nzd|kr|rub)$/i,["Money","Value"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?\+?$/,["Cardinal","NumericValue"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?(st|nd|rd|r?th)$/,["Ordinal","NumericValue"]],[/^\.[0-9]+\+?$/,["Cardinal","NumericValue"]],[/^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?%\+?$/,["Percent","Cardinal","NumericValue"]],[/^\.[0-9]+%$/,["Percent","Cardinal","NumericValue"]],[/^[0-9]{1,4}\/[0-9]{1,4}(st|nd|rd|th)?s?$/,["Fraction","NumericValue"]],[/^[0-9.]{1,2}[-–][0-9]{1,2}$/,["Value","NumberRange"]],[/^[0-9.]{1,3}(st|nd|rd|th)?[-–][0-9\.]{1,3}(st|nd|rd|th)?$/,"NumberRange"],[/^[0-9.]+([a-z]{1,4})$/,"Value"]],jn=/^[IVXLCDM]{2,}$/,En=/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/,In="Adjective",Nn="Infinitive",xn="PresentTense",Fn="Singular",Cn="PastTense",Bn="Adverb",On="Expression",Gn="Actor",zn="Verb",Tn="Noun",Vn="LastName",Jn={a:[[/.[aeiou]na$/,Tn],[/.[oau][wvl]ska$/,Vn],[/.[^aeiou]ica$/,Fn],[/^([hyj]a)+$/,On]],c:[[/.[^aeiou]ic$/,In]],d:[[/[aeiou](pp|ll|ss|ff|gg|tt|rr|bb|nn|mm)ed$/,Cn],[/.[aeo]{2}[bdgmnprvz]ed$/,Cn],[/.[aeiou][sg]hed$/,Cn],[/.[aeiou]red$/,Cn],[/.[aeiou]r?ried$/,Cn],[/.[bcdgtr]led$/,Cn],[/.[aoui]f?led$/,Cn],[/.[iao]sed$/,Cn],[/[aeiou]n?[cs]ed$/,Cn],[/[aeiou][rl]?[mnf]ed$/,Cn],[/[aeiou][ns]?c?ked$/,Cn],[/[aeiou][nl]?ged$/,Cn],[/.[tdbwxz]ed$/,Cn],[/[^aeiou][aeiou][tvx]ed$/,Cn],[/.[cdlmnprstv]ied$/,Cn],[/[^aeiou]ard$/,Fn],[/[aeiou][^aeiou]id$/,In],[/.[vrl]id$/,In]],e:[[/.[lnr]ize$/,Nn],[/.[^aeiou]ise$/,Nn],[/.[aeiou]te$/,Nn],[/.[^aeiou][ai]ble$/,In],[/.[^aeiou]eable$/,In],[/.[ts]ive$/,In]],h:[[/.[^aeiouf]ish$/,In],[/.v[iy]ch$/,Vn],[/^ug?h+$/,On],[/^uh[ -]?oh$/,On]],i:[[/.[oau][wvl]ski$/,Vn]],k:[[/^(k){2}$/,On]],l:[[/.[gl]ial$/,In],[/.[^aeiou]ful$/,In],[/.[nrtumcd]al$/,In],[/.[^aeiou][ei]al$/,In]],m:[[/.[^aeiou]ium$/,Fn],[/[^aeiou]ism$/,Fn],[/^h*u*m+$/,On],[/^\d+ ?[ap]m$/,"Date"]],n:[[/.[lsrnpb]ian$/,In],[/[^aeiou]ician$/,Gn],[/[aeiou][ktrp]in$/,"Gerund"]],o:[[/^no+$/,On],[/^(yo)+$/,On],[/^woo+[pt]?$/,On]],r:[[/.[bdfklmst]ler$/,"Noun"],[/[aeiou][pns]er$/,Fn],[/[^i]fer$/,Nn],[/.[^aeiou][ao]pher$/,Gn],[/.[lk]er$/,"Noun"],[/.ier$/,"Comparative"]],t:[[/.[di]est$/,"Superlative"],[/.[icldtgrv]ent$/,In],[/[aeiou].*ist$/,In],[/^[a-z]et$/,zn]],s:[[/.[^aeiou]ises$/,xn],[/.[rln]ates$/,xn],[/.[^z]ens$/,zn],[/.[lstrn]us$/,Fn],[/.[aeiou]sks$/,xn],[/.[aeiou]kes$/,xn],[/[aeiou][^aeiou]is$/,Fn],[/[a-z]\'s$/,Tn],[/^yes+$/,On]],v:[[/.[^aeiou][ai][kln]ov$/,Vn]],y:[[/.[cts]hy$/,In],[/.[st]ty$/,In],[/.[gk]y$/,In],[/.[tnl]ary$/,In],[/.[oe]ry$/,Fn],[/[rdntkbhs]ly$/,Bn],[/...lly$/,Bn],[/[bszmp]{2}y$/,In],[/.(gg|bb|zz)ly$/,In],[/.[ai]my$/,In],[/[ea]{2}zy$/,In],[/.[^aeiou]ity$/,Fn]]},Mn="Adjective",Sn="Infinitive",Ln="PresentTense",_n="Singular",Kn="PastTense",qn="Adverb",Rn="Plural",Wn="Actor",Qn="Verb",Un="Noun",Zn="LastName",Xn="Modal",Yn=[null,null,{ea:_n,ia:Un,ic:Mn,ly:qn,"'n":Qn,"'t":Qn},{oed:Kn,ued:Kn,xed:Kn," so":qn,"'ll":Xn,"'re":"Copula",azy:Mn,eer:Un,end:Qn,ped:Kn,ffy:Mn,ify:Sn,ing:"Gerund",ize:Sn,lar:Mn,mum:Mn,nes:Ln,nny:Mn,oid:Mn,ous:Mn,que:Mn,rol:_n,sis:_n,zes:Ln},{amed:Kn,aped:Kn,ched:Kn,lked:Kn,nded:Kn,cted:Kn,dged:Kn,akis:Zn,cede:Sn,chuk:Zn,czyk:Zn,ects:Ln,ends:Qn,enko:Zn,ette:_n,fies:Ln,fore:qn,gate:Sn,gone:Mn,ices:Rn,ints:Rn,ines:Rn,ions:Rn,less:qn,llen:Mn,made:Mn,nsen:Zn,oses:Ln,ould:Xn,some:Mn,sson:Zn,tage:Sn,teen:"Value",tion:_n,tive:Mn,tors:Un,vice:_n},{tized:Kn,urned:Kn,eased:Kn,ances:Rn,bound:Mn,ettes:Rn,fully:qn,ishes:Ln,ities:Rn,marek:Zn,nssen:Zn,ology:Un,ports:Rn,rough:Mn,tches:Ln,tieth:"Ordinal",tures:Rn,wards:qn,where:qn},{auskas:Zn,keeper:Wn,logist:Wn,teenth:"Value"},{opoulos:Zn,borough:"Place",sdottir:Zn}],ea={":(":!0,":)":!0,":P":!0,":p":!0,":O":!0,":3":!0,":|":!0,":/":!0,":\\":!0,":$":!0,":*":!0,":@":!0,":-(":!0,":-)":!0,":-P":!0,":-p":!0,":-O":!0,":-3":!0,":-|":!0,":-/":!0,":-\\":!0,":-$":!0,":-*":!0,":-@":!0,":^(":!0,":^)":!0,":^P":!0,":^p":!0,":^O":!0,":^3":!0,":^|":!0,":^/":!0,":^\\":!0,":^$":!0,":^*":!0,":^@":!0,"):":!0,"(:":!0,"$:":!0,"*:":!0,")-:":!0,"(-:":!0,"$-:":!0,"*-:":!0,")^:":!0,"(^:":!0,"$^:":!0,"*^:":!0,"<3":!0,"2){var a=n.clean[n.clean.length-2];if("s"===a)return void n.tag(["Possessive","Noun"],"end-tick",r);"n"===a&&n.tag(["Gerund"],"chillin",r)}Pn.test(n.text)&&n.tag("Unit","per-sec",r)},regex:function(e,t){for(var r=e.text,n=0;n=2&&jn.test(r)&&En.test(r)&&e.tag("RomanNumeral","xvii",t)},suffix:function(e,t){!function(e,t){var r=e.clean.length,n=7;r<=n&&(n=r-1);for(var a=n;a>1;a-=1){var i=e.clean.substr(r-a,r);if(!0===Yn[i.length].hasOwnProperty(i)){var o=Yn[i.length][i];e.tagSafe(o,"suffix -"+i,t);break}}}(e,t),function(e,t){var r=e.clean,n=r[r.length-1];if(!0===Jn.hasOwnProperty(n))for(var a=Jn[n],i=0;i35)}(n=(n=n.trim()).replace(/[.!?,]$/,""))&&(e.tag("Emoji","comma-emoji",t),e.text=n,e.pre=e.pre.replace(":",""),e.post=e.post.replace(":","")),e.text.match(ta)&&(e.tag("Emoji","unicode-emoji",t),e.text=n),!0===(r=(r=n).replace(/^[:;]/,":"),ea.hasOwnProperty(r))&&(e.tag("Emoticon","emoticon-emoji",t),e.text=n)}},na=function(e,t){var r=e.world;ra.lexicon(t,r);for(var n=0;n3&&void 0!==r[n]&&!0===r.hasOwnProperty(n)&&e.tag(r[n],"stem-"+n,t)}}))},pa={isSingular:[/(ax|test)is$/i,/(octop|vir|radi|nucle|fung|cact|stimul)us$/i,/(octop|vir)i$/i,/(rl)f$/i,/(alias|status)$/i,/(bu)s$/i,/(al|ad|at|er|et|ed|ad)o$/i,/(ti)um$/i,/(ti)a$/i,/sis$/i,/(?:(^f)fe|(lr)f)$/i,/hive$/i,/s[aeiou]+ns$/i,/(^aeiouy|qu)y$/i,/(x|ch|ss|sh|z)$/i,/(matr|vert|ind|cort)(ix|ex)$/i,/(m|l)ouse$/i,/(m|l)ice$/i,/(antenn|formul|nebul|vertebr|vit)a$/i,/.sis$/i,/^(?!talis|.*hu)(.*)man$/i],isPlural:[/(^v)ies$/i,/ises$/i,/ives$/i,/(antenn|formul|nebul|vertebr|vit)ae$/i,/(octop|vir|radi|nucle|fung|cact|stimul)i$/i,/(buffal|tomat|tornad)oes$/i,/(analy|ba|diagno|parenthe|progno|synop|the)ses$/i,/(vert|ind|cort)ices$/i,/(matr|append)ices$/i,/(x|ch|ss|sh|s|z|o)es$/i,/is$/i,/men$/i,/news$/i,/.tia$/i,/(^f)ves$/i,/(lr)ves$/i,/(^aeiouy|qu)ies$/i,/(m|l)ice$/i,/(cris|ax|test)es$/i,/(alias|status)es$/i,/ics$/i]},fa=["Uncountable","Pronoun","Place","Value","Person","Month","WeekDay","Holiday"],ma=[/ss$/,/sis$/,/[^aeiou][uo]s$/,/'s$/],va=[/i$/,/ae$/],ba=function(e,t){if(e.tags.Noun&&!e.tags.Acronym){var r=e.clean;if(e.tags.Singular||e.tags.Plural)return;if(r.length<=3)return void e.tag("Singular","short-singular",t);if(fa.find((function(t){return e.tags[t]})))return;if(pa.isPlural.find((function(e){return e.test(r)})))return void e.tag("Plural","plural-rules",t);if(pa.isSingular.find((function(e){return e.test(r)})))return void e.tag("Singular","singular-rules",t);if(!0===/s$/.test(r)){if(ma.find((function(e){return e.test(r)})))return;return void e.tag("Plural","plural-fallback",t)}if(va.find((function(e){return e.test(r)})))return;e.tag("Singular","singular-fallback",t)}},ya=["academy","administration","agence","agences","agencies","agency","airlines","airways","army","assoc","associates","association","assurance","authority","autorite","aviation","bank","banque","board","boys","brands","brewery","brotherhood","brothers","building society","bureau","cafe","caisse","capital","care","cathedral","center","central bank","centre","chemicals","choir","chronicle","church","circus","clinic","clinique","club","co","coalition","coffee","collective","college","commission","committee","communications","community","company","comprehensive","computers","confederation","conference","conseil","consulting","containers","corporation","corps","corp","council","crew","daily news","data","departement","department","department store","departments","design","development","directorate","division","drilling","education","eglise","electric","electricity","energy","ensemble","enterprise","enterprises","entertainment","estate","etat","evening news","faculty","federation","financial","fm","foundation","fund","gas","gazette","girls","government","group","guild","health authority","herald","holdings","hospital","hotel","hotels","inc","industries","institut","institute","institute of technology","institutes","insurance","international","interstate","investment","investments","investors","journal","laboratory","labs","liberation army","limited","local authority","local health authority","machines","magazine","management","marine","marketing","markets","media","memorial","mercantile exchange","ministere","ministry","military","mobile","motor","motors","musee","museum","news","news service","observatory","office","oil","optical","orchestra","organization","partners","partnership","people's party","petrol","petroleum","pharmacare","pharmaceutical","pharmaceuticals","pizza","plc","police","polytechnic","post","power","press","productions","quartet","radio","regional authority","regional health authority","reserve","resources","restaurant","restaurants","savings","school","securities","service","services","social club","societe","society","sons","standard","state police","state university","stock exchange","subcommittee","syndicat","systems","telecommunications","telegraph","television","times","tribunal","tv","union","university","utilities","workers"].reduce((function(e,t){return e[t]="Noun",e}),{}),wa=function(e){return!!e.tags.Noun&&(!(e.tags.Pronoun||e.tags.Comma||e.tags.Possessive)&&!!(e.tags.Organization||e.tags.Acronym||e.tags.Place||e.titleCase()))},ka=/^[A-Z]('s|,)?$/,Aa=/([A-Z]\.){2}[A-Z]?/i,Da={I:!0,A:!0},$a={neighbours:sa,case:ca,stem:ga,plural:ba,organizations:function(e,t){for(var r=0;r5)&&e.isAcronym()}(e,t)?(e.tag("Acronym","acronym-step",t),e.tag("Noun","acronym-infer",t)):!Da.hasOwnProperty(e.text)&&ka.test(e.text)&&(e.tag("Acronym","one-letter-acronym",t),e.tag("Noun","one-letter-infer",t)),e.tags.Organization&&e.text.length<=3&&e.tag("Acronym","acronym-org",t),e.tags.Organization&&e.isUpperCase()&&e.text.length<=6&&e.tag("Acronym","acronym-org-case",t))}))}},Pa=function(e,t){var r=e.world;return $a.neighbours(t,r),$a.case(e),$a.stem(t,r),t.forEach((function(t){!1===t.isKnown()&&t.tag("Noun","noun-fallback",e.world)})),$a.organizations(t,r),$a.acronyms(t,r),t.forEach((function(t){$a.plural(t,e.world)})),e},Ha=/n't$/,ja={"won't":["will","not"],wont:["will","not"],"can't":["can","not"],cant:["can","not"],cannot:["can","not"],"shan't":["should","not"],dont:["do","not"],dun:["do","not"]},Ea=function(e,t){return!0===ja.hasOwnProperty(e.clean)?ja[e.clean]:"ain't"===e.clean||"aint"===e.clean?function(e,t){var r=t.terms(),n=r.indexOf(e),a=r.slice(0,n).find((function(e){return e.tags.Noun}));return a&&a.tags.Plural?["are","not"]:["is","not"]}(e,t):!0===Ha.test(e.clean)?[e.clean.replace(Ha,""),"not"]:null},Ia=/([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z]{1,2})$/i,Na={ll:"will",ve:"have",re:"are",m:"am","n't":"not"},xa=function(e){var t=e.text.match(Ia);return null===t?null:Na.hasOwnProperty(t[2])?[t[1],Na[t[2]]]:null},Fa={wanna:["want","to"],gonna:["going","to"],im:["i","am"],alot:["a","lot"],ive:["i","have"],imma:["I","will"],"where'd":["where","did"],whered:["where","did"],"when'd":["when","did"],whend:["when","did"],howd:["how","did"],whatd:["what","did"],dunno:["do","not","know"],brb:["be","right","back"],gtg:["got","to","go"],irl:["in","real","life"],tbh:["to","be","honest"],imo:["in","my","opinion"],til:["today","i","learned"],rn:["right","now"],twas:["it","was"],"@":["at"]},Ca=function(e){return Fa.hasOwnProperty(e.clean)?Fa[e.clean]:null},Ba=/([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]s$/i,Oa={that:!0,there:!0},Ga={here:!0,there:!0,everywhere:!0},za=function(e,t,r){var n=e.text.match(Ba);if(null!==n){if(!0===function(e,t){if(e.tags.Possessive)return!0;if(e.tags.Pronoun||e.tags.QuestionWord)return!1;if(Oa.hasOwnProperty(e.reduced))return!1;var r=t.get(e.next);if(!r)return!0;if(r.tags.Verb)return!!r.tags.Infinitive||!!r.tags.PresentTense;if(r.tags.Noun)return!0!==Ga.hasOwnProperty(r.reduced);var n=t.get(r.next);return!(!n||!n.tags.Noun||n.tags.Pronoun)||(r.tags.Adjective||r.tags.Adverb||r.tags.Verb,!1)}(e,t.pool))return e.tag("#Possessive","isPossessive",r),null;if(null!==n)return function(e,t){var r=t.terms(),n=r.indexOf(e);return r.slice(n+1,n+3).find((function(e){return e.tags.PastTense}))}(e,t)?[n[1],"has"]:[n[1],"is"]}return null},Ta=/[a-z\u00C0-\u00FF]'d$/,Va={how:!0,what:!0},Ja=function(e,t){if(Ta.test(e.clean)){for(var r=e.clean.replace(/'d$/,""),n=t.terms(),a=n.indexOf(e),i=n.slice(a+1,a+4),o=0;o0?fi=fi.concat(t):fi.push(e)})),fi.forEach((function(e){var t,r,n;return e.required=(t=e.reg,r=[],n=[],t.forEach((function(e){!0!==e.optional&&!0!==e.negative&&(void 0!==e.tag&&r.push(e.tag),void 0!==e.word&&n.push(e.word))})),{tags:Xa(r),words:Xa(n)}),e}));var mi=fi,vi=function(e){mi.forEach((function(t){var r=[];t.required.words.forEach((function(t){r.push(e._cache.words[t]||[])})),t.required.tags.forEach((function(t){r.push(e._cache.tags[t]||[])}));var n=function(e){if(0===e.length)return[];var t={};e.forEach((function(e){e=Xa(e);for(var r=0;r5&&e.match("#Verb+").length>=2}));if(u.found){var l=u.splitAfter("#Noun .* #Verb .* #Noun+");n=n.splitOn(l.eq(0))}return"number"==typeof t&&(n=n.get(t)),new e(n.list,this,this.world)},e},$i=function(e){var r=function(e){a(i,e);var r=u(i);function i(e,n,a){var o;return t(this,i),(o=r.call(this,e,n,a)).contracted=null,o}return n(i,[{key:"expand",value:function(){return this.list.forEach((function(e){var t=e.terms(),r=t[0].isTitleCase();t.forEach((function(e,r){e.set(e.implicit||e.text),e.implicit=void 0,r1&&void 0!==arguments[1]?arguments[1]:{},n=this.match("(#City && @hasComma) (#Region|#Country)"),a=this.not(n).splitAfter("@hasComma"),i=(a=a.concat(n)).quotations();return i.found&&(a=a.splitOn(i.eq(0))),a=a.match("#Noun+ (of|by)? the? #Noun+?"),!0!==t.keep_anaphora&&(a=(a=(a=(a=a.not("#Pronoun")).not("(there|these)")).not("(#Month|#WeekDay)")).not("(my|our|your|their|her|his)")),a=a.not("(of|for|by|the)$"),"number"==typeof e&&(a=a.get(e)),new r(a.list,this,this.world)},e},Vi=/\(/,Ji=/\)/,Mi=function(e){var r=function(e){a(i,e);var r=u(i);function i(){return t(this,i),r.apply(this,arguments)}return n(i,[{key:"unwrap",value:function(){return this.list.forEach((function(e){var t=e.terms(0);t.pre=t.pre.replace(Vi,"");var r=e.lastTerm();r.post=r.post.replace(Ji,"")})),this}}]),i}(e);return e.prototype.parentheses=function(e){var t=[];return this.list.forEach((function(e){for(var r=e.terms(),n=0;n0}}),Object.defineProperty(this,"length",{get:function(){return i.list.length}}),Object.defineProperty(this,"isA",{get:function(){return"Doc"}})}return n(e,[{key:"tagger",value:function(){return yi(this)}},{key:"pool",value:function(){return this.list.length>0?this.list[0].pool:this.all().list[0].pool}}]),e}();oo.prototype.buildFrom=function(e){return e=e.map((function(e){return e.clone(!0)})),new oo(e,this,this.world)},oo.prototype.fromText=function(e){var t=wt(e,this.world,this.pool());return this.buildFrom(t)},Object.assign(oo.prototype,io.misc),Object.assign(oo.prototype,io.selections),ao(oo);var so={untag:"unTag",and:"match",notIf:"ifNo",only:"if",onlyIf:"if"};Object.keys(so).forEach((function(e){return oo.prototype[e]=oo.prototype[so[e]]}));var uo=oo,lo=function(e){var t=e.termList();return Dn(t,e.world),e.world.taggers.forEach((function(t){t(e)})),e};return function e(t){var r=t,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;t&&r.addWords(t);var n=wt(e,r),a=new uo(n,null,r);return a.tagger(),a};return n.tokenize=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=r;t&&((n=n.clone()).words={},n.addWords(t));var a=wt(e,n),i=new uo(a,null,n);return(t||i.world.taggers.length>0)&&lo(i),i},n.extend=function(e){return e(uo,r,this,Xe,se,et),this},n.fromJSON=function(e){var t=kt(e,r);return new uo(t,null,r)},n.clone=function(){return e(r.clone())},n.verbose=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return r.verbose(e),this},n.world=function(){return r},n.parseMatch=function(e,t){return Ke(e,t)},n.version="13.10.1",n.import=n.load,n.plugin=n.extend,n}(new Fr)})); diff --git a/builds/compromise.mjs b/builds/compromise.mjs index f19a2f818..712776abd 100644 --- a/builds/compromise.mjs +++ b/builds/compromise.mjs @@ -1,4 +1,4 @@ -/* compromise 13.10.0 MIT */ +/* compromise 13.10.1 MIT */ function _typeof(obj) { "@babel/helpers - typeof"; @@ -74,7 +74,7 @@ function _isNativeReflectConstruct() { if (typeof Proxy === "function") return true; try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; @@ -191,11 +191,11 @@ var killUnicode = function killUnicode(str) { var unicode_1 = killUnicode; // console.log(killUnicode('bjŏȒk—Ɏó')); var periodAcronym = /([A-Z]\.)+[A-Z]?,?$/; -var oneLetterAcronym = /^[A-Z]\.,?$/; +var oneLetterAcronym$1 = /^[A-Z]\.,?$/; var noPeriodAcronym = /[A-Z]{2,}('s|,)?$/; var lowerCaseAcronym = /([a-z]\.){1,}[a-z]\.?$/; -var isAcronym = function isAcronym(str) { +var isAcronym$2 = function isAcronym(str) { //like N.D.A if (periodAcronym.test(str) === true) { return true; @@ -207,7 +207,7 @@ var isAcronym = function isAcronym(str) { } //like 'F.' - if (oneLetterAcronym.test(str) === true) { + if (oneLetterAcronym$1.test(str) === true) { return true; } //like NDA @@ -219,9 +219,9 @@ var isAcronym = function isAcronym(str) { return false; }; -var isAcronym_1 = isAcronym; +var isAcronym_1$1 = isAcronym$2; -var hasSlash = /[a-z\u00C0-\u00FF] ?\/ ?[a-z\u00C0-\u00FF]/; +var hasSlash$1 = /[a-z\u00C0-\u00FF] ?\/ ?[a-z\u00C0-\u00FF]/; /** some basic operations on a string to reduce noise */ var clean = function clean(str) { @@ -232,7 +232,7 @@ var clean = function clean(str) { str = unicode_1(str); //rough handling of slashes - 'see/saw' - if (hasSlash.test(str) === true) { + if (hasSlash$1.test(str) === true) { str = str.replace(/\/.*/, ''); } //#tags, @mentions @@ -256,7 +256,7 @@ var clean = function clean(str) { } //compact acronyms - if (isAcronym_1(str)) { + if (isAcronym_1$1(str)) { str = str.replace(/\./g, ''); } //strip leading & trailing grammatical punctuation @@ -299,7 +299,7 @@ var reduce = reduced; var startings = /^[ \n\t\.’'\[\](){}⟨⟩:,،、‒–—―…!.‹›«»‐\-?‘’;\/⁄·&*•^†‡°¡¿※№÷׺ª%‰+−=‱¶′″‴§~|‖¦©℗®℠™¤₳฿\u0022|\uFF02|\u0027|\u201C|\u2018|\u201F|\u201B|\u201E|\u2E42|\u201A|\u00AB|\u2039|\u2035|\u2036|\u2037|\u301D|\u0060|\u301F]+/; var endings = /[ \n\t\.’'\[\](){}⟨⟩:,،、‒–—―…!.‹›«»‐\-?‘’;\/⁄·&*@•^†‡°¡¿※#№÷׺ª‰+−=‱¶′″‴§~|‖¦©℗®℠™¤₳฿\u0022|\uFF02|\u0027|\u201D|\u2019|\u201D|\u2019|\u201D|\u201D|\u2019|\u00BB|\u203A|\u2032|\u2033|\u2034|\u301E|\u00B4|\u301E]+$/; //money = ₵¢₡₢$₫₯֏₠€ƒ₣₲₴₭₺₾ℳ₥₦₧₱₰£៛₽₹₨₪৳₸₮₩¥ -var hasSlash$1 = /\//; +var hasSlash = /\//; var hasApostrophe = /['’]/; var hasAcronym = /^[a-z]\.([a-z]\.)+/i; var minusNumber = /^[-+\.][0-9]/; @@ -366,8 +366,8 @@ var parseTerm = function parseTerm(str) { post: post }; // support aliases for slashes - if (hasSlash$1.test(str)) { - str.split(hasSlash$1).forEach(function (word) { + if (hasSlash.test(str)) { + str.split(hasSlash).forEach(function (word) { parsed.alias = parsed.alias || {}; parsed.alias[word.trim()] = true; }); @@ -376,7 +376,7 @@ var parseTerm = function parseTerm(str) { return parsed; }; -var parse = parseTerm; +var parse$2 = parseTerm; function createCommonjsModule(fn) { var module = { exports: {} }; @@ -427,7 +427,7 @@ var _01Case = createCommonjsModule(function (module, exports) { exports.titleCase = exports.isTitleCase; }); -var _02Punctuation = createCommonjsModule(function (module, exports) { +var _02Punctuation$1 = createCommonjsModule(function (module, exports) { // these methods are called with '@hasComma' in the match syntax // various unicode quotation-mark formats var startQuote = /(\u0022|\uFF02|\u0027|\u201C|\u2018|\u201F|\u201B|\u201E|\u2E42|\u201A|\u00AB|\u2039|\u2035|\u2036|\u2037|\u301D|\u0060|\u301F)/; @@ -749,8 +749,8 @@ var doesMatch_1 = function doesMatch_1(reg, index, length) { /** does this term look like an acronym? */ -var isAcronym_1$1 = function isAcronym_1$1() { - return isAcronym_1(this.text); +var isAcronym_1 = function isAcronym_1() { + return isAcronym_1$1(this.text); }; /** is this term implied by a contraction? */ @@ -800,13 +800,13 @@ var setRoot = function setRoot(world) { var _03Misc = { doesMatch: doesMatch_1, - isAcronym: isAcronym_1$1, + isAcronym: isAcronym_1, isImplicit: isImplicit, isKnown: isKnown, setRoot: setRoot }; -var hasSpace = /[\s-]/; +var hasSpace$1 = /[\s-]/; var isUpperCase = /^[A-Z-]+$/; // const titleCase = str => { // return str.charAt(0).toUpperCase() + str.substr(1) // } @@ -867,7 +867,7 @@ var textOut = function textOut(options, showPre, showPost) { before = ''; after = ' '; - if ((hasSpace.test(this.post) === false || options.last) && !this.implicit) { + if ((hasSpace$1.test(this.post) === false || options.last) && !this.implicit) { after = ''; } } @@ -961,7 +961,7 @@ var jsonDefault = { }; /** return various metadata for this term */ -var json = function json(options, world) { +var json$1 = function json(options, world) { options = options || {}; options = Object.assign({}, jsonDefault, options); var result = {}; // default on @@ -1003,11 +1003,11 @@ var json = function json(options, world) { return result; }; -var _05Json = { - json: json +var _05Json$1 = { + json: json$1 }; -var methods = Object.assign({}, _01Case, _02Punctuation, _03Misc, _04Text, _05Json); +var methods$8 = Object.assign({}, _01Case, _02Punctuation$1, _03Misc, _04Text, _05Json$1); function isClientSide() { return typeof window !== 'undefined' && window.document; @@ -1061,19 +1061,19 @@ var logUntag = function logUntag(t, tag, reason) { console.log(log); }; -var isArray = function isArray(arr) { +var isArray$3 = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; -var titleCase = function titleCase(str) { +var titleCase$4 = function titleCase(str) { return str.charAt(0).toUpperCase() + str.substr(1); }; -var fns = { +var fns$1 = { logTag: logTag, logUntag: logUntag, - isArray: isArray, - titleCase: titleCase + isArray: isArray$3, + titleCase: titleCase$4 }; /** add a tag, and its descendents, to a term */ @@ -1089,7 +1089,7 @@ var addTag = function addTag(t, tag, reason, world) { tag = tag.replace(/^#/, ''); } - tag = fns.titleCase(tag); //if we already got this one + tag = fns$1.titleCase(tag); //if we already got this one if (t.tags[tag] === true) { return; @@ -1099,7 +1099,7 @@ var addTag = function addTag(t, tag, reason, world) { var isVerbose = world.isVerbose(); if (isVerbose === true) { - fns.logTag(t, tag, reason); + fns$1.logTag(t, tag, reason); } //add tag @@ -1112,7 +1112,7 @@ var addTag = function addTag(t, tag, reason, world) { t.tags[down] = true; if (isVerbose === true) { - fns.logTag(t, '→ ' + down); + fns$1.logTag(t, '→ ' + down); } }); //remove any contrary tags @@ -1137,13 +1137,13 @@ var add = addTags; var lowerCase = /^[a-z]/; -var titleCase$1 = function titleCase(str) { +var titleCase$3 = function titleCase(str) { return str.charAt(0).toUpperCase() + str.substr(1); }; /** remove this tag, and its descentents from the term */ -var unTag = function unTag(t, tag, reason, world) { +var unTag$1 = function unTag(t, tag, reason, world) { var isVerbose = world.isVerbose(); //support '*' for removing all tags if (tag === '*') { @@ -1154,7 +1154,7 @@ var unTag = function unTag(t, tag, reason, world) { tag = tag.replace(/^#/, ''); if (lowerCase.test(tag) === true) { - tag = titleCase$1(tag); + tag = titleCase$3(tag); } // remove the tag @@ -1162,7 +1162,7 @@ var unTag = function unTag(t, tag, reason, world) { delete t.tags[tag]; //log in verbose-mode if (isVerbose === true) { - fns.logUntag(t, tag, reason); + fns$1.logUntag(t, tag, reason); } } //delete downstream tags too @@ -1177,7 +1177,7 @@ var unTag = function unTag(t, tag, reason, world) { delete t.tags[lineage[i]]; if (isVerbose === true) { - fns.logUntag(t, ' - ' + lineage[i]); + fns$1.logUntag(t, ' - ' + lineage[i]); } } } @@ -1190,18 +1190,18 @@ var unTag = function unTag(t, tag, reason, world) { var untagAll = function untagAll(term, tags, reason, world) { if (typeof tags !== 'string' && tags) { for (var i = 0; i < tags.length; i++) { - unTag(term, tags[i], reason, world); + unTag$1(term, tags[i], reason, world); } return; } - unTag(term, tags, reason, world); + unTag$1(term, tags, reason, world); }; -var unTag_1 = untagAll; +var unTag_1$1 = untagAll; -var canBe = function canBe(term, tag, world) { +var canBe$2 = function canBe(term, tag, world) { var tagset = world.tags; // cleanup tag if (tag[0] === '#') { @@ -1229,7 +1229,7 @@ var canBe = function canBe(term, tag, world) { return true; }; -var canBe_1 = canBe; +var canBe_1$1 = canBe$2; /** add a tag or tags, and their descendents to this term * @param {string | string[]} tags - a tag or tags @@ -1243,8 +1243,8 @@ var tag_1 = function tag_1(tags, reason, world) { /** only tag this term if it's consistent with it's current tags */ -var tagSafe = function tagSafe(tags, reason, world) { - if (canBe_1(this, tags, world)) { +var tagSafe$1 = function tagSafe(tags, reason, world) { + if (canBe_1$1(this, tags, world)) { add(this, tags, reason, world); } @@ -1256,8 +1256,8 @@ var tagSafe = function tagSafe(tags, reason, world) { */ -var unTag_1$1 = function unTag_1$1(tags, reason, world) { - unTag_1(this, tags, reason, world); +var unTag_1 = function unTag_1(tags, reason, world) { + unTag_1$1(this, tags, reason, world); return this; }; /** is this tag consistent with the word's current tags? @@ -1266,15 +1266,15 @@ var unTag_1$1 = function unTag_1$1(tags, reason, world) { */ -var canBe_1$1 = function canBe_1$1(tags, world) { - return canBe_1(this, tags, world); +var canBe_1 = function canBe_1(tags, world) { + return canBe_1$1(this, tags, world); }; -var tag = { +var tag$1 = { tag: tag_1, - tagSafe: tagSafe, - unTag: unTag_1$1, - canBe: canBe_1$1 + tagSafe: tagSafe$1, + unTag: unTag_1, + canBe: canBe_1 }; var Term = /*#__PURE__*/function () { @@ -1284,7 +1284,7 @@ var Term = /*#__PURE__*/function () { _classCallCheck(this, Term); text = String(text); - var obj = parse(text); // the various forms of our text + var obj = parse$2(text); // the various forms of our text this.text = obj.text || ''; this.clean = obj.clean; @@ -1310,7 +1310,7 @@ var Term = /*#__PURE__*/function () { _createClass(Term, [{ key: "set", value: function set(str) { - var obj = parse(str); + var obj = parse$2(str); this.text = obj.text; this.clean = obj.clean; return this; @@ -1336,8 +1336,8 @@ Term.prototype.clone = function () { return term; }; -Object.assign(Term.prototype, methods); -Object.assign(Term.prototype, tag); +Object.assign(Term.prototype, methods$8); +Object.assign(Term.prototype, tag$1); var Term_1 = Term; /** return a flat array of Term objects */ @@ -1387,7 +1387,7 @@ var terms = function terms(n) { /** return a shallow or deep copy of this phrase */ -var clone = function clone(isShallow) { +var clone$1 = function clone(isShallow) { var _this = this; if (isShallow) { @@ -1499,9 +1499,9 @@ var fullSentence = function fullSentence() { return this.buildFrom(start, len); }; -var _01Utils = { +var _01Utils$1 = { terms: terms, - clone: clone, + clone: clone$1, lastTerm: lastTerm, hasId: hasId, wordCount: wordCount, @@ -1514,7 +1514,7 @@ var trimEnd = function trimEnd(str) { /** produce output in the given format */ -var text = function text() { +var text$1 = function text() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var isFirst = arguments.length > 1 ? arguments[1] : undefined; var isLast = arguments.length > 2 ? arguments[2] : undefined; @@ -1624,7 +1624,7 @@ var text = function text() { }; var _02Text = { - text: text + text: text$1 }; /** remove start and end whitespace */ @@ -1659,7 +1659,7 @@ var combinePost = function combinePost(before, after) { }; //add whitespace to the start of the second bit -var addWhitespace = function addWhitespace(beforeTerms, newTerms) { +var addWhitespace$1 = function addWhitespace(beforeTerms, newTerms) { // add any existing pre-whitespace to beginning newTerms[0].pre = beforeTerms[0].pre; var lastTerm = beforeTerms[beforeTerms.length - 1]; //add any existing punctuation to end of our new terms @@ -1675,7 +1675,7 @@ var addWhitespace = function addWhitespace(beforeTerms, newTerms) { }; //insert this segment into the linked-list -var stitchIn = function stitchIn(beforeTerms, newTerms, pool) { +var stitchIn$1 = function stitchIn(beforeTerms, newTerms, pool) { var lastBefore = beforeTerms[beforeTerms.length - 1]; var lastNew = newTerms[newTerms.length - 1]; var afterId = lastBefore.next; //connect ours in (main → newPhrase) @@ -1700,7 +1700,7 @@ var stitchIn = function stitchIn(beforeTerms, newTerms, pool) { }; // avoid stretching a phrase twice. -var unique = function unique(list) { +var unique$5 = function unique(list) { return list.filter(function (o, i) { return list.indexOf(o) === i; }); @@ -1711,9 +1711,9 @@ var appendPhrase = function appendPhrase(before, newPhrase, doc) { var beforeTerms = before.terms(); var newTerms = newPhrase.terms(); //spruce-up the whitespace issues - addWhitespace(beforeTerms, newTerms); //insert this segment into the linked-list + addWhitespace$1(beforeTerms, newTerms); //insert this segment into the linked-list - stitchIn(beforeTerms, newTerms, before.pool); // stretch! + stitchIn$1(beforeTerms, newTerms, before.pool); // stretch! // make each effected phrase longer var toStretch = [before]; @@ -1729,7 +1729,7 @@ var appendPhrase = function appendPhrase(before, newPhrase, doc) { toStretch = toStretch.concat(shouldChange); }); // don't double-count a phrase - toStretch = unique(toStretch); + toStretch = unique$5(toStretch); toStretch.forEach(function (p) { p.length += newPhrase.length; }); @@ -1739,15 +1739,15 @@ var appendPhrase = function appendPhrase(before, newPhrase, doc) { var append = appendPhrase; -var hasSpace$1 = / /; //a new space needs to be added, either on the new phrase, or the old one +var hasSpace = / /; //a new space needs to be added, either on the new phrase, or the old one // '[new] [◻old]' -or- '[old] [◻new] [old]' -var addWhitespace$1 = function addWhitespace(newTerms) { +var addWhitespace = function addWhitespace(newTerms) { //add a space before our new text? // add a space after our text var lastTerm = newTerms[newTerms.length - 1]; - if (hasSpace$1.test(lastTerm.post) === false) { + if (hasSpace.test(lastTerm.post) === false) { lastTerm.post += ' '; } @@ -1755,7 +1755,7 @@ var addWhitespace$1 = function addWhitespace(newTerms) { }; //insert this segment into the linked-list -var stitchIn$1 = function stitchIn(main, newPhrase, newTerms) { +var stitchIn = function stitchIn(main, newPhrase, newTerms) { // [newPhrase] → [main] var lastTerm = newTerms[newTerms.length - 1]; lastTerm.next = main.start; // [before] → [main] @@ -1775,7 +1775,7 @@ var stitchIn$1 = function stitchIn(main, newPhrase, newTerms) { main.terms(0).prev = lastTerm.id; }; -var unique$1 = function unique(list) { +var unique$4 = function unique(list) { return list.filter(function (o, i) { return list.indexOf(o) === i; }); @@ -1786,9 +1786,9 @@ var joinPhrase = function joinPhrase(original, newPhrase, doc) { var starterId = original.start; var newTerms = newPhrase.terms(); //spruce-up the whitespace issues - addWhitespace$1(newTerms); //insert this segment into the linked-list + addWhitespace(newTerms); //insert this segment into the linked-list - stitchIn$1(original, newPhrase, newTerms); //increase the length of our phrases + stitchIn(original, newPhrase, newTerms); //increase the length of our phrases var toStretch = [original]; var docs = [doc]; @@ -1801,7 +1801,7 @@ var joinPhrase = function joinPhrase(original, newPhrase, doc) { toStretch = toStretch.concat(shouldChange); }); // don't double-count - toStretch = unique$1(toStretch); // stretch these phrases + toStretch = unique$4(toStretch); // stretch these phrases toStretch.forEach(function (p) { p.length += newPhrase.length; // change the start too, if necessary @@ -1882,7 +1882,7 @@ var deletePhrase = function deletePhrase(phrase, doc) { }; -var _delete = deletePhrase; +var _delete$1 = deletePhrase; /** put this text at the end */ @@ -1898,20 +1898,20 @@ var prepend_1 = function prepend_1(newPhrase, doc) { return this; }; -var _delete$1 = function _delete$1(doc) { - _delete(this, doc); +var _delete = function _delete(doc) { + _delete$1(this, doc); return this; }; // stich-in newPhrase, stretch 'doc' + parents -var replace = function replace(newPhrase, doc) { +var replace$1 = function replace(newPhrase, doc) { //add it do the end var firstLength = this.length; append(this, newPhrase, doc); //delete original terms var tmp = this.buildFrom(this.start, this.length); tmp.length = firstLength; - _delete(tmp, doc); + _delete$1(tmp, doc); }; /** * Turn this phrase object into 3 phrase objects @@ -1958,13 +1958,13 @@ var splitOn = function splitOn(p) { var _04Insert = { append: append_1, prepend: prepend_1, - "delete": _delete$1, - replace: replace, + "delete": _delete, + replace: replace$1, splitOn: splitOn }; /** return json metadata for this phrase */ -var json$1 = function json() { +var json = function json() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var world = arguments.length > 1 ? arguments[1] : undefined; var res = {}; // text data @@ -2021,8 +2021,8 @@ var json$1 = function json() { return res; }; -var _05Json$1 = { - json: json$1 +var _05Json = { + json: json }; /** match any terms after this phrase */ @@ -2106,10 +2106,10 @@ var _06Lookahead = { lookBehind: lookBehind }; -var methods$1 = Object.assign({}, _01Utils, _02Text, _03Change, _04Insert, _05Json$1, _06Lookahead); +var methods$7 = Object.assign({}, _01Utils$1, _02Text, _03Change, _04Insert, _05Json, _06Lookahead); // try to avoid doing the match -var failFast = function failFast(p, regs) { +var failFast$1 = function failFast(p, regs) { if (regs.length === 0) { return true; } @@ -2133,7 +2133,7 @@ var failFast = function failFast(p, regs) { return false; }; -var _02FailFast = failFast; +var _02FailFast = failFast$1; var _matchLogic = createCommonjsModule(function (module, exports) { //found a match? it's greedy? keep going! @@ -2558,7 +2558,7 @@ var tryHere = function tryHere(terms, regs, start_i, phrase_length) { var _03TryMatch = tryHere; // final checks on the validity of our results -var postProcess = function postProcess(terms, regs, matches) { +var postProcess$1 = function postProcess(terms, regs, matches) { if (!matches || matches.length === 0) { return matches; } // ensure end reg has the end term @@ -2579,7 +2579,7 @@ var postProcess = function postProcess(terms, regs, matches) { return matches; }; -var _04PostProcess = postProcess; +var _04PostProcess = postProcess$1; /* break-down a match expression into this: { @@ -2901,7 +2901,7 @@ var doFastOrMode = function doFastOrMode(tokens) { // } -var postProcess$1 = function postProcess(tokens) { +var postProcess = function postProcess(tokens) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // ensure all capture groups are filled between start and end // give all capture groups names @@ -2925,11 +2925,11 @@ var postProcess$1 = function postProcess(tokens) { return tokens; }; -var _02PostProcess = postProcess$1; +var _02PostProcess = postProcess; var hasReg = /[^[a-z]]\//g; -var isArray$1 = function isArray(arr) { +var isArray$2 = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; // don't split up a regular expression @@ -3063,7 +3063,7 @@ var syntax = function syntax(input) { if (_typeof(input) === 'object') { - if (isArray$1(input)) { + if (isArray$2(input)) { if (input.length === 0 || !input[0]) { return []; } //is it a pre-parsed reg-list? @@ -3256,7 +3256,7 @@ var notMatch = function notMatch(p, regs) { return result; }; -var not = notMatch; +var not$1 = notMatch; /** return an array of matching phrases */ @@ -3287,10 +3287,10 @@ var has = function has(regs) { /** remove all matches from the result */ -var not$1 = function not$1(regs) { +var not = function not(regs) { var _this2 = this; - var matches = not(this, regs); //make them phrase objects + var matches = not$1(this, regs); //make them phrase objects matches = matches.map(function (list) { return _this2.buildFrom(list[0].id, list.length); @@ -3334,7 +3334,7 @@ var canBe$1 = function canBe(tag, world) { var match = { match: match_1, has: has, - not: not$1, + not: not, canBe: canBe$1 }; @@ -3378,13 +3378,13 @@ Phrase.prototype.buildFrom = function (id, length, groups) { Object.assign(Phrase.prototype, match); -Object.assign(Phrase.prototype, methods$1); //apply aliases +Object.assign(Phrase.prototype, methods$7); //apply aliases -var aliases = { +var aliases$1 = { term: 'terms' }; -Object.keys(aliases).forEach(function (k) { - return Phrase.prototype[k] = Phrase.prototype[aliases[k]]; +Object.keys(aliases$1).forEach(function (k) { + return Phrase.prototype[k] = Phrase.prototype[aliases$1[k]]; }); var Phrase_1 = Phrase; @@ -3695,7 +3695,7 @@ var splitHyphens = function splitHyphens(word) { return arr; }; -var isArray$2 = function isArray(arr) { +var isArray$1 = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; //turn a string into an array of strings (naiive for now, lumped later) @@ -3710,7 +3710,7 @@ var splitWords = function splitWords(str) { str = String(str); } - if (isArray$2(str)) { + if (isArray$1(str)) { return str; } @@ -3768,7 +3768,7 @@ var splitWords = function splitWords(str) { var _02Words = splitWords; -var isArray$3 = function isArray(arr) { +var isArray = function isArray(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; /** turn a string into an array of Phrase objects */ @@ -3783,7 +3783,7 @@ var fromText = function fromText() { if (typeof text !== 'string') { if (typeof text === 'number') { text = String(text); - } else if (isArray$3(text)) { + } else if (isArray(text)) { sentences = text; } } //tokenize into words @@ -3854,10 +3854,10 @@ var fromJSON = function fromJSON(json, world) { var fromJSON_1 = fromJSON; -var _version = '13.10.0'; +var _version = '13.10.1'; var entity = ['Person', 'Place', 'Organization']; -var nouns = { +var nouns$1 = { Noun: { notA: ['Verb', 'Adjective', 'Adverb'] }, @@ -3971,7 +3971,7 @@ var nouns = { } }; -var verbs = { +var verbs$1 = { Verb: { notA: ['Noun', 'Adjective', 'Adverb', 'Value'] }, @@ -3985,6 +3985,11 @@ var verbs = { isA: 'PresentTense', notA: ['PastTense', 'Gerund'] }, + //close the door! + Imperative: { + isA: 'Infinitive' // notA: ['PresentTense', 'PastTense', 'FutureTense', 'Gerund'], + + }, // walking Gerund: { isA: 'PresentTense', @@ -4072,7 +4077,7 @@ var values = { }; var anything = ['Noun', 'Verb', 'Adjective', 'Adverb', 'Value', 'QuestionWord']; -var misc = { +var misc$1 = { //--Adjectives-- Adjective: { notA: ['Noun', 'Verb', 'Adverb', 'Value'] @@ -4099,7 +4104,7 @@ var misc = { // Dates: //not a noun, but usually is Date: { - notA: ['Verb', 'Conjunction', 'Adverb', 'Preposition', 'Adjective'] + notA: ['Verb', 'Adverb', 'Preposition', 'Adjective'] }, Month: { isA: ['Date', 'Singular'], @@ -4214,7 +4219,7 @@ var addColors = function addColors(tags) { var _color = addColors; -var unique$2 = function unique(arr) { +var unique$3 = function unique(arr) { return arr.filter(function (v, i, a) { return a.indexOf(v) === i; }); @@ -4235,14 +4240,14 @@ var inferIsA = function inferIsA(tags) { } // clean it up - tag.isA = unique$2(tag.isA); + tag.isA = unique$3(tag.isA); }); return tags; }; var _isA = inferIsA; -var unique$3 = function unique(arr) { +var unique$2 = function unique(arr) { return arr.filter(function (v, i, a) { return a.indexOf(v) === i; }); @@ -4272,7 +4277,7 @@ var inferNotA = function inferNotA(tags) { } // clean it up - tag.notA = unique$3(tag.notA); + tag.notA = unique$2(tag.notA); }); return tags; }; @@ -4343,10 +4348,10 @@ var addIn = function addIn(obj, tags) { var build = function build() { var tags = {}; - addIn(nouns, tags); - addIn(verbs, tags); + addIn(nouns$1, tags); + addIn(verbs$1, tags); addIn(values, tags); - addIn(misc, tags); // do the graph-stuff + addIn(misc$1, tags); // do the graph-stuff tags = inference(tags); return tags; @@ -4376,7 +4381,7 @@ var _data = { "Actor": "true¦aJbGcFdCengineIfAgardenIh9instructPjournalLlawyIm8nurse,opeOp5r3s1t0;echnCherapK;ailNcientJecretary,oldiGu0;pervKrgeon;e0oofE;ceptionGsearC;hotographClumbColi1r0sychologF;actitionBogrammB;cem6t5;echanic,inist9us4;airdress8ousekeep8;arm7ire0;fight6m2;eputy,iet0;ici0;an;arpent2lerk;ricklay1ut0;ch0;er;ccoun6d2ge7r0ssis6ttenda7;chitect,t0;ist;minist1v0;is1;rat0;or;ta0;nt", "Honorific": "true¦a01bYcQdPeOfiJgIhon,jr,king,lHmCoffic00p7queen,r3s0taoiseach,vice6;e1fc,gt,ir,r,u0;ltRpt,rg;cond liInBrgeaJ;abbi,e0;ar1p9s,v0;!erend; admirX;astOhd,r0vt;esideDi1of0;!essM;me mini4nce0;!ss;a3essrs,i2lle,me,r1s0;!tr;!s;stK;gistrate,j,r6yF;i3lb,t;en,ov;eld mar3rst l0;ady,i0;eutena0;nt;shG;sq,xcellency;et,oct6r,utchess;apt6hance4mdr,o0pl;lonel,m2ngress0unci3;m0wom0;an;dr,mand5;ll0;or;!ain;ldg,rig0;!adi0;er;d0sst,tty,yatullah;j,m0v;!ir0;al", "SportsTeam": "true¦0:1A;1:1H;2:1G;a1Eb16c0Td0Kfc dallas,g0Ihouston 0Hindiana0Gjacksonville jagua0k0El0Bm01newToQpJqueens parkIreal salt lake,sAt5utah jazz,vancouver whitecaps,w3yW;ashington 3est ham0Rh10;natio1Oredski2wizar0W;ampa bay 6e5o3;ronto 3ttenham hotspur;blue ja0Mrapto0;nnessee tita2xasC;buccanee0ra0K;a7eattle 5heffield0Kporting kansas0Wt3;. louis 3oke0V;c1Frams;marine0s3;eah15ounG;cramento Rn 3;antonio spu0diego 3francisco gJjose earthquak1;char08paA; ran07;a8h5ittsburgh 4ortland t3;imbe0rail blaze0;pirat1steele0;il3oenix su2;adelphia 3li1;eagl1philNunE;dr1;akland 3klahoma city thunder,rlando magic;athle0Mrai3;de0; 3castle01;england 7orleans 6york 3;city fc,g4je0FknXme0Fred bul0Yy3;anke1;ian0D;pelica2sain0C;patrio0Brevolut3;ion;anchester Be9i3ontreal impact;ami 7lwaukee b6nnesota 3;t4u0Fvi3;kings;imberwolv1wi2;rewe0uc0K;dolphi2heat,marli2;mphis grizz3ts;li1;cXu08;a4eicesterVos angeles 3;clippe0dodDla9; galaxy,ke0;ansas city 3nE;chiefs,roya0E; pace0polis colU;astr06dynamo,rockeTtexa2;olden state warrio0reen bay pac3;ke0;.c.Aallas 7e3i05od5;nver 5troit 3;lio2pisto2ti3;ge0;broncZnuggeM;cowbo4maver3;ic00;ys; uQ;arCelKh8incinnati 6leveland 5ol3;orado r3umbus crew sc;api5ocki1;brow2cavalie0india2;bengaWre3;ds;arlotte horAicago 3;b4cubs,fire,wh3;iteB;ea0ulR;diff3olina panthe0; c3;ity;altimore 9lackburn rove0oston 5rooklyn 3uffalo bilN;ne3;ts;cel4red3; sox;tics;rs;oriol1rave2;rizona Ast8tlanta 3;brav1falco2h4u3;nited;aw9;ns;es;on villa,r3;os;c5di3;amondbac3;ks;ardi3;na3;ls", - "Uncountable": "true¦0:1I;1:1X;2:16;a1Rb1Jc1Ad17e10f0Ug0Nh0Ii0Ej0Dknowled1Ql08mYnews,oXpTrOsDt8vi7w3;a5ea0Bi4oo3;d,l;ldlife,ne;rmth,t0;neg17ol0Ctae;e6h5oothpaste,r3una;affTou3;ble,sers,t;ermod1Mund0;a,nnis;aBcene0Aeri2hAil9kittl2now,o8p6t4u3;g10nshi0Q;ati1Le3;am,el;ace1Ee3;ci2ed;ap,cc0;k,v0;eep,ingl2;d0Dfe18l3nd;m11t;a6e4ic3;e,ke0M;c3laxa0Isearch;ogni0Hrea0H;bi2in;aPe5hys1last9o3ress04;l3rk,w0;it1yA;a12trZ;bstetr1il,xygen;aAe8ilk,o5u3;mps,s3;ic;n3o0I;ey,o3;gamy;a3chan1;sl2t;chine3il,themat1; learn0Bry;aught0e5i4ogi0Su3;ck,g0I;ce,ghtn08ngui0QteratN;a3isM;th0;ewelAusti0L;ce,mp3nformaUtself;a3ortan0J;ti3;en0H;a6isto5o3;ck3mework,n3spitali0B;ey;ry;ir,libut,ppiD;ene6o4r3um,ymna0D;aCound;l3ssip;d,f; 3t1;editQpo3;ol;i7lour,o4urnit3;ure;od,rgive3uri0wl;ne3;ss;c9sh;conom1duca8lectr7n5quip6th1very3;body,o3thH;ne;joy3tertain3;ment;iciPon1;tiI;ar4iabet2raugh4;es;ts;aAelcius,h6iv1l5o3urrency;al,ld w3nfusiDttD;ar;ass1oth5;aos,e3;e4w3;ing;se;r7sh;a7eef,i4lood,owls,read,utt0;er;lliar4s3;on;ds;g3ss;ga3;ge;c8dvi7ero5ir4mnes3rt,thlet1;ty;craft;b1d3naut1;ynam1;ce;id,ou3;st1;ics", + "Uncountable": "true¦0:1I;1:1X;2:16;a1Rb1Jc1Ad17e10f0Ug0Nh0Ii0Ej0Dknowled1Ql08mYnews,oXpTrOsDt8vi7w3;a5ea0Bi4oo3;d,l;ldlife,ne;rmth,t0;neg17ol0Ctae;e6h5oothpaste,r3una;affTou3;ble,sers,t;ermod1Mund0;a,nnis;aBcene0Aeri2hAil9kittl2now,o8p6t4u3;g10nshi0Q;ati1Le3;am,el;ace1Ee3;ci2ed;ap,cc0;k,v0;eep,ingl2;d0Dfe18l3nd,tish;m11t;a6e4ic3;e,ke0M;c3laxa0Isearch;ogni0Hrea0H;bi2in;aPe5hys1last9o3ress04;l3rk,w0;it1yA;a12trZ;bstetr1il,xygen;aAe8ilk,o5u3;mps,s3;ic;n3o0I;ey,o3;gamy;a3chan1;sl2t;chine3il,themat1; learn0Bry;aught0e5i4ogi0Su3;ck,g0I;ce,ghtn08ngui0QteratN;a3isM;th0;ewelAusti0L;ce,mp3nformaUtself;a3ortan0J;ti3;en0H;a6isto5o3;ck3mework,n3spitali0B;ey;ry;ir,libut,ppiD;ene6o4r3um,ymna0D;aCound;l3ssip;d,f; 3t1;editQpo3;ol;i7lour,o4urnit3;ure;od,rgive3uri0wl;ne3;ss;c9sh;conom1duca8lectr7n5quip6th1very3;body,o3thH;ne;joy3tertain3;ment;iciPon1;tiI;ar4iabet2raugh4;es;ts;aAelcius,h6iv1l5o3urrency;al,ld w3nfusiDttD;ar;ass1oth5;aos,e3;e4w3;ing;se;r7sh;a7eef,i4lood,owls,read,utt0;er;lliar4s3;on;ds;g3ss;ga3;ge;c8dvi7ero5ir4mnes3rt,thlet1;ty;craft;b1d3naut1;ynam1;ce;id,ou3;st1;ics", "Infinitive": "true¦0:6S;1:76;2:5C;3:74;4:73;5:67;6:6F;7:6Y;8:6Q;9:72;A:70;B:6X;C:5X;D:77;E:6L;F:5B;a6Kb66c57d4De3Xf3Jg3Dh37i2Uj2Sk2Ql2Hm26n23o1Yp1Jr0Rs06tYuTvOwHyG;awn,ield;aJe1Zhist6iIoGre6D;nd0rG;k,ry;pe,sh,th0;lk,nHrGsh,tEve;n,raD;d0t;aJiHoG;te,w;eGsB;!w;l6Jry;nHpGr4se;gra4Pli41;dGi9lo5Zpub3Q;erGo;mi5Cw1I;aMeLhKig5SoJrHuGwi7;ne,rn;aGe0Mi5Uu7y;de,in,nsf0p,v5J;r2ZuE;ank,reatC;nd,st;lk,rg1Qs9;aZcWeVhTi4Dkip,lSmRnee3Lo52pQtJuGwitE;bmBck,ff0gge7ppHrGspe5;ge,pri1rou4Zvi3;ly,o36;aLeKoJrHuG;dy,mb6;aFeGi3;ngthCss,tE;p,re;m,p;in,ke,r0Qy;la58oil,rink6;e1Zi6o3J;am,ip;a2iv0oG;ck,rtCut;arEem,le5n1r3tt6;aHo2rG;atEew;le,re;il,ve;a05eIisk,oHuG;in,le,sh;am,ll;a01cZdu8fYgXje5lUmTnt,pQquPsKtJvGwa5V;eGiew,o36;al,l,rG;se,t;aFi2u44;eJi7oItG;!o2rG;i5uc20;l3rt;mb6nt,r3;e7i2;air,eHlGo43r0K;a8y;at;aFemb0i3Zo3;aHeGi3y;a1nt;te,x;a5Dr0J;act1Yer,le5u1;a13ei3k5PoGyc6;gni2Cnci6rd;ch,li2Bs5N;i1nG;ge,k;aTerSiRlOoMrIuG;b21ll,mp,rGsh;cha1s4Q;ai1eIiDoG;cGdu8greAhibBmi1te7vi2W;eAlaim;di5pa2ss,veD;iDp,rtr46sGur;e,t;aHead,uG;g,n4;n,y;ck,le;fo34mBsi7;ck,iDrt4Mss,u1;bJccur,ff0pera9utweIverGwe;co47lap,ta22u1wG;helm;igh;ser3taF;eHotG;e,i8;ed,gle5;aMeLiIoHuG;ltip3Grd0;nit13ve;nHrr12sreprG;eseD;d,g6us;asu2lt,n0Nr4;intaFna4rHtG;ch,t0;ch,kGry;et;aMeLiJoGu1C;aHck,oGve;k,sC;d,n;ft,g35ke,mBnk,st2YveG;!n;a2Fc0Et;b0Nck,uG;gh,nE;iGno34;ck,ll,ss;am,oFuG;d4mp;gno2mQnGss3H;cOdica9flu0MhNsKtIvG;eGol3;nt,st;erGrodu8;a5fe2;i7tG;aGru5;ll;abBibB;lu1Fr1D;agi24pG;lemeDo22ro3;aKeIi2oHuG;nt,rry;n02pe,st;aGlp;d,t;nd6ppCrm,te;aKloAove1PrIuG;arGeAi15;ant39d;aGip,ow,umb6;b,sp;in,th0ze;aReaQiOlMoJrHuncG;ti3J;acGeshC;tu2;cus,lHrG;ce,eca7m,s30;d,l24;a1ZoG;at,od,w;gu2lGni1Xt,x;e,l;r,tu2;il,stCvG;or;a15cho,le5mSnPstNvalua9xG;a0AcLerKi7pGte19;a18eHi2laFoGreA;rt,se;ct,riG;en8;ci1t;el,han4;abGima9;li1J;ab6couXdHfor8ga4han8j03riEsu2t0vG;isi2Vy;!u2;body,er4pG;hasiGow0;ze;a07eUiLoKrHuG;mp;aHeAiG;ft;g,in;d4ubt;ff0p,re5sHvG;iZor8;aKcHliGmiApl1Btingui14;ke;oGuA;uGv0;ra4;gr1YppG;ear,ro3;cOeNfLliv0ma0Fny,pKsHterG;mi0G;cribe,er3iHtrG;oy;gn,re;a0Be0Ai5osB;eGi0By;at,ct;m,pC;iIlHrG;ea1;a2i06;de;ma4n8rGte;e,kC;a0Ae09h06i9l04oJrG;aHeGoAu0Hy;a9dB;ck,ve;llZmSnHok,py,uGv0;gh,nt;cePdu5fMsKtIvG;eGin8;rt,y;aFin0VrG;a7ibu9ol;iGtitu9;d0st;iHoGroD;rm;gu2rm;rn;biLfoKmaJpG;a2laF;in;re;nd;rt;ne;ap1e5;aGip,o1;im,w;aHeG;at,ck,w;llen4n4r4se;a1nt0;ll,ncIrGt0u1;eGry;!en;el;aSePloOoMrIuG;lGry;ly;igHuG;sh;htC;en;a7mb,o7rrGth0un8;ow;ck;ar,lHnefBtrG;ay;ie3ong;ng,se;band0Jc0Bd06ffo05gr04id,l01mu1nYppTrQsKttGvoid,waB;acIeHra5;ct;m0Fnd;h,k;k,sG;eIiHocia9uG;me;gn,st;mb6rt;le;chHgGri3;ue;!i3;eaJlIroG;aEve;ch;aud,y;l,r;noun8sw0tG;icipa9;ce;lHt0;er;e4ow;ee;rd;aRdIju7mBoR;it;st;!reA;ss;cJhie3knowled4tiva9;te;ge;ve;eIouDu1;se;nt;pt;on", "Unit": "true¦0:19;a14b12c0Od0Ne0Lf0Gg0Ch09in0Hjoule0k02l00mNnMoLpIqHsqCt7volts,w6y4z3°2µ1;g,s;c,f,n;b,e2;a0Nb,d0Dears old,o1;tt0H;att0b;able4b3d,e2on1sp;!ne0;a2r0D;!l,sp;spo04; ft,uare 1;c0Id0Hf3i0Fkilo0Jm1ya0E;e0Mil1;e0li0H;eet0o0D;t,uart0;ascals,e2i1ou0Pt;c0Mnt0;rcent,t02;hms,uYz;an0JewtT;/s,b,e9g,i3l,m2p1²,³;h,s;!²;!/h,cro5l1;e1li08;! pFs1²;! 1;anEpD;g06s0B;gQter1;! 2s1;! 1;per second;b,i00m,u1x;men0x0;b,elvin0g,ilo2m1nR;!/h,ph,²;byZgXmeter1;! p2s1;! p1;er1; hour;e1g,r0z;ct1rtz0;aXogQ;al2b,igAra1;in0m0;!l1;on0;a4emtPl2t1;²,³; oz,uid ou1;nce0;hrenheit0rad0;b,x1;abyH;eciCg,l,mA;arat0eAg,m9oulomb0u1;bic 1p0;c5d4fo3i2meAya1;rd0;nch0;ot0;eci2;enti1;me4;!²,³;lsius0nti1;g2li1me1;ter0;ram0;bl,y1;te0;c4tt1;os1;eco1;nd0;re0;!s", "Organization": "true¦0:46;a3Ab2Qc2Ad21e1Xf1Tg1Lh1Gi1Dj19k17l13m0Sn0Go0Dp07qu06rZsStFuBv8w3y1;amaha,m0Xou1w0X;gov,tu2S;a3e1orld trade organizati41;lls fargo,st1;fie22inghou16;l1rner br3D;-m11gree31l street journ25m11;an halNeriz3Wisa,o1;dafo2Gl1;kswagLvo;bs,kip,n2ps,s1;a tod2Rps;es35i1;lev2Xted natio2Uv; mobi2Kaco bePd bMeAgi frida9h3im horto2Tmz,o1witt2W;shiba,y1;ota,s r Y;e 1in lizzy;b3carpen33daily ma2Xguess w2holli0rolling st1Ms1w2;mashing pumpki2Ouprem0;ho;ea1lack eyed pe3Fyrds;ch bo1tl0;ys;l2s1;co,la m12;efoni07us;a6e4ieme2Gnp,o2pice gir5ta1ubaru;rbucks,to2N;ny,undgard1;en;a2Rx pisto1;ls;few25insbu26msu1X;.e.m.,adiohead,b6e3oyal 1yan2X;b1dutch she4;ank;/max,aders dige1Ed 1vl32;bu1c1Uhot chili peppe2Klobst28;ll;c,s;ant2Vizno2F;an5bs,e3fiz24hilip morrBi2r1;emier27octer & gamb1Rudenti14;nk floyd,zza hut;psi28tro1uge08;br2Qchina,n2Q; 2ason1Xda2G;ld navy,pec,range juli2xf1;am;us;a9b8e5fl,h4i3o1sa,wa;kia,tre dame,vart1;is;ke,ntendo,ss0K;l,s;c,st1Etflix,w1; 1sweek;kids on the block,york08;a,c;nd1Us2t1;ional aca2Fo,we0Q;a,cYd0O;aAcdonald9e5i3lb,o1tv,yspace;b1Nnsanto,ody blu0t1;ley crue,or0O;crosoft,t1;as,subisO;dica3rcedes2talli1;ca;!-benz;id,re;'s,s;c's milk,tt13z1Y;'ore09a3e1g,ittle caesa1Ktd;novo,x1;is,mark; pres5-z-boy,bour party;atv,fc,kk,m1od1K;art;iffy lu0Lo3pmorgan1sa;! cha1;se;hnson & johns1Sy d1R;bm,hop,n1tv;c,g,te1;l,rpol; & m,asbro,ewlett-packaTi3o1sbc,yundai;me dep1n1J;ot;tac1zbollah;hi;eneral 6hq,l5mb,o2reen d0Iu1;cci,ns n ros0;ldman sachs,o1;dye1g0B;ar;axo smith kliZencore;electr0Im1;oto0V;a3bi,da,edex,i1leetwood mac,oGrito-l0A;at,nancial1restoV; tim0;cebook,nnie mae;b06sa,u3xxon1; m1m1;ob0H;!rosceptics;aiml0Ae5isney,o3u1;nkin donuts,po0Wran dur1;an;j,w j1;on0;a,f leppa3ll,p2r spiegZstiny's chi1;ld;eche mode,t;rd;aEbc,hBi9nn,o3r1;aigsli5eedence clearwater reviv1ossra05;al;!ca c5l4m1o0Ast05;ca2p1;aq;st;dplMgate;ola;a,sco1tigroup;! systems;ev2i1;ck fil-a,na daily;r0Hy;dbury,pital o1rl's jr;ne;aGbc,eCfAl6mw,ni,o2p,r1;exiteeWos;ei3mbardiJston 1;glo1pizza;be;ng;ack & deckFo2ue c1;roX;ckbuster video,omingda1;le; g1g1;oodriN;cht3e ge0n & jer2rkshire hathaw1;ay;ryH;el;nana republ3s1xt5y5;f,kin robbi1;ns;ic;bXcSdidRerosmith,ig,lLmFnheuser-busEol,ppleAr7s3t&t,v2y1;er;is,on;hland2s1;n,ociated F; o1;il;by4g2m1;co;os; compu2bee1;'s;te1;rs;ch;c,d,erican3t1;!r1;ak; ex1;pre1;ss; 4catel2t1;air;!-luce1;nt;jazeera,qae1;da;as;/dc,a3er,t1;ivisi1;on;demy of scienc0;es;ba,c", @@ -4407,7 +4412,7 @@ var _data = { }; var seq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", - cache = seq.split("").reduce(function (n, o, e) { + cache$1 = seq.split("").reduce(function (n, o, e) { return n[o] = e, n; }, {}), toAlphaCode = function toAlphaCode(n) { @@ -4428,7 +4433,7 @@ var seq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", return t; }, fromAlphaCode = function fromAlphaCode(n) { - if (void 0 !== cache[n]) return cache[n]; + if (void 0 !== cache$1[n]) return cache$1[n]; var o = 0, e = 1, t = 36, @@ -4505,15 +4510,15 @@ var indexFromRef = function indexFromRef(n, o, e) { return n.match(":") && symbols(o), toArray(o); }; -var unpack_1 = unpack, - unpack_1$1 = function unpack_1$1(n) { +var unpack_1$1 = unpack, + unpack_1$1$1 = function unpack_1$1$1(n) { var o = n.split("|").reduce(function (n, o) { var e = o.split("¦"); return n[e[0]] = e[1], n; }, {}), e = {}; return Object.keys(o).forEach(function (n) { - var t = unpack_1(o[n]); + var t = unpack_1$1(o[n]); "true" === n && (n = !0); for (var _o2 = 0; _o2 < t.length; _o2++) { @@ -4523,10 +4528,10 @@ var unpack_1 = unpack, }), e; }; -var efrtUnpack_min = unpack_1$1; +var efrtUnpack_min = unpack_1$1$1; //words that can't be compressed, for whatever reason -var misc$1 = { +var misc = { // numbers '20th century fox': 'Organization', // '3m': 'Organization', @@ -4655,7 +4660,7 @@ var addWords = function addWords(wordsObj, lex, world) { var buildOut = function buildOut(world) { //our bag of words - var lexicon = Object.assign({}, misc$1); // start adding words to the lex + var lexicon = Object.assign({}, misc); // start adding words to the lex Object.keys(_data).forEach(function (tag) { var wordsObj = efrtUnpack_min(_data[tag]); // this part sucks @@ -4669,7 +4674,7 @@ var buildOut = function buildOut(world) { return lexicon; }; -var unpack_1$2 = { +var unpack_1 = { buildOut: buildOut, addWords: addWords }; @@ -4798,7 +4803,7 @@ var plurals = { // used in verbs().conjugate() // but also added to our lexicon //use shorter key-names -var mapping = { +var mapping$1 = { g: 'Gerund', prt: 'Participle', perf: 'PerfectTense', @@ -5504,7 +5509,7 @@ var _loop = function _loop(i) { var str = conjugations[inf][key]; //swap-in infinitives for '_' str = str.replace('_', inf); - var full = mapping[key]; + var full = mapping$1[key]; _final[full] = str; }); //over-write original @@ -5517,7 +5522,7 @@ for (var i = 0; i < keys.length; i++) { var conjugations_1 = conjugations; -var endsWith = { +var endsWith$1 = { b: [{ reg: /([^aeiou][aeiou])b$/i, repl: { @@ -5774,7 +5779,7 @@ var endsWith = { } }] }; -var suffixes = endsWith; +var suffixes$1 = endsWith$1; var posMap = { pr: 'PresentTense', @@ -5801,12 +5806,12 @@ var checkSuffix = function checkSuffix() { var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var c = str[str.length - 1]; - if (suffixes.hasOwnProperty(c) === true) { - for (var r = 0; r < suffixes[c].length; r += 1) { - var reg = suffixes[c][r].reg; + if (suffixes$1.hasOwnProperty(c) === true) { + for (var r = 0; r < suffixes$1[c].length; r += 1) { + var reg = suffixes$1[c][r].reg; if (reg.test(str) === true) { - return doTransform(str, suffixes[c][r]); + return doTransform(str, suffixes$1[c][r]); } } } @@ -5857,7 +5862,7 @@ var _02Generic = generic; //we assume the input word is a proper infinitive -var conjugate = function conjugate() { +var conjugate$2 = function conjugate() { var inf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var world = arguments.length > 1 ? arguments[1] : undefined; var found = {}; // 1. look at irregulars @@ -5890,12 +5895,12 @@ var conjugate = function conjugate() { return found; }; -var conjugate_1 = conjugate; // console.log(conjugate('bake')) +var conjugate_1$1 = conjugate$2; // console.log(conjugate('bake')) //turn 'quick' into 'quickest' -var do_rules = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /oud$/, /...p$/]; -var dont_rules = [/ary$/]; -var irregulars = { +var do_rules$1 = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /oud$/, /...p$/]; +var dont_rules$1 = [/ary$/]; +var irregulars$5 = { nice: 'nicest', late: 'latest', hard: 'hardest', @@ -5908,7 +5913,7 @@ var irregulars = { big: 'biggest', large: 'largest' }; -var transforms = [{ +var transforms$2 = [{ reg: /y$/i, repl: 'iest' }, { @@ -5927,27 +5932,27 @@ var transforms = [{ var to_superlative = function to_superlative(str) { //irregulars - if (irregulars.hasOwnProperty(str)) { - return irregulars[str]; + if (irregulars$5.hasOwnProperty(str)) { + return irregulars$5[str]; } //known transforms - for (var i = 0; i < transforms.length; i++) { - if (transforms[i].reg.test(str)) { - return str.replace(transforms[i].reg, transforms[i].repl); + for (var i = 0; i < transforms$2.length; i++) { + if (transforms$2[i].reg.test(str)) { + return str.replace(transforms$2[i].reg, transforms$2[i].repl); } } //dont-rules - for (var _i = 0; _i < dont_rules.length; _i++) { - if (dont_rules[_i].test(str) === true) { + for (var _i = 0; _i < dont_rules$1.length; _i++) { + if (dont_rules$1[_i].test(str) === true) { return null; } } //do-rules - for (var _i2 = 0; _i2 < do_rules.length; _i2++) { - if (do_rules[_i2].test(str) === true) { + for (var _i2 = 0; _i2 < do_rules$1.length; _i2++) { + if (do_rules$1[_i2].test(str) === true) { if (str.charAt(str.length - 1) === 'e') { return str + 'st'; } @@ -5962,9 +5967,9 @@ var to_superlative = function to_superlative(str) { var toSuperlative = to_superlative; //turn 'quick' into 'quickly' -var do_rules$1 = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /old$/, /oud$/, /e[ae]p$/]; -var dont_rules$1 = [/ary$/, /ous$/]; -var irregulars$1 = { +var do_rules = [/ght$/, /nge$/, /ough$/, /ain$/, /uel$/, /[au]ll$/, /ow$/, /old$/, /oud$/, /e[ae]p$/]; +var dont_rules = [/ary$/, /ous$/]; +var irregulars$4 = { grey: 'greyer', gray: 'grayer', green: 'greener', @@ -5992,8 +5997,8 @@ var transforms$1 = [{ var to_comparative = function to_comparative(str) { //known-irregulars - if (irregulars$1.hasOwnProperty(str)) { - return irregulars$1[str]; + if (irregulars$4.hasOwnProperty(str)) { + return irregulars$4[str]; } //known-transforms @@ -6004,15 +6009,15 @@ var to_comparative = function to_comparative(str) { } //dont-patterns - for (var _i = 0; _i < dont_rules$1.length; _i++) { - if (dont_rules$1[_i].test(str) === true) { + for (var _i = 0; _i < dont_rules.length; _i++) { + if (dont_rules[_i].test(str) === true) { return null; } } //do-patterns - for (var _i2 = 0; _i2 < do_rules$1.length; _i2++) { - if (do_rules$1[_i2].test(str) === true) { + for (var _i2 = 0; _i2 < do_rules.length; _i2++) { + if (do_rules[_i2].test(str) === true) { return str + 'er'; } } //easy-one @@ -6027,7 +6032,7 @@ var to_comparative = function to_comparative(str) { var toComparative = to_comparative; -var fns$1 = { +var fns = { toSuperlative: toSuperlative, toComparative: toComparative }; @@ -6036,14 +6041,14 @@ var fns$1 = { var conjugate$1 = function conjugate(w) { var res = {}; // 'greatest' - var sup = fns$1.toSuperlative(w); + var sup = fns.toSuperlative(w); if (sup) { res.Superlative = sup; } // 'greater' - var comp = fns$1.toComparative(w); + var comp = fns.toComparative(w); if (comp) { res.Comparative = comp; @@ -6052,10 +6057,10 @@ var conjugate$1 = function conjugate(w) { return res; }; -var adjectives = conjugate$1; +var adjectives$2 = conjugate$1; /** patterns for turning 'bus' to 'buses'*/ -var suffixes$1 = { +var suffixes = { a: [[/(antenn|formul|nebul|vertebr|vit)a$/i, '$1ae'], [/([ti])a$/i, '$1a']], e: [[/(kn|l|w)ife$/i, '$1ives'], [/(hive)$/i, '$1s'], [/([m|l])ouse$/i, '$1ice'], [/([m|l])ice$/i, '$1ice']], f: [[/^(dwar|handkerchie|hoo|scar|whar)f$/i, '$1ves'], [/^((?:ca|e|ha|(?:our|them|your)?se|she|wo)l|lea|loa|shea|thie)f$/i, '$1ves']], @@ -6068,19 +6073,19 @@ var suffixes$1 = { y: [[/([^aeiouy]|qu)y$/i, '$1ies']], z: [[/(quiz)$/i, '$1zes']] }; -var _rules = suffixes$1; +var _rules$2 = suffixes; var addE = /(x|ch|sh|s|z)$/; var trySuffix = function trySuffix(str) { var c = str[str.length - 1]; - if (_rules.hasOwnProperty(c) === true) { - for (var i = 0; i < _rules[c].length; i += 1) { - var reg = _rules[c][i][0]; + if (_rules$2.hasOwnProperty(c) === true) { + for (var i = 0; i < _rules$2[c].length; i += 1) { + var reg = _rules$2[c][i][0]; if (reg.test(str) === true) { - return str.replace(reg, _rules[c][i][1]); + return str.replace(reg, _rules$2[c][i][1]); } } } @@ -6392,7 +6397,7 @@ var guessTense = function guessTense(str) { return null; }; -var toInfinitive = function toInfinitive(str, world, tense) { +var toInfinitive$1 = function toInfinitive(str, world, tense) { if (!str) { return ''; } //1. look at known irregulars @@ -6430,19 +6435,19 @@ var toInfinitive = function toInfinitive(str, world, tense) { return str; }; -var toInfinitive_1 = toInfinitive; +var toInfinitive_1$1 = toInfinitive$1; -var irregulars$2 = { +var irregulars$3 = { nouns: plurals, verbs: conjugations_1 }; //these behaviours are configurable & shared across some plugins -var transforms$2 = { - conjugate: conjugate_1, - adjectives: adjectives, +var transforms = { + conjugate: conjugate_1$1, + adjectives: adjectives$2, toPlural: toPlural, toSingular: toSingular_1, - toInfinitive: toInfinitive_1 + toInfinitive: toInfinitive_1$1 }; var _isVerbose = false; /** all configurable linguistic data */ @@ -6464,7 +6469,7 @@ var World = /*#__PURE__*/function () { }); Object.defineProperty(this, 'irregulars', { enumerable: false, - value: irregulars$2, + value: irregulars$3, writable: true }); Object.defineProperty(this, 'tags', { @@ -6474,7 +6479,7 @@ var World = /*#__PURE__*/function () { }); Object.defineProperty(this, 'transforms', { enumerable: false, - value: transforms$2, + value: transforms, writable: true }); Object.defineProperty(this, 'taggers', { @@ -6490,7 +6495,7 @@ var World = /*#__PURE__*/function () { } }); // add our compressed data to lexicon - this.words = unpack_1$2.buildOut(this); // add our irregulars to lexicon + this.words = unpack_1.buildOut(this); // add our irregulars to lexicon addIrregulars_1(this); } @@ -6520,7 +6525,7 @@ var World = /*#__PURE__*/function () { w = w.toLowerCase().trim(); cleaned[w] = tag; }); - unpack_1$2.addWords(cleaned, this.words, this); + unpack_1.addWords(cleaned, this.words, this); } /** add new custom conjugations */ @@ -6576,7 +6581,7 @@ var World = /*#__PURE__*/function () { }(); // ¯\_(:/)_/¯ -var clone$1 = function clone(obj) { +var clone = function clone(obj) { return JSON.parse(JSON.stringify(obj)); }; /** produce a deep-copy of all lingustic data */ @@ -6588,8 +6593,8 @@ World.prototype.clone = function () { w2.words = Object.assign({}, this.words); w2.hasCompound = Object.assign({}, this.hasCompound); //these ones are nested: - w2.irregulars = clone$1(this.irregulars); - w2.tags = clone$1(this.tags); // these are functions + w2.irregulars = clone(this.irregulars); + w2.tags = clone(this.tags); // these are functions w2.transforms = this.transforms; w2.taggers = this.taggers; @@ -6600,7 +6605,7 @@ var World_1 = World; /** return the root, first document */ -var _01Utils$1 = createCommonjsModule(function (module, exports) { +var _01Utils = createCommonjsModule(function (module, exports) { exports.all = function () { return this.parents()[0] || this; }; @@ -6839,7 +6844,7 @@ var _02Accessors = createCommonjsModule(function (module, exports) { }); // cache the easier conditions up-front -var cacheRequired = function cacheRequired(reg) { +var cacheRequired$1 = function cacheRequired(reg) { var needTags = []; var needWords = []; reg.forEach(function (obj) { @@ -6862,9 +6867,9 @@ var cacheRequired = function cacheRequired(reg) { }; // try to pre-fail as many matches as possible, without doing them -var failFast$1 = function failFast(doc, regs) { +var failFast = function failFast(doc, regs) { if (doc._cache && doc._cache.set === true) { - var _cacheRequired = cacheRequired(regs), + var _cacheRequired = cacheRequired$1(regs), words = _cacheRequired.words, tags = _cacheRequired.tags; //check required words @@ -6886,7 +6891,7 @@ var failFast$1 = function failFast(doc, regs) { return true; }; -var _failFast = failFast$1; +var _failFast = failFast; var _03Match = createCommonjsModule(function (module, exports) { /** return a new Doc, with this one as a parent */ @@ -7161,7 +7166,7 @@ var _setTag = tagTerms; /** Give all terms the given tag */ -var tag$1 = function tag(tags, why) { +var tag = function tag(tags, why) { if (!tags) { return this; } @@ -7172,7 +7177,7 @@ var tag$1 = function tag(tags, why) { /** Only apply tag to terms if it is consistent with current tags */ -var tagSafe$1 = function tagSafe(tags, why) { +var tagSafe = function tagSafe(tags, why) { if (!tags) { return this; } @@ -7183,7 +7188,7 @@ var tagSafe$1 = function tagSafe(tags, why) { /** Remove this term from the given terms */ -var unTag$1 = function unTag(tags, why) { +var unTag = function unTag(tags, why) { var _this = this; this.list.forEach(function (p) { @@ -7196,7 +7201,7 @@ var unTag$1 = function unTag(tags, why) { /** return only the terms that can be this tag*/ -var canBe$2 = function canBe(tag) { +var canBe = function canBe(tag) { if (!tag) { return this; } @@ -7209,10 +7214,10 @@ var canBe$2 = function canBe(tag) { }; var _04Tag = { - tag: tag$1, - tagSafe: tagSafe$1, - unTag: unTag$1, - canBe: canBe$2 + tag: tag, + tagSafe: tagSafe, + unTag: unTag, + canBe: canBe }; /* run each phrase through a function, and create a new document */ @@ -7544,7 +7549,7 @@ var _06Lookup = createCommonjsModule(function (module, exports) { }); /** freeze the current state of the document, for speed-purposes*/ -var cache$1 = function cache(options) { +var cache = function cache(options) { var _this = this; options = options || {}; @@ -7597,11 +7602,11 @@ var uncache = function uncache() { }; var _07Cache = { - cache: cache$1, + cache: cache, uncache: uncache }; -var titleCase$3 = function titleCase(str) { +var titleCase$1 = function titleCase(str) { return str.charAt(0).toUpperCase() + str.substr(1); }; /** substitute-in new content */ @@ -7649,7 +7654,7 @@ var replaceWith = function replaceWith(replace) { } else if (typeof input === 'string') { //input is a string if (options.keepCase !== false && p.terms(0).isTitleCase()) { - input = titleCase$3(input); + input = titleCase$1(input); } newPhrases = _01Tokenizer(input, _this.world, _this.pool()); //tag the new phrases @@ -7683,7 +7688,7 @@ var replaceWith = function replaceWith(replace) { /** search and replace match with new content */ -var replace$1 = function replace(match, _replace, options) { +var replace = function replace(match, _replace, options) { // if there's no 2nd param, use replaceWith if (_replace === undefined) { return this.replaceWith(match, options); @@ -7695,7 +7700,7 @@ var replace$1 = function replace(match, _replace, options) { var _01Replace = { replaceWith: replaceWith, - replace: replace$1 + replace: replace }; var _02Insert = createCommonjsModule(function (module, exports) { @@ -7846,7 +7851,7 @@ var shouldTrim = { }; /** return the document as text */ -var text$1 = function text(options) { +var text = function text(options) { var _this = this; options = options || {}; //are we showing every phrase? @@ -7882,7 +7887,7 @@ var text$1 = function text(options) { }; var _01Text = { - text: text$1 + text: text }; // get all character startings in doc @@ -8290,7 +8295,7 @@ var _03Out = { out: out }; -var methods$2 = { +var methods$6 = { /** alphabetical order */ alpha: function alpha(a, b) { var left = a.text('clean'); @@ -8395,8 +8400,8 @@ var sortSequential = function sortSequential(doc) { }; //aliases -methods$2.alphabetical = methods$2.alpha; -methods$2.wordcount = methods$2.wordCount; // aliases for sequential ordering +methods$6.alphabetical = methods$6.alpha; +methods$6.wordcount = methods$6.wordCount; // aliases for sequential ordering var seqNames = { index: true, @@ -8419,7 +8424,7 @@ var sort = function sort(input) { return sortSequential(this); } - input = methods$2[input] || input; // apply sort method on each phrase + input = methods$6[input] || input; // apply sort method on each phrase if (typeof input === 'function') { this.list = this.list.sort(input); @@ -8439,7 +8444,7 @@ var reverse = function reverse() { /** remove any duplicate matches */ -var unique$4 = function unique() { +var unique$1 = function unique() { var list = [].concat(this.list); var obj = {}; list = list.filter(function (p) { @@ -8458,12 +8463,12 @@ var unique$4 = function unique() { var _01Sort = { sort: sort, reverse: reverse, - unique: unique$4 + unique: unique$1 }; var isPunct = /[\[\]{}⟨⟩:,،、‒–—―…‹›«»‐\-;\/⁄·*\•^†‡°¡¿※№÷׺ª%‰=‱¶§~|‖¦©℗®℠™¤₳฿]/g; var quotes = /['‘’“”"′″‴]+/g; -var methods$3 = { +var methods$5 = { // cleanup newlines and extra spaces whitespace: function whitespace(doc) { var termArr = doc.list.map(function (ts) { @@ -8553,7 +8558,7 @@ var methods$3 = { }); } }; -var _methods = methods$3; +var _methods = methods$5; var defaults = { // light @@ -8576,7 +8581,7 @@ var defaults = { honorifics: false // pronouns: true, }; -var mapping$1 = { +var mapping = { light: {}, medium: { "case": true, @@ -8586,7 +8591,7 @@ var mapping$1 = { adverbs: true } }; -mapping$1.heavy = Object.assign({}, mapping$1.medium, { +mapping.heavy = Object.assign({}, mapping.medium, { possessives: true, verbs: true, nouns: true, @@ -8598,7 +8603,7 @@ var normalize = function normalize(options) { options = options || {}; // support named forms if (typeof options === 'string') { - options = mapping$1[options] || {}; + options = mapping[options] || {}; } // set defaults @@ -9168,13 +9173,13 @@ var _07Contract = { contract: contract }; -var methods$4 = Object.assign({}, _01Utils$1, _02Accessors, _03Match, _04Tag, _05Loops, _06Lookup, _07Cache, _01Replace, _02Insert, _01Text, _02Json, _03Out, _01Sort, _02Normalize, _03Split, _04Case, _05Whitespace, _06Join, _07Contract); +var methods$4 = Object.assign({}, _01Utils, _02Accessors, _03Match, _04Tag, _05Loops, _06Lookup, _07Cache, _01Replace, _02Insert, _01Text, _02Json, _03Out, _01Sort, _02Normalize, _03Split, _04Case, _05Whitespace, _06Join, _07Contract); -var methods$5 = {}; // allow helper methods like .adjectives() and .adverbs() +var methods$3 = {}; // allow helper methods like .adjectives() and .adverbs() var arr = [['terms', '.'], ['hyphenated', '@hasHyphen .'], ['adjectives', '#Adjective'], ['hashTags', '#HashTag'], ['emails', '#Email'], ['emoji', '#Emoji'], ['emoticons', '#Emoticon'], ['atMentions', '#AtMention'], ['urls', '#Url'], ['adverbs', '#Adverb'], ['pronouns', '#Pronoun'], ['conjunctions', '#Conjunction'], ['prepositions', '#Preposition']]; arr.forEach(function (a) { - methods$5[a[0]] = function (n) { + methods$3[a[0]] = function (n) { var m = this.match(a[1]); if (typeof n === 'number') { @@ -9185,12 +9190,12 @@ arr.forEach(function (a) { }; }); // aliases -methods$5.emojis = methods$5.emoji; -methods$5.atmentions = methods$5.atMentions; -methods$5.words = methods$5.terms; +methods$3.emojis = methods$3.emoji; +methods$3.atmentions = methods$3.atMentions; +methods$3.words = methods$3.terms; /** return anything tagged as a phone number */ -methods$5.phoneNumbers = function (n) { +methods$3.phoneNumbers = function (n) { var m = this.splitAfter('@hasComma'); m = m.match('#PhoneNumber+'); @@ -9203,7 +9208,7 @@ methods$5.phoneNumbers = function (n) { /** Deprecated: please use compromise-numbers plugin */ -methods$5.money = function (n) { +methods$3.money = function (n) { var m = this.match('#Money #Currency?'); if (typeof n === 'number') { @@ -9215,7 +9220,7 @@ methods$5.money = function (n) { /** return all cities, countries, addresses, and regions */ -methods$5.places = function (n) { +methods$3.places = function (n) { // don't split 'paris, france' var keep = this.match('(#City && @hasComma) (#Region|#Country)'); // but split the other commas @@ -9234,7 +9239,7 @@ methods$5.places = function (n) { /** return all schools, businesses and institutions */ -methods$5.organizations = function (n) { +methods$3.organizations = function (n) { var m = this.clauses(); m = m.match('#Organization+'); @@ -9246,7 +9251,7 @@ methods$5.organizations = function (n) { }; //combine them with .topics() method -methods$5.entities = function (n) { +methods$3.entities = function (n) { var r = this.clauses(); // Find people, places, and organizations var yup = r.people(); @@ -9265,9 +9270,9 @@ methods$5.entities = function (n) { }; //aliases -methods$5.things = methods$5.entities; -methods$5.topics = methods$5.entities; -var _simple = methods$5; +methods$3.things = methods$3.entities; +methods$3.topics = methods$3.entities; +var _simple = methods$3; var underOver = /^(under|over)-?/; /** match a word-sequence, like 'super bowl' in the lexicon */ @@ -9404,7 +9409,7 @@ var checkPunctuation = function checkPunctuation(terms, i, world) { }; -var _02Punctuation$1 = checkPunctuation; +var _02Punctuation = checkPunctuation; //these are regexes applied to t.text, instead of t.clean // order matters. @@ -9467,7 +9472,7 @@ var romanNumeral = /^[IVXLCDM]{2,}$/; var romanNumValid = /^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/; // https://stackoverflow.com/a/267405/168877 //try each of the ^regexes in our list -var checkRegex = function checkRegex(term, world) { +var checkRegex$1 = function checkRegex(term, world) { var str = term.text; // do them all! for (var r = 0; r < startsWith.length; r += 1) { @@ -9484,99 +9489,99 @@ var checkRegex = function checkRegex(term, world) { } }; -var _03Prefixes = checkRegex; +var _03Prefixes = checkRegex$1; //regex suffix patterns and their most common parts of speech, //built using wordnet, by spencer kelly. //this mapping shrinks-down the uglified build -var Adj = 'Adjective'; -var Inf = 'Infinitive'; -var Pres = 'PresentTense'; -var Sing = 'Singular'; -var Past = 'PastTense'; +var Adj$1 = 'Adjective'; +var Inf$1 = 'Infinitive'; +var Pres$1 = 'PresentTense'; +var Sing$1 = 'Singular'; +var Past$1 = 'PastTense'; var Adverb = 'Adverb'; var Exp = 'Expression'; -var Actor = 'Actor'; +var Actor$1 = 'Actor'; var Verb = 'Verb'; -var Noun = 'Noun'; -var Last = 'LastName'; //the order here matters. +var Noun$1 = 'Noun'; +var Last$1 = 'LastName'; //the order here matters. //regexes indexed by mandated last-character -var endsWith$1 = { - a: [[/.[aeiou]na$/, Noun], [/.[oau][wvl]ska$/, Last], //polish (female) - [/.[^aeiou]ica$/, Sing], [/^([hyj]a)+$/, Exp] //hahah +var endsWith = { + a: [[/.[aeiou]na$/, Noun$1], [/.[oau][wvl]ska$/, Last$1], //polish (female) + [/.[^aeiou]ica$/, Sing$1], [/^([hyj]a)+$/, Exp] //hahah ], - c: [[/.[^aeiou]ic$/, Adj]], + c: [[/.[^aeiou]ic$/, Adj$1]], d: [//==-ed== //double-consonant - [/[aeiou](pp|ll|ss|ff|gg|tt|rr|bb|nn|mm)ed$/, Past], //popped, planned + [/[aeiou](pp|ll|ss|ff|gg|tt|rr|bb|nn|mm)ed$/, Past$1], //popped, planned //double-vowel - [/.[aeo]{2}[bdgmnprvz]ed$/, Past], //beeped, mooned, veered + [/.[aeo]{2}[bdgmnprvz]ed$/, Past$1], //beeped, mooned, veered //-hed - [/.[aeiou][sg]hed$/, Past], //stashed, sighed + [/.[aeiou][sg]hed$/, Past$1], //stashed, sighed //-rd - [/.[aeiou]red$/, Past], //stored - [/.[aeiou]r?ried$/, Past], //buried + [/.[aeiou]red$/, Past$1], //stored + [/.[aeiou]r?ried$/, Past$1], //buried //-led - [/.[bcdgtr]led$/, Past], //startled, rumbled - [/.[aoui]f?led$/, Past], //impaled, stifled + [/.[bcdgtr]led$/, Past$1], //startled, rumbled + [/.[aoui]f?led$/, Past$1], //impaled, stifled //-sed - [/.[iao]sed$/, Past], //franchised - [/[aeiou]n?[cs]ed$/, Past], //laced, lanced + [/.[iao]sed$/, Past$1], //franchised + [/[aeiou]n?[cs]ed$/, Past$1], //laced, lanced //-med - [/[aeiou][rl]?[mnf]ed$/, Past], //warmed, attained, engulfed + [/[aeiou][rl]?[mnf]ed$/, Past$1], //warmed, attained, engulfed //-ked - [/[aeiou][ns]?c?ked$/, Past], //hooked, masked + [/[aeiou][ns]?c?ked$/, Past$1], //hooked, masked //-ged - [/[aeiou][nl]?ged$/, Past], //engaged + [/[aeiou][nl]?ged$/, Past$1], //engaged //-ted - [/.[tdbwxz]ed$/, Past], //bribed, boxed - [/[^aeiou][aeiou][tvx]ed$/, Past], //boxed + [/.[tdbwxz]ed$/, Past$1], //bribed, boxed + [/[^aeiou][aeiou][tvx]ed$/, Past$1], //boxed //-ied - [/.[cdlmnprstv]ied$/, Past], //rallied - [/[^aeiou]ard$/, Sing], //card - [/[aeiou][^aeiou]id$/, Adj], [/.[vrl]id$/, Adj]], - e: [[/.[lnr]ize$/, Inf], [/.[^aeiou]ise$/, Inf], [/.[aeiou]te$/, Inf], [/.[^aeiou][ai]ble$/, Adj], [/.[^aeiou]eable$/, Adj], [/.[ts]ive$/, Adj]], - h: [[/.[^aeiouf]ish$/, Adj], [/.v[iy]ch$/, Last], //east-europe + [/.[cdlmnprstv]ied$/, Past$1], //rallied + [/[^aeiou]ard$/, Sing$1], //card + [/[aeiou][^aeiou]id$/, Adj$1], [/.[vrl]id$/, Adj$1]], + e: [[/.[lnr]ize$/, Inf$1], [/.[^aeiou]ise$/, Inf$1], [/.[aeiou]te$/, Inf$1], [/.[^aeiou][ai]ble$/, Adj$1], [/.[^aeiou]eable$/, Adj$1], [/.[ts]ive$/, Adj$1]], + h: [[/.[^aeiouf]ish$/, Adj$1], [/.v[iy]ch$/, Last$1], //east-europe [/^ug?h+$/, Exp], //uhh [/^uh[ -]?oh$/, Exp] //uhoh ], - i: [[/.[oau][wvl]ski$/, Last] //polish (male) + i: [[/.[oau][wvl]ski$/, Last$1] //polish (male) ], k: [[/^(k){2}$/, Exp] //kkkk ], - l: [[/.[gl]ial$/, Adj], [/.[^aeiou]ful$/, Adj], [/.[nrtumcd]al$/, Adj], [/.[^aeiou][ei]al$/, Adj]], - m: [[/.[^aeiou]ium$/, Sing], [/[^aeiou]ism$/, Sing], [/^h*u*m+$/, Exp], //mmmmmmm / ummmm / huuuuuummmmmm + l: [[/.[gl]ial$/, Adj$1], [/.[^aeiou]ful$/, Adj$1], [/.[nrtumcd]al$/, Adj$1], [/.[^aeiou][ei]al$/, Adj$1]], + m: [[/.[^aeiou]ium$/, Sing$1], [/[^aeiou]ism$/, Sing$1], [/^h*u*m+$/, Exp], //mmmmmmm / ummmm / huuuuuummmmmm [/^\d+ ?[ap]m$/, 'Date']], - n: [[/.[lsrnpb]ian$/, Adj], [/[^aeiou]ician$/, Actor], [/[aeiou][ktrp]in$/, 'Gerund'] // 'cookin', 'hootin' + n: [[/.[lsrnpb]ian$/, Adj$1], [/[^aeiou]ician$/, Actor$1], [/[aeiou][ktrp]in$/, 'Gerund'] // 'cookin', 'hootin' ], o: [[/^no+$/, Exp], //noooo [/^(yo)+$/, Exp], //yoyo [/^woo+[pt]?$/, Exp] //woo ], - r: [[/.[bdfklmst]ler$/, 'Noun'], [/[aeiou][pns]er$/, Sing], [/[^i]fer$/, Inf], [/.[^aeiou][ao]pher$/, Actor], [/.[lk]er$/, 'Noun'], [/.ier$/, 'Comparative']], - t: [[/.[di]est$/, 'Superlative'], [/.[icldtgrv]ent$/, Adj], [/[aeiou].*ist$/, Adj], [/^[a-z]et$/, Verb]], - s: [[/.[^aeiou]ises$/, Pres], [/.[rln]ates$/, Pres], [/.[^z]ens$/, Verb], [/.[lstrn]us$/, Sing], [/.[aeiou]sks$/, Pres], //masks - [/.[aeiou]kes$/, Pres], //bakes - [/[aeiou][^aeiou]is$/, Sing], [/[a-z]\'s$/, Noun], [/^yes+$/, Exp] //yessss + r: [[/.[bdfklmst]ler$/, 'Noun'], [/[aeiou][pns]er$/, Sing$1], [/[^i]fer$/, Inf$1], [/.[^aeiou][ao]pher$/, Actor$1], [/.[lk]er$/, 'Noun'], [/.ier$/, 'Comparative']], + t: [[/.[di]est$/, 'Superlative'], [/.[icldtgrv]ent$/, Adj$1], [/[aeiou].*ist$/, Adj$1], [/^[a-z]et$/, Verb]], + s: [[/.[^aeiou]ises$/, Pres$1], [/.[rln]ates$/, Pres$1], [/.[^z]ens$/, Verb], [/.[lstrn]us$/, Sing$1], [/.[aeiou]sks$/, Pres$1], //masks + [/.[aeiou]kes$/, Pres$1], //bakes + [/[aeiou][^aeiou]is$/, Sing$1], [/[a-z]\'s$/, Noun$1], [/^yes+$/, Exp] //yessss ], - v: [[/.[^aeiou][ai][kln]ov$/, Last] //east-europe + v: [[/.[^aeiou][ai][kln]ov$/, Last$1] //east-europe ], - y: [[/.[cts]hy$/, Adj], [/.[st]ty$/, Adj], [/.[gk]y$/, Adj], [/.[tnl]ary$/, Adj], [/.[oe]ry$/, Sing], [/[rdntkbhs]ly$/, Adverb], [/...lly$/, Adverb], [/[bszmp]{2}y$/, Adj], [/.(gg|bb|zz)ly$/, Adj], [/.[ai]my$/, Adj], [/[ea]{2}zy$/, Adj], [/.[^aeiou]ity$/, Sing]] + y: [[/.[cts]hy$/, Adj$1], [/.[st]ty$/, Adj$1], [/.[gk]y$/, Adj$1], [/.[tnl]ary$/, Adj$1], [/.[oe]ry$/, Sing$1], [/[rdntkbhs]ly$/, Adverb], [/...lly$/, Adverb], [/[bszmp]{2}y$/, Adj$1], [/.(gg|bb|zz)ly$/, Adj$1], [/.[ai]my$/, Adj$1], [/[ea]{2}zy$/, Adj$1], [/.[^aeiou]ity$/, Sing$1]] }; //just a foolish lookup of known suffixes -var Adj$1 = 'Adjective'; -var Inf$1 = 'Infinitive'; -var Pres$1 = 'PresentTense'; -var Sing$1 = 'Singular'; -var Past$1 = 'PastTense'; +var Adj = 'Adjective'; +var Inf = 'Infinitive'; +var Pres = 'PresentTense'; +var Sing = 'Singular'; +var Past = 'PastTense'; var Avb = 'Adverb'; var Plrl = 'Plural'; -var Actor$1 = 'Actor'; +var Actor = 'Actor'; var Vb = 'Verb'; -var Noun$1 = 'Noun'; -var Last$1 = 'LastName'; +var Noun = 'Noun'; +var Last = 'LastName'; var Modal = 'Modal'; var Place = 'Place'; // find any issues - https://observablehq.com/@spencermountain/suffix-word-lookup @@ -9584,121 +9589,121 @@ var suffixMap = [null, //0 null, //1 { //2-letter - ea: Sing$1, - ia: Noun$1, - ic: Adj$1, + ea: Sing, + ia: Noun, + ic: Adj, ly: Avb, "'n": Vb, "'t": Vb }, { //3-letter - oed: Past$1, - ued: Past$1, - xed: Past$1, + oed: Past, + ued: Past, + xed: Past, ' so': Avb, "'ll": Modal, "'re": 'Copula', - azy: Adj$1, - eer: Noun$1, + azy: Adj, + eer: Noun, end: Vb, - ped: Past$1, - ffy: Adj$1, - ify: Inf$1, + ped: Past, + ffy: Adj, + ify: Inf, ing: 'Gerund', //likely to be converted to Adj after lexicon pass - ize: Inf$1, - lar: Adj$1, - mum: Adj$1, - nes: Pres$1, - nny: Adj$1, - oid: Adj$1, - ous: Adj$1, - que: Adj$1, - rol: Sing$1, - sis: Sing$1, - zes: Pres$1 + ize: Inf, + lar: Adj, + mum: Adj, + nes: Pres, + nny: Adj, + oid: Adj, + ous: Adj, + que: Adj, + rol: Sing, + sis: Sing, + zes: Pres }, { //4-letter - amed: Past$1, - aped: Past$1, - ched: Past$1, - lked: Past$1, - nded: Past$1, - cted: Past$1, - dged: Past$1, - akis: Last$1, + amed: Past, + aped: Past, + ched: Past, + lked: Past, + nded: Past, + cted: Past, + dged: Past, + akis: Last, //greek - cede: Inf$1, - chuk: Last$1, + cede: Inf, + chuk: Last, //east-europe - czyk: Last$1, + czyk: Last, //polish (male) - ects: Pres$1, + ects: Pres, ends: Vb, - enko: Last$1, + enko: Last, //east-europe - ette: Sing$1, - fies: Pres$1, + ette: Sing, + fies: Pres, fore: Avb, - gate: Inf$1, - gone: Adj$1, + gate: Inf, + gone: Adj, ices: Plrl, ints: Plrl, ines: Plrl, ions: Plrl, less: Avb, - llen: Adj$1, - made: Adj$1, - nsen: Last$1, + llen: Adj, + made: Adj, + nsen: Last, //norway - oses: Pres$1, + oses: Pres, ould: Modal, - some: Adj$1, - sson: Last$1, + some: Adj, + sson: Last, //swedish male - tage: Inf$1, + tage: Inf, teen: 'Value', - tion: Sing$1, - tive: Adj$1, - tors: Noun$1, - vice: Sing$1 + tion: Sing, + tive: Adj, + tors: Noun, + vice: Sing }, { //5-letter - tized: Past$1, - urned: Past$1, - eased: Past$1, + tized: Past, + urned: Past, + eased: Past, ances: Plrl, - bound: Adj$1, + bound: Adj, ettes: Plrl, fully: Avb, - ishes: Pres$1, + ishes: Pres, ities: Plrl, - marek: Last$1, + marek: Last, //polish (male) - nssen: Last$1, + nssen: Last, //norway - ology: Noun$1, + ology: Noun, ports: Plrl, - rough: Adj$1, - tches: Pres$1, + rough: Adj, + tches: Pres, tieth: 'Ordinal', tures: Plrl, wards: Avb, where: Avb }, { //6-letter - auskas: Last$1, + auskas: Last, //lithuania - keeper: Actor$1, - logist: Actor$1, + keeper: Actor, + logist: Actor, teenth: 'Value' }, { //7-letter - opoulos: Last$1, + opoulos: Last, //greek borough: Place, //Hillsborough - sdottir: Last$1 //swedish female + sdottir: Last //swedish female }]; @@ -9706,8 +9711,8 @@ var endRegexs = function endRegexs(term, world) { var str = term.clean; var _char = str[str.length - 1]; - if (endsWith$1.hasOwnProperty(_char) === true) { - var regs = endsWith$1[_char]; + if (endsWith.hasOwnProperty(_char) === true) { + var regs = endsWith[_char]; for (var r = 0; r < regs.length; r += 1) { if (regs[r][0].test(str) === true) { @@ -9739,12 +9744,12 @@ var knownSuffixes = function knownSuffixes(term, world) { }; //all-the-way-down! -var checkRegex$1 = function checkRegex(term, world) { +var checkRegex = function checkRegex(term, world) { knownSuffixes(term, world); endRegexs(term, world); }; -var _04Suffixes = checkRegex$1; +var _04Suffixes = checkRegex; //just some of the most common emoticons //faster than @@ -9870,7 +9875,7 @@ var _05Emoji = tagEmoji; var steps = { lexicon: _01Lexicon, - punctuation: _02Punctuation$1, + punctuation: _02Punctuation, regex: _03Prefixes, suffix: _04Suffixes, emoji: _05Emoji @@ -10079,7 +10084,7 @@ var checkNeighbours = function checkNeighbours(terms, world) { var _01Neighbours = checkNeighbours; -var titleCase$4 = /^[A-Z][a-z'\u00C0-\u00FF]/; +var titleCase = /^[A-Z][a-z'\u00C0-\u00FF]/; var hasNumber = /[0-9]/; /** look for any grammar signals based on capital/lowercase */ @@ -10091,7 +10096,7 @@ var checkCase = function checkCase(doc) { for (var i = 1; i < terms.length; i++) { var term = terms[i]; - if (titleCase$4.test(term.text) === true && hasNumber.test(term.text) === false && term.tags.Date === undefined) { + if (titleCase.test(term.text) === true && hasNumber.test(term.text) === false && term.tags.Date === undefined) { term.tag('ProperNoun', 'titlecase-noun', world); } } @@ -10127,13 +10132,13 @@ var checkPrefix = function checkPrefix(terms, world) { var _03Stem = checkPrefix; //similar to plural/singularize rules, but not the same -var isPlural = [/(^v)ies$/i, /ises$/i, /ives$/i, /(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /(buffal|tomat|tornad)oes$/i, /(analy|ba|diagno|parenthe|progno|synop|the)ses$/i, /(vert|ind|cort)ices$/i, /(matr|append)ices$/i, /(x|ch|ss|sh|s|z|o)es$/i, /is$/i, /men$/i, /news$/i, /.tia$/i, /(^f)ves$/i, /(lr)ves$/i, /(^aeiouy|qu)ies$/i, /(m|l)ice$/i, /(cris|ax|test)es$/i, /(alias|status)es$/i, /ics$/i]; //similar to plural/singularize rules, but not the same +var isPlural$3 = [/(^v)ies$/i, /ises$/i, /ives$/i, /(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /(buffal|tomat|tornad)oes$/i, /(analy|ba|diagno|parenthe|progno|synop|the)ses$/i, /(vert|ind|cort)ices$/i, /(matr|append)ices$/i, /(x|ch|ss|sh|s|z|o)es$/i, /is$/i, /men$/i, /news$/i, /.tia$/i, /(^f)ves$/i, /(lr)ves$/i, /(^aeiouy|qu)ies$/i, /(m|l)ice$/i, /(cris|ax|test)es$/i, /(alias|status)es$/i, /ics$/i]; //similar to plural/singularize rules, but not the same -var isSingular = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /s[aeiou]+ns$/i, // sans, siens +var isSingular$1 = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /s[aeiou]+ns$/i, // sans, siens /(^aeiouy|qu)y$/i, /(x|ch|ss|sh|z)$/i, /(matr|vert|ind|cort)(ix|ex)$/i, /(m|l)ouse$/i, /(m|l)ice$/i, /(antenn|formul|nebul|vertebr|vit)a$/i, /.sis$/i, /^(?!talis|.*hu)(.*)man$/i]; -var isPlural_1 = { - isSingular: isSingular, - isPlural: isPlural +var isPlural_1$2 = { + isSingular: isSingular$1, + isPlural: isPlural$3 }; var noPlurals = ['Uncountable', 'Pronoun', 'Place', 'Value', 'Person', 'Month', 'WeekDay', 'Holiday']; @@ -10163,7 +10168,7 @@ var checkPlural = function checkPlural(t, world) { } // isPlural suffix rules - if (isPlural_1.isPlural.find(function (reg) { + if (isPlural_1$2.isPlural.find(function (reg) { return reg.test(str); })) { t.tag('Plural', 'plural-rules', world); @@ -10171,7 +10176,7 @@ var checkPlural = function checkPlural(t, world) { } // isSingular suffix rules - if (isPlural_1.isSingular.find(function (reg) { + if (isPlural_1$2.isSingular.find(function (reg) { return reg.test(str); })) { t.tag('Singular', 'singular-rules', world); @@ -10265,14 +10270,14 @@ var tagOrgs = function tagOrgs(terms, world) { var _05Organizations = tagOrgs; -var oneLetterAcronym$1 = /^[A-Z]('s|,)?$/; +var oneLetterAcronym = /^[A-Z]('s|,)?$/; var periodSeperated = /([A-Z]\.){2}[A-Z]?/i; var oneLetterWord = { I: true, A: true }; -var isAcronym$2 = function isAcronym(term, world) { +var isAcronym = function isAcronym(term, world) { var str = term.reduced; // a known acronym like fbi if (term.tags.Acronym) { @@ -10309,10 +10314,10 @@ var checkAcronym = function checkAcronym(terms, world) { } //non-period ones are harder - if (term.isUpperCase() && isAcronym$2(term, world)) { + if (term.isUpperCase() && isAcronym(term, world)) { term.tag('Acronym', 'acronym-step', world); term.tag('Noun', 'acronym-infer', world); - } else if (!oneLetterWord.hasOwnProperty(term.text) && oneLetterAcronym$1.test(term.text)) { + } else if (!oneLetterWord.hasOwnProperty(term.text) && oneLetterAcronym.test(term.text)) { term.tag('Acronym', 'one-letter-acronym', world); term.tag('Noun', 'one-letter-infer', world); } //if it's a organization, @@ -10367,7 +10372,7 @@ var fallbacks = function fallbacks(doc, terms) { var _02Fallbacks = fallbacks; var hasNegative = /n't$/; -var irregulars$3 = { +var irregulars$2 = { "won't": ['will', 'not'], wont: ['will', 'not'], "can't": ['can', 'not'], @@ -10397,8 +10402,8 @@ var doAint = function doAint(term, phrase) { var checkNegative = function checkNegative(term, phrase) { //check named-ones - if (irregulars$3.hasOwnProperty(term.clean) === true) { - return irregulars$3[term.clean]; + if (irregulars$2.hasOwnProperty(term.clean) === true) { + return irregulars$2[term.clean]; } //this word needs it's own logic: @@ -10417,7 +10422,7 @@ var checkNegative = function checkNegative(term, phrase) { var _01Negative = checkNegative; -var contraction = /([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z]{1,2})$/i; //these ones don't seem to be ambiguous +var contraction$1 = /([a-z\u00C0-\u00FF]+)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z]{1,2})$/i; //these ones don't seem to be ambiguous var easy = { ll: 'will', @@ -10428,7 +10433,7 @@ var easy = { }; // var checkApostrophe = function checkApostrophe(term) { - var parts = term.text.match(contraction); + var parts = term.text.match(contraction$1); if (parts === null) { return null; @@ -10443,7 +10448,7 @@ var checkApostrophe = function checkApostrophe(term) { var _02Simple = checkApostrophe; -var irregulars$4 = { +var irregulars$1 = { wanna: ['want', 'to'], gonna: ['going', 'to'], im: ['i', 'am'], @@ -10474,8 +10479,8 @@ var irregulars$4 = { var checkIrregulars = function checkIrregulars(term) { //check white-list - if (irregulars$4.hasOwnProperty(term.clean)) { - return irregulars$4[term.clean]; + if (irregulars$1.hasOwnProperty(term.clean)) { + return irregulars$1[term.clean]; } return null; @@ -10651,7 +10656,7 @@ var checkRange = function checkRange(term) { var _06Ranges = checkRange; -var contraction$1 = /^(l|c|d|j|m|n|qu|s|t)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z\u00C0-\u00FF]+)$/i; // basic support for ungendered french contractions +var contraction = /^(l|c|d|j|m|n|qu|s|t)[\u0027\u0060\u00B4\u2018\u2019\u201A\u201B\u2032\u2035\u2039\u203A]([a-z\u00C0-\u00FF]+)$/i; // basic support for ungendered french contractions // not perfect, but better than nothing, to support matching on french text. var french = { @@ -10676,7 +10681,7 @@ var french = { }; var checkFrench = function checkFrench(term) { - var parts = term.text.match(contraction$1); + var parts = term.text.match(contraction); if (parts === null || french.hasOwnProperty(parts[1]) === false) { return null; @@ -10776,8 +10781,26 @@ var hasTag = function hasTag(doc, tag) { var miscCorrection = function miscCorrection(doc) { - //exactly like - var m = hasWord(doc, 'like'); + // imperative-form + var m = hasTag(doc, 'Infinitive'); + + if (m.found) { + // you eat? + m = m.ifNo('@hasQuestionMark'); // i speak + + m = m.ifNo('(i|we|they)'); // shut the door! + + m.match('[#Infinitive] (#Determiner|#Possessive) #Noun', 0).tag('Imperative', 'shut-the'); // go-fast + + m.match('^[#Infinitive] #Adverb?$', 0).tag('Imperative', 'go-fast'); // do not go + + m.match('[(do && #Infinitive)] not? #Verb', 0).tag('Imperative', 'do-not'); // do it + + m.match('[#Infinitive] (it|some)', 0).tag('Imperative', 'do-it'); + } //exactly like + + + m = hasWord(doc, 'like'); m.match('#Adverb like').notIf('(really|generally|typically|usually|sometimes|often|just) [like]').tag('Adverb', 'adverb-like'); //the orange. m = hasTag(doc, 'Adjective'); @@ -10822,7 +10845,7 @@ var miscCorrection = function miscCorrection(doc) { var fixMisc = miscCorrection; -var unique$5 = function unique(arr) { +var unique = function unique(arr) { var obj = {}; for (var i = 0; i < arr.length; i++) { @@ -10832,10 +10855,10 @@ var unique$5 = function unique(arr) { return Object.keys(obj); }; -var _unique = unique$5; +var _unique = unique; // order matters -var list = [// ==== Mutliple tags ==== +var list$5 = [// ==== Mutliple tags ==== { match: 'too much', tag: 'Adverb Adjective', @@ -10977,7 +11000,7 @@ var list = [// ==== Mutliple tags ==== // reason: 'when-i-go-fishing', // }, ]; -var _01Misc = list; +var _01Misc = list$5; var _ambig = { // adverbs than can be adjectives @@ -10997,7 +11020,7 @@ var _ambig = { }; var dates = "(".concat(_ambig.personDate.join('|'), ")"); -var list$1 = [// ==== Holiday ==== +var list$4 = [// ==== Holiday ==== { match: '#Holiday (day|eve)', tag: 'Holiday', @@ -11201,10 +11224,10 @@ var list$1 = [// ==== Holiday ==== tag: 'Date', reason: 'aug 20-21' }]; -var _02Dates = list$1; +var _02Dates = list$4; var adjectives$1 = "(".concat(_ambig.personAdjective.join('|'), ")"); -var list$2 = [// all fell apart +var list$3 = [// all fell apart { match: '[all] #Determiner? #Noun', group: 0, @@ -11316,8 +11339,14 @@ var list$2 = [// all fell apart group: 0, tag: 'Adjective', reason: 'still-out' +}, // shut the door +{ + match: '^[#Adjective] (the|your) #Noun', + group: 0, + tag: 'Infinitive', + reason: 'shut-the' }]; -var _03Adjective = list$2; +var _03Adjective = list$3; var _04Noun = [// ==== Plural ==== //there are reasons @@ -11645,14 +11674,18 @@ var _04Noun = [// ==== Plural ==== group: 0, tag: 'Noun', reason: 'goes-to-verb' -}, //a great run -// { match: '(a|an) #Adjective [(#Infinitive|#PresentTense)]', tag: 'Noun', reason: 'a|an2' }, -//a tv show +}, //a close watch on { - match: '(a|an) #Noun [#Infinitive]', + match: '(a|an) #Noun [#Infinitive] (#Preposition|#Noun)', group: 0, tag: 'Noun', reason: 'a-noun-inf' +}, //a tv show +{ + match: '(a|an) #Noun [#Infinitive]$', + group: 0, + tag: 'Noun', + reason: 'a-noun-inf2' }, //do so { match: 'do [so]', @@ -11665,9 +11698,7 @@ var _04Noun = [// ==== Plural ==== group: 0, tag: 'Noun', reason: 'is-pres-noun' -}, // -// { match: '[#Infinitive] #Copula', group: 0, tag: 'Noun', reason: 'inf-copula' }, -//a close +}, //a close { match: '#Determiner #Adverb? [close]', group: 0, @@ -11716,7 +11747,7 @@ var _04Noun = [// ==== Plural ==== reason: 'co-noun' }]; -var adjectives$2 = "(".concat(_ambig.adverbAdjective.join('|'), ")"); +var adjectives = "(".concat(_ambig.adverbAdjective.join('|'), ")"); var _05Adverb = [//still good { match: '[still] #Adjective', @@ -11777,7 +11808,7 @@ var _05Adverb = [//still good reason: 'even-left' }, //cheering hard - dropped -ly's { - match: '#PresentTense [(hard|quick|long|bright|slow)]', + match: '(#PresentTense && !#Copula) [(hard|quick|long|bright|slow|fast|backwards|forwards)]', group: 0, tag: 'Adverb', reason: 'lazy-ly' @@ -11801,7 +11832,7 @@ var _05Adverb = [//still good reason: 'a-bit-cold' }, // dark green { - match: "[".concat(adjectives$2, "] #Adjective"), + match: "[".concat(adjectives, "] #Adjective"), group: 0, tag: 'Adverb', reason: 'dark-green' @@ -11913,8 +11944,8 @@ var _06Value = [// ==== PhoneNumber ==== reason: 'a-is-one' }]; -var verbs$1 = "(".concat(_ambig.personVerb.join('|'), ")"); -var list$3 = [// adj -> gerund +var verbs = "(".concat(_ambig.personVerb.join('|'), ")"); +var list$2 = [// adj -> gerund // amusing his aunt { match: '[#Adjective] #Possessive #Noun', @@ -12151,12 +12182,12 @@ var list$3 = [// adj -> gerund reason: 'compromises-are-possible' }, // would wade { - match: "#Modal [".concat(verbs$1, "]"), + match: "#Modal [".concat(verbs, "]"), group: 0, tag: 'Verb', reason: 'would-mark' }, { - match: "#Adverb [".concat(verbs$1, "]"), + match: "#Adverb [".concat(verbs, "]"), group: 0, tag: 'Verb', reason: 'really-mark' @@ -12168,12 +12199,12 @@ var list$3 = [// adj -> gerund reason: 'to-mark' }, // wade smith { - match: "".concat(verbs$1, " #Person"), + match: "".concat(verbs, " #Person"), tag: 'Person', reason: 'rob-smith' }, // wade m. Cooper { - match: "".concat(verbs$1, " #Acronym #ProperNoun"), + match: "".concat(verbs, " #Acronym #ProperNoun"), tag: 'Person', reason: 'rob-a-smith' }, // damn them @@ -12193,9 +12224,9 @@ var list$3 = [// adj -> gerund tag: 'Verb', reason: 'swear3-verb' }]; -var _07Verbs = list$3; +var _07Verbs = list$2; -var list$4 = [// ==== Region ==== +var list$1 = [// ==== Region ==== //West Norforlk { match: '(west|north|south|east|western|northern|southern|eastern)+ #Place', @@ -12238,7 +12269,7 @@ var list$4 = [// ==== Region ==== // // houston texas // { match: `[${places}] #Place`, group: 0, tag: 'Place', reason: 'paris-france' }, ]; -var _08Place = list$4; +var _08Place = list$1; var _09Org = [//John & Joe's { @@ -12285,10 +12316,10 @@ var _09Org = [//John & Joe's reason: 'noun-public-school' }]; -var nouns$1 = "(".concat(_ambig.personNoun.join('|'), ")"); +var nouns = "(".concat(_ambig.personNoun.join('|'), ")"); var months = "(".concat(_ambig.personMonth.join('|'), ")"); var places = "(".concat(_ambig.personPlace.join('|'), ")"); -var list$5 = [// ==== Honorific ==== +var list = [// ==== Honorific ==== { match: '[(1st|2nd|first|second)] #Honorific', group: 0, @@ -12446,13 +12477,13 @@ var list$5 = [// ==== Honorific ==== reason: 'bill-green' }, // faith smith { - match: "".concat(nouns$1, " #Person"), + match: "".concat(nouns, " #Person"), tag: 'Person', reason: 'ray-smith', safe: true }, // faith m. Smith { - match: "".concat(nouns$1, " #Acronym? #ProperNoun"), + match: "".concat(nouns, " #Acronym? #ProperNoun"), tag: 'Person', reason: 'ray-a-smith', safe: true @@ -12599,7 +12630,7 @@ var list$5 = [// ==== Honorific ==== tag: 'FirstName', reason: 'place-firstname' }]; -var _10People = list$5; +var _10People = list; var matches = []; matches = matches.concat(_01Misc); @@ -12613,7 +12644,7 @@ matches = matches.concat(_08Place); matches = matches.concat(_09Org); matches = matches.concat(_10People); // cache the easier conditions up-front -var cacheRequired$1 = function cacheRequired(reg) { +var cacheRequired = function cacheRequired(reg) { var needTags = []; var needWords = []; reg.forEach(function (obj) { @@ -12674,7 +12705,7 @@ matches.forEach(function (m) { } }); all.forEach(function (m) { - m.required = cacheRequired$1(m.reg); + m.required = cacheRequired(m.reg); return m; }); // console.log(all.length) // console.log(all[all.length - 1]) @@ -12776,7 +12807,7 @@ var tagger = function tagger(doc) { var _02Tagger = tagger; -var addMethod = function addMethod(Doc) { +var addMethod$a = function addMethod(Doc) { /** */ var Abbreviations = /*#__PURE__*/function (_Doc) { _inherits(Abbreviations, _Doc); @@ -12831,11 +12862,11 @@ var addMethod = function addMethod(Doc) { return Doc; }; -var Abbreviations = addMethod; +var Abbreviations = addMethod$a; var hasPeriod = /\./; -var addMethod$1 = function addMethod(Doc) { +var addMethod$9 = function addMethod(Doc) { /** */ var Acronyms = /*#__PURE__*/function (_Doc) { _inherits(Acronyms, _Doc); @@ -12893,9 +12924,9 @@ var addMethod$1 = function addMethod(Doc) { return Doc; }; -var Acronyms = addMethod$1; +var Acronyms = addMethod$9; -var addMethod$2 = function addMethod(Doc) { +var addMethod$8 = function addMethod(Doc) { /** split into approximate sub-sentence phrases */ Doc.prototype.clauses = function (n) { // an awkward way to disambiguate a comma use @@ -12954,9 +12985,9 @@ var addMethod$2 = function addMethod(Doc) { return Doc; }; -var Clauses = addMethod$2; +var Clauses = addMethod$8; -var addMethod$3 = function addMethod(Doc) { +var addMethod$7 = function addMethod(Doc) { /** */ var Contractions = /*#__PURE__*/function (_Doc) { _inherits(Contractions, _Doc); @@ -13030,9 +13061,9 @@ var addMethod$3 = function addMethod(Doc) { return Doc; }; -var Contractions = addMethod$3; +var Contractions = addMethod$7; -var addMethod$4 = function addMethod(Doc) { +var addMethod$6 = function addMethod(Doc) { //pull it apart.. var parse = function parse(doc) { var things = doc.splitAfter('@hasComma').splitOn('(and|or) not?').not('(and|or) not?'); @@ -13160,7 +13191,7 @@ var addMethod$4 = function addMethod(Doc) { return Doc; }; -var Lists = addMethod$4; +var Lists = addMethod$6; var noPlural = '(#Pronoun|#Place|#Value|#Person|#Uncountable|#Month|#WeekDay|#Holiday|#Possessive)'; //certain words can't be plural, like 'peace' @@ -13179,7 +13210,7 @@ var hasPlural = function hasPlural(doc) { var hasPlural_1 = hasPlural; -var irregulars$5 = { +var irregulars = { hour: 'an', heir: 'an', heirloom: 'an', @@ -13222,8 +13253,8 @@ var makeArticle = function makeArticle(doc) { var str = doc.text('normal').trim(); //explicit irregular forms - if (irregulars$5.hasOwnProperty(str)) { - return irregulars$5[str]; + if (irregulars.hasOwnProperty(str)) { + return irregulars[str]; } //spelled-out acronyms @@ -13251,21 +13282,21 @@ var makeArticle = function makeArticle(doc) { var getArticle = makeArticle; //similar to plural/singularize rules, but not the same -var isPlural$1 = [/(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /men$/i, /.tia$/i, /(m|l)ice$/i]; //similar to plural/singularize rules, but not the same +var isPlural$2 = [/(antenn|formul|nebul|vertebr|vit)ae$/i, /(octop|vir|radi|nucle|fung|cact|stimul)i$/i, /men$/i, /.tia$/i, /(m|l)ice$/i]; //similar to plural/singularize rules, but not the same -var isSingular$1 = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /(^aeiouy|qu)y$/i, /(x|ch|ss|sh|z)$/i, /(matr|vert|ind|cort)(ix|ex)$/i, /(m|l)ouse$/i, /(m|l)ice$/i, /(antenn|formul|nebul|vertebr|vit)a$/i, /.sis$/i, /^(?!talis|.*hu)(.*)man$/i]; -var _rules$2 = { - isSingular: isSingular$1, - isPlural: isPlural$1 +var isSingular = [/(ax|test)is$/i, /(octop|vir|radi|nucle|fung|cact|stimul)us$/i, /(octop|vir)i$/i, /(rl)f$/i, /(alias|status)$/i, /(bu)s$/i, /(al|ad|at|er|et|ed|ad)o$/i, /(ti)um$/i, /(ti)a$/i, /sis$/i, /(?:(^f)fe|(lr)f)$/i, /hive$/i, /(^aeiouy|qu)y$/i, /(x|ch|ss|sh|z)$/i, /(matr|vert|ind|cort)(ix|ex)$/i, /(m|l)ouse$/i, /(m|l)ice$/i, /(antenn|formul|nebul|vertebr|vit)a$/i, /.sis$/i, /^(?!talis|.*hu)(.*)man$/i]; +var _rules = { + isSingular: isSingular, + isPlural: isPlural$2 }; var endS = /s$/; // double-check this term, if it is not plural, or singular. // (this is a partial copy of ./tagger/fallbacks/plural) // fallback plural if it ends in an 's'. -var isPlural$2 = function isPlural(str) { +var isPlural$1 = function isPlural(str) { // isSingular suffix rules - if (_rules$2.isSingular.find(function (reg) { + if (_rules.isSingular.find(function (reg) { return reg.test(str); })) { return false; @@ -13277,7 +13308,7 @@ var isPlural$2 = function isPlural(str) { } // is it a plural like 'fungi'? - if (_rules$2.isPlural.find(function (reg) { + if (_rules.isPlural.find(function (reg) { return reg.test(str); })) { return true; @@ -13286,7 +13317,7 @@ var isPlural$2 = function isPlural(str) { return null; }; -var isPlural_1$1 = isPlural$2; +var isPlural_1$1 = isPlural$1; var exceptions = { he: 'his', @@ -13346,7 +13377,7 @@ var parse$1 = function parse(doc) { var parse_1 = parse$1; -var methods$6 = { +var methods$2 = { /** overload the original json with noun information */ json: function json(options) { var n = null; @@ -13463,7 +13494,7 @@ var methods$6 = { return this; } }; -var methods_1 = methods$6; +var methods_1 = methods$2; var addMethod$5 = function addMethod(Doc) { /** */ @@ -13527,7 +13558,7 @@ var Nouns = addMethod$5; var open = /\(/; var close = /\)/; -var addMethod$6 = function addMethod(Doc) { +var addMethod$4 = function addMethod(Doc) { /** anything between (these things) */ var Parentheses = /*#__PURE__*/function (_Doc) { _inherits(Parentheses, _Doc); @@ -13596,9 +13627,9 @@ var addMethod$6 = function addMethod(Doc) { return Doc; }; -var Parentheses = addMethod$6; +var Parentheses = addMethod$4; -var addMethod$7 = function addMethod(Doc) { +var addMethod$3 = function addMethod(Doc) { /** */ var Possessives = /*#__PURE__*/function (_Doc) { _inherits(Possessives, _Doc); @@ -13657,7 +13688,7 @@ var addMethod$7 = function addMethod(Doc) { return Doc; }; -var Possessives = addMethod$7; +var Possessives = addMethod$3; var pairs = { "\"": "\"", @@ -13701,7 +13732,7 @@ var pairs = { }; var hasOpen = RegExp('(' + Object.keys(pairs).join('|') + ')'); -var addMethod$8 = function addMethod(Doc) { +var addMethod$2 = function addMethod(Doc) { /** "these things" */ var Quotations = /*#__PURE__*/function (_Doc) { _inherits(Quotations, _Doc); @@ -13771,10 +13802,10 @@ var addMethod$8 = function addMethod(Doc) { return Doc; }; -var Quotations = addMethod$8; +var Quotations = addMethod$2; // walked => walk - turn a verb into it's root form -var toInfinitive$1 = function toInfinitive(parsed, world) { +var toInfinitive = function toInfinitive(parsed, world) { var verb = parsed.verb; // console.log(parsed) // verb.debug() //1. if it's already infinitive @@ -13803,7 +13834,7 @@ var toInfinitive$1 = function toInfinitive(parsed, world) { return world.transforms.toInfinitive(str, world, tense); }; -var toInfinitive_1$1 = toInfinitive$1; +var toInfinitive_1 = toInfinitive; // spencer walks -> singular // we walk -> plural @@ -13816,7 +13847,7 @@ var findNoun = function findNoun(vb) { // othertimes you need its subject 'we walk' vs 'i walk' -var isPlural$3 = function isPlural(parsed) { +var isPlural = function isPlural(parsed) { var vb = parsed.verb; if (vb.has('(are|were|does)') || parsed.auxiliary.has('(are|were|does)')) { @@ -13845,7 +13876,7 @@ var isPlural$3 = function isPlural(parsed) { return null; }; -var isPlural_1$2 = isPlural$3; +var isPlural_1 = isPlural; // #Copula : is -> 'is not' // #PastTense : walked -> did not walk @@ -13879,7 +13910,7 @@ var toNegative = function toNegative(parsed, world) { if (vb.has('#PastTense')) { - var inf = toInfinitive_1$1(parsed, world); + var inf = toInfinitive_1(parsed, world); vb.replaceWith(inf, true); vb.prepend('did not'); return; @@ -13887,11 +13918,11 @@ var toNegative = function toNegative(parsed, world) { if (vb.has('#PresentTense')) { - var _inf = toInfinitive_1$1(parsed, world); + var _inf = toInfinitive_1(parsed, world); vb.replaceWith(_inf, true); - if (isPlural_1$2(parsed)) { + if (isPlural_1(parsed)) { vb.prepend('do not'); } else { vb.prepend('does not'); @@ -13902,7 +13933,7 @@ var toNegative = function toNegative(parsed, world) { if (vb.has('#Gerund')) { - var _inf2 = toInfinitive_1$1(parsed, world); + var _inf2 = toInfinitive_1(parsed, world); vb.replaceWith(_inf2, true); vb.prepend('not'); @@ -13910,7 +13941,7 @@ var toNegative = function toNegative(parsed, world) { } //fallback 1: walk -> does not walk - if (isPlural_1$2(parsed)) { + if (isPlural_1(parsed)) { vb.prepend('does not'); return; } //fallback 2: walk -> do not walk @@ -13978,13 +14009,13 @@ var parseVerb = function parseVerb(vb) { return parsed; }; -var parse$2 = parseVerb; +var parse = parseVerb; /** too many special cases for is/was/will be*/ var toBe = function toBe(parsed) { var isI = false; - var plural = isPlural_1$2(parsed); + var plural = isPlural_1(parsed); var isNegative = parsed.negative.found; //account for 'i is' -> 'i am' irregular // if (vb.parent && vb.parent.has('i #Adverb? #Copula')) { // isI = true; @@ -14050,7 +14081,7 @@ var doModal = function doModal(parsed) { var doModal_1 = doModal; -var conjugate$2 = function conjugate(parsed, world) { +var conjugate = function conjugate(parsed, world) { var verb = parsed.verb; //special handling of 'is', 'will be', etc. if (verb.has('#Copula') || verb.out('normal') === 'be' && parsed.auxiliary.has('will')) { @@ -14063,7 +14094,7 @@ var conjugate$2 = function conjugate(parsed, world) { var past = og.clone().replace('are', 'were'); var fut = og.clone().replace('are', 'will be'); - var _infinitive = toInfinitive_1$1(parsed, world); + var _infinitive = toInfinitive_1(parsed, world); var res = { PastTense: past.text(), @@ -14091,7 +14122,7 @@ var conjugate$2 = function conjugate(parsed, world) { var hasHyphen = parsed.verb.termList(0).hasHyphen(); - var infinitive = toInfinitive_1$1(parsed, world); + var infinitive = toInfinitive_1(parsed, world); if (!infinitive) { return {}; @@ -14143,46 +14174,12 @@ var conjugate$2 = function conjugate(parsed, world) { return forms; }; -var conjugate_1$1 = conjugate$2; - -// verb-phrases that are orders - 'close the door' -// these should not be conjugated -var isImperative = function isImperative(parsed) { - // do the dishes - if (parsed.auxiliary.has('do')) { - return true; - } // speak the truth - // if (parsed.verb.has('^#Infinitive')) { - // // 'i speak' is not imperative - // if (parsed.subject.has('(i|we|you|they)')) { - // return false - // } - // return true - // } - - - return false; -}; // // basically, don't conjugate it -// exports.toImperative = function (parsed) { -// let str = parsed.original.text() -// let res = { -// PastTense: str, -// PresentTense: str, -// FutureTense: str, -// Infinitive: str, -// } -// return res -// } - - -var imperative = { - isImperative: isImperative -}; +var conjugate_1 = conjugate; // if something is 'modal-ish' we are forced to use past-participle // ('i could drove' is wrong) -var useParticiple = function useParticiple(parsed) { +var useParticiple$1 = function useParticiple(parsed) { if (parsed.auxiliary.has('(could|should|would|may|can|must)')) { return true; } @@ -14206,7 +14203,7 @@ var toParticiple = function toParticiple(parsed, world) { } // try to swap the main verb to its participle form - var obj = conjugate_1$1(parsed, world); + var obj = conjugate_1(parsed, world); var str = obj.Participle || obj.PastTense; if (str) { @@ -14237,13 +14234,12 @@ var toParticiple = function toParticiple(parsed, world) { }; var participle = { - useParticiple: useParticiple, + useParticiple: useParticiple$1, toParticiple: toParticiple }; -var isImperative$1 = imperative.isImperative; var _toParticiple = participle.toParticiple, - useParticiple$1 = participle.useParticiple; // remove any tense-information in auxiliary verbs + useParticiple = participle.useParticiple; // remove any tense-information in auxiliary verbs var makeNeutral = function makeNeutral(parsed) { //remove tense-info from auxiliaries @@ -14256,7 +14252,7 @@ var makeNeutral = function makeNeutral(parsed) { return parsed; }; -var methods$7 = { +var methods$1 = { /** overload the original json with verb information */ json: function json(options) { var _this = this; @@ -14277,7 +14273,7 @@ var methods$7 = { var res = []; this.forEach(function (p) { var json = p.json(options)[0]; - var parsed = parse$2(p); + var parsed = parse(p); json.parts = {}; Object.keys(parsed).forEach(function (k) { if (parsed[k] && parsed[k].isA === 'Doc') { @@ -14287,7 +14283,7 @@ var methods$7 = { } }); json.isNegative = p.has('#Negative'); - json.conjugations = conjugate_1$1(parsed, _this.world); + json.conjugations = conjugate_1(parsed, _this.world); res.push(json); }); @@ -14303,7 +14299,7 @@ var methods$7 = { var list = []; // look at internal adverbs this.forEach(function (vb) { - var advb = parse$2(vb).adverb; + var advb = parse(vb).adverb; if (advb.found) { list = list.concat(advb.list); @@ -14333,9 +14329,9 @@ var methods$7 = { var list = []; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - if (isPlural_1$2(parsed, _this2.world) === true) { + if (isPlural_1(parsed, _this2.world) === true) { list.push(vb.list[0]); } }); @@ -14348,9 +14344,9 @@ var methods$7 = { var list = []; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - if (isPlural_1$2(parsed, _this3.world) === false) { + if (isPlural_1(parsed, _this3.world) === false) { list.push(vb.list[0]); } }); @@ -14364,9 +14360,9 @@ var methods$7 = { var result = []; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var forms = conjugate_1$1(parsed, _this4.world); + var forms = conjugate_1(parsed, _this4.world); result.push(forms); }); @@ -14378,15 +14374,15 @@ var methods$7 = { var _this5 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); // should we support 'would swim' ➔ 'would have swam' + var parsed = parse(vb); // should we support 'would swim' ➔ 'would have swam' - if (useParticiple$1(parsed)) { + if (useParticiple(parsed)) { _toParticiple(parsed, _this5.world); return; } - if (isImperative$1(parsed)) { + if (vb.has('#Imperative')) { return; } // don't conjugate 'to be' @@ -14401,7 +14397,7 @@ var methods$7 = { return; } - var str = conjugate_1$1(parsed, _this5.world).PastTense; + var str = conjugate_1(parsed, _this5.world).PastTense; if (str) { parsed = makeNeutral(parsed); @@ -14416,9 +14412,9 @@ var methods$7 = { var _this6 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var obj = conjugate_1$1(parsed, _this6.world); + var obj = conjugate_1(parsed, _this6.world); var str = obj.PresentTense; // 'i look', not 'i looks' @@ -14454,13 +14450,13 @@ var methods$7 = { var _this7 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); // 'i should drive' is already future-enough + var parsed = parse(vb); // 'i should drive' is already future-enough - if (useParticiple$1(parsed)) { + if (useParticiple(parsed)) { return; } - var str = conjugate_1$1(parsed, _this7.world).FutureTense; + var str = conjugate_1(parsed, _this7.world).FutureTense; if (str) { parsed = makeNeutral(parsed); // avoid 'he would will go' @@ -14478,9 +14474,9 @@ var methods$7 = { var _this8 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var str = conjugate_1$1(parsed, _this8.world).Infinitive; + var str = conjugate_1(parsed, _this8.world).Infinitive; if (str) { vb.replaceWith(str, false); @@ -14495,9 +14491,9 @@ var methods$7 = { var _this9 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); - var str = conjugate_1$1(parsed, _this9.world).Gerund; + var str = conjugate_1(parsed, _this9.world).Gerund; if (str) { vb.replaceWith(str, false); @@ -14512,7 +14508,7 @@ var methods$7 = { var _this10 = this; this.forEach(function (vb) { - var parsed = parse$2(vb); + var parsed = parse(vb); var noAux = !parsed.auxiliary.found; _toParticiple(parsed, _this10.world); // dirty trick to ensure our new auxiliary is found @@ -14537,6 +14533,11 @@ var methods$7 = { return this.ifNo('#Negative'); }, + /** return only commands - verbs in imperative mood */ + isImperative: function isImperative() { + return this["if"]('#Imperative'); + }, + /** add a 'not' to these verbs */ toNegative: function toNegative() { var _this11 = this; @@ -14544,7 +14545,7 @@ var methods$7 = { this.list.forEach(function (p) { var doc = _this11.buildFrom([p]); - var parsed = parse$2(doc); + var parsed = parse(doc); toNegative_1(parsed, doc.world); }); @@ -14576,7 +14577,7 @@ var methods$7 = { } }; -var addMethod$9 = function addMethod(Doc) { +var addMethod$1 = function addMethod(Doc) { /** */ var Verbs = /*#__PURE__*/function (_Doc) { _inherits(Verbs, _Doc); @@ -14593,7 +14594,7 @@ var addMethod$9 = function addMethod(Doc) { }(Doc); // add-in our methods - Object.assign(Verbs.prototype, methods$7); // aliases + Object.assign(Verbs.prototype, methods$1); // aliases Verbs.prototype.negate = Verbs.prototype.toNegative; @@ -14642,9 +14643,9 @@ var addMethod$9 = function addMethod(Doc) { return Doc; }; -var Verbs = addMethod$9; +var Verbs = addMethod$1; -var addMethod$a = function addMethod(Doc) { +var addMethod = function addMethod(Doc) { /** */ var People = /*#__PURE__*/function (_Doc) { _inherits(People, _Doc); @@ -14674,7 +14675,7 @@ var addMethod$a = function addMethod(Doc) { return Doc; }; -var People = addMethod$a; +var People = addMethod; var subclass = [Abbreviations, Acronyms, Clauses, Contractions, Lists, Nouns, Parentheses, Possessives, Quotations, Verbs, People]; @@ -14692,7 +14693,7 @@ var extend = function extend(Doc) { var Subset = extend; -var methods$8 = { +var methods = { misc: methods$4, selections: _simple }; @@ -14790,20 +14791,20 @@ Doc.prototype.fromText = function (str) { return this.buildFrom(list); }; -Object.assign(Doc.prototype, methods$8.misc); -Object.assign(Doc.prototype, methods$8.selections); //add sub-classes +Object.assign(Doc.prototype, methods.misc); +Object.assign(Doc.prototype, methods.selections); //add sub-classes Subset(Doc); //aliases -var aliases$1 = { +var aliases = { untag: 'unTag', and: 'match', notIf: 'ifNo', only: 'if', onlyIf: 'if' }; -Object.keys(aliases$1).forEach(function (k) { - return Doc.prototype[k] = Doc.prototype[aliases$1[k]]; +Object.keys(aliases).forEach(function (k) { + return Doc.prototype[k] = Doc.prototype[aliases[k]]; }); var Doc_1 = Doc; diff --git a/changelog.md b/changelog.md index 3deab202b..687a47e48 100644 --- a/changelog.md +++ b/changelog.md @@ -9,12 +9,17 @@ 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. +#### 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 + + #### 13.10.0 [Feb 2021] - **[new]** - #Fraction tag and improved fraction support (thanks Jakeii!) - **[fix]** - edge-case match issues with `!` syntax diff --git a/package-lock.json b/package-lock.json index c96160a9b..8a1d76c89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "compromise", - "version": "13.9.3", + "version": "13.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -14,31 +14,32 @@ } }, "@babel/compat-data": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.12.13.tgz", - "integrity": "sha512-U/hshG5R+SIoW7HVWIdmy1cB7s3ki+r3FpyEZiCgpi4tFgPnX/vynY80ZGSASOIrUM6O7VxOgCZgdt7h97bUGg==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.13.8.tgz", + "integrity": "sha512-EaI33z19T4qN3xLXsGf48M2cDqa6ei9tPZlfLdb2HC+e/cFtREiRd8hdSqDbwdLB0/+gLwqJmCYASH0z2bUdog==", "dev": true }, "@babel/core": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.17.tgz", - "integrity": "sha512-V3CuX1aBywbJvV2yzJScRxeiiw0v2KZZYYE3giywxzFJL13RiyPjaaDwhDnxmgFTTS7FgvM2ijr4QmKNIu0AtQ==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.13.8.tgz", + "integrity": "sha512-oYapIySGw1zGhEFRd6lzWNLWFX2s5dA/jm+Pw/+59ZdXtjyIuwlXbrId22Md0rgZVop+aVoqow2riXhBLNyuQg==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.12.17", - "@babel/helper-module-transforms": "^7.12.17", - "@babel/helpers": "^7.12.17", - "@babel/parser": "^7.12.17", + "@babel/generator": "^7.13.0", + "@babel/helper-compilation-targets": "^7.13.8", + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helpers": "^7.13.0", + "@babel/parser": "^7.13.4", "@babel/template": "^7.12.13", - "@babel/traverse": "^7.12.17", - "@babel/types": "^7.12.17", + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", + "gensync": "^1.0.0-beta.2", "json5": "^2.1.2", "lodash": "^4.17.19", - "semver": "^5.4.1", + "semver": "^6.3.0", "source-map": "^0.5.0" }, "dependencies": { @@ -58,9 +59,9 @@ "dev": true }, "@babel/highlight": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.12.13.tgz", - "integrity": "sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.8.tgz", + "integrity": "sha512-4vrIhfJyfNf+lCtXC2ck1rKSzDwciqF7IWFhXXrSOUC2O5DrVp+w4c6ed4AllTxhTkUP5x2tYj41VaxdVMMRDw==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -69,9 +70,9 @@ } }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -82,12 +83,12 @@ } }, "@babel/generator": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.17.tgz", - "integrity": "sha512-DSA7ruZrY4WI8VxuS1jWSRezFnghEoYEFrZcw9BizQRmOZiUsiHl59+qEARGPqPikwA/GPTyRCi7isuCK/oyqg==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.13.9.tgz", + "integrity": "sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw==", "dev": true, "requires": { - "@babel/types": "^7.12.17", + "@babel/types": "^7.13.0", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, @@ -99,9 +100,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -127,9 +128,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -156,9 +157,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -169,27 +170,27 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.17.tgz", - "integrity": "sha512-5EkibqLVYOuZ89BSg2lv+GG8feywLuvMXNYgf0Im4MssE0mFWPztSpJbildNnUgw0bLI2EsIN4MpSHC2iUJkQA==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.8.tgz", + "integrity": "sha512-pBljUGC1y3xKLn1nrx2eAhurLMA8OqBtBP/JwG4U8skN7kf8/aqwwxpV1N6T0e7r6+7uNitIa/fUxPFagSXp3A==", "dev": true, "requires": { - "@babel/compat-data": "^7.12.13", + "@babel/compat-data": "^7.13.8", "@babel/helper-validator-option": "^7.12.17", "browserslist": "^4.14.5", - "semver": "^5.5.0" + "semver": "^6.3.0" } }, "@babel/helper-create-class-features-plugin": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.17.tgz", - "integrity": "sha512-I/nurmTxIxHV0M+rIpfQBF1oN342+yvl2kwZUrQuOClMamHF1w5tknfZubgNOLRoA73SzBFAdFcpb4M9HwOeWQ==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.13.8.tgz", + "integrity": "sha512-qioaRrKHQbn4hkRKDHbnuQ6kAxmmOF+kzKGnIfxPK4j2rckSJCpKzr/SSTlohSCiE3uAQpNDJ9FIh4baeE8W+w==", "dev": true, "requires": { "@babel/helper-function-name": "^7.12.13", - "@babel/helper-member-expression-to-functions": "^7.12.17", + "@babel/helper-member-expression-to-functions": "^7.13.0", "@babel/helper-optimise-call-expression": "^7.12.13", - "@babel/helper-replace-supers": "^7.12.13", + "@babel/helper-replace-supers": "^7.13.0", "@babel/helper-split-export-declaration": "^7.12.13" } }, @@ -203,13 +204,57 @@ "regexpu-core": "^4.7.1" } }, + "@babel/helper-define-polyfill-provider": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.1.5.tgz", + "integrity": "sha512-nXuzCSwlJ/WKr8qxzW816gwyT6VZgiJG17zR40fou70yfAcqjoNyTLl/DQ+FExw5Hx5KNqshmN8Ldl/r2N7cTg==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "dependencies": { + "@babel/helper-module-imports": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.13.tgz", + "integrity": "sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g==", + "dev": true, + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "@babel/types": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + } + } + }, "@babel/helper-explode-assignable-expression": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.12.13.tgz", - "integrity": "sha512-5loeRNvMo9mx1dA/d6yNi+YiKziJZFylZnCo1nmFF4qPU4yJ14abhWESuSMQSlQxWdxdOFzxXjk/PpfudTtYyw==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.13.0.tgz", + "integrity": "sha512-qS0peLTDP8kOisG1blKbaoBg/o9OSa1qoumMjTK5pM+KDTtpxpsiubnCGP34vK8BXGcb2M9eigwgvoJryrzwWA==", "dev": true, "requires": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.13.0" }, "dependencies": { "@babel/helper-validator-identifier": { @@ -219,9 +264,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -249,9 +294,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -277,9 +322,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -290,12 +335,13 @@ } }, "@babel/helper-hoist-variables": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.12.13.tgz", - "integrity": "sha512-KSC5XSj5HreRhYQtZ3cnSnQwDzgnbdUDEFsxkN0m6Q3WrCRt72xrnZ8+h+pX7YxM7hr87zIO3a/v5p/H3TrnVw==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.13.0.tgz", + "integrity": "sha512-0kBzvXiIKfsCA0y6cFEIJf4OdzfpRuNk4+YTeHZpGGc666SATFKTz6sRncwFnQk7/ugJ4dSrCj6iJuvW4Qwr2g==", "dev": true, "requires": { - "@babel/types": "^7.12.13" + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0" }, "dependencies": { "@babel/helper-validator-identifier": { @@ -305,9 +351,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -318,12 +364,12 @@ } }, "@babel/helper-member-expression-to-functions": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.17.tgz", - "integrity": "sha512-Bzv4p3ODgS/qpBE0DiJ9qf5WxSmrQ8gVTe8ClMfwwsY2x/rhykxxy3bXzG7AGTnPB2ij37zGJ/Q/6FruxHxsxg==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.0.tgz", + "integrity": "sha512-yvRf8Ivk62JwisqV1rFRMxiSMDGnN6KH1/mDMmIrij4jztpQNRoHqqMG3U6apYbGRPJpgPalhva9Yd06HlUxJQ==", "dev": true, "requires": { - "@babel/types": "^7.12.17" + "@babel/types": "^7.13.0" }, "dependencies": { "@babel/helper-validator-identifier": { @@ -333,9 +379,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -355,19 +401,19 @@ } }, "@babel/helper-module-transforms": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.17.tgz", - "integrity": "sha512-sFL+p6zOCQMm9vilo06M4VHuTxUAwa6IxgL56Tq1DVtA0ziAGTH1ThmJq7xwPqdQlgAbKX3fb0oZNbtRIyA5KQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.13.0.tgz", + "integrity": "sha512-Ls8/VBwH577+pw7Ku1QkUWIyRRNHpYlts7+qSqBBFCW3I8QteB9DxfcZ5YJpOwH6Ihe/wn8ch7fMGOP1OhEIvw==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-replace-supers": "^7.12.13", + "@babel/helper-replace-supers": "^7.13.0", "@babel/helper-simple-access": "^7.12.13", "@babel/helper-split-export-declaration": "^7.12.13", "@babel/helper-validator-identifier": "^7.12.11", "@babel/template": "^7.12.13", - "@babel/traverse": "^7.12.17", - "@babel/types": "^7.12.17", + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0", "lodash": "^4.17.19" }, "dependencies": { @@ -387,9 +433,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -415,9 +461,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -428,20 +474,20 @@ } }, "@babel/helper-plugin-utils": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.12.13.tgz", - "integrity": "sha512-C+10MXCXJLiR6IeG9+Wiejt9jmtFpxUc3MQqCmPY8hfCjyUGl9kT+B2okzEZrtykiwrc4dbCPdDoz0A/HQbDaA==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz", + "integrity": "sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==", "dev": true }, "@babel/helper-remap-async-to-generator": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.13.tgz", - "integrity": "sha512-Qa6PU9vNcj1NZacZZI1Mvwt+gXDH6CTfgAkSjeRMLE8HxtDK76+YDId6NQR+z7Rgd5arhD2cIbS74r0SxD6PDA==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.13.0.tgz", + "integrity": "sha512-pUQpFBE9JvC9lrQbpX0TmeNIy5s7GnZjna2lhhcHC7DzgBs6fWn722Y5cfwgrtrqc7NAJwMvOa0mKhq6XaE4jg==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.12.13", - "@babel/helper-wrap-function": "^7.12.13", - "@babel/types": "^7.12.13" + "@babel/helper-wrap-function": "^7.13.0", + "@babel/types": "^7.13.0" }, "dependencies": { "@babel/helper-validator-identifier": { @@ -451,9 +497,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -464,15 +510,15 @@ } }, "@babel/helper-replace-supers": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.13.tgz", - "integrity": "sha512-pctAOIAMVStI2TMLhozPKbf5yTEXc0OJa0eENheb4w09SrgOWEs+P4nTOZYJQCqs8JlErGLDPDJTiGIp3ygbLg==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.13.0.tgz", + "integrity": "sha512-Segd5me1+Pz+rmN/NFBOplMbZG3SqRJOBlY+mA0SxAv6rjj7zJqr1AVr3SfzUVTLCv7ZLU5FycOM/SBGuLPbZw==", "dev": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.12.13", + "@babel/helper-member-expression-to-functions": "^7.13.0", "@babel/helper-optimise-call-expression": "^7.12.13", - "@babel/traverse": "^7.12.13", - "@babel/types": "^7.12.13" + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0" }, "dependencies": { "@babel/helper-validator-identifier": { @@ -482,9 +528,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -510,9 +556,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -538,9 +584,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -566,9 +612,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -591,15 +637,15 @@ "dev": true }, "@babel/helper-wrap-function": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.12.13.tgz", - "integrity": "sha512-t0aZFEmBJ1LojdtJnhOaQEVejnzYhyjWHSsNSNo8vOYRbAJNh6r6GQF7pd36SqG7OKGbn+AewVQ/0IfYfIuGdw==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.13.0.tgz", + "integrity": "sha512-1UX9F7K3BS42fI6qd2A4BjKzgGjToscyZTdp1DjknHLCIvpgne6918io+aL5LXFcER/8QWiwpoY902pVEqgTXA==", "dev": true, "requires": { "@babel/helper-function-name": "^7.12.13", "@babel/template": "^7.12.13", - "@babel/traverse": "^7.12.13", - "@babel/types": "^7.12.13" + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0" }, "dependencies": { "@babel/helper-validator-identifier": { @@ -609,9 +655,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -622,14 +668,14 @@ } }, "@babel/helpers": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.17.tgz", - "integrity": "sha512-tEpjqSBGt/SFEsFikKds1sLNChKKGGR17flIgQKXH4fG6m9gTgl3gnOC1giHNyaBCSKuTfxaSzHi7UnvqiVKxg==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.13.0.tgz", + "integrity": "sha512-aan1MeFPxFacZeSz6Ld7YZo5aPuqnKlD7+HZY75xQsueczFccP9A7V05+oe0XpLwHK3oLorPe9eaAUljL7WEaQ==", "dev": true, "requires": { "@babel/template": "^7.12.13", - "@babel/traverse": "^7.12.17", - "@babel/types": "^7.12.17" + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0" }, "dependencies": { "@babel/helper-validator-identifier": { @@ -639,9 +685,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -671,40 +717,40 @@ } }, "@babel/parser": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.17.tgz", - "integrity": "sha512-r1yKkiUTYMQ8LiEI0UcQx5ETw5dpTLn9wijn9hk6KkTtOK95FndDN10M+8/s6k/Ymlbivw0Av9q4SlgF80PtHg==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.9.tgz", + "integrity": "sha512-nEUfRiARCcaVo3ny3ZQjURjHQZUo/JkEw7rLlSZy/psWGnvwXFtPcr6jb7Yb41DVW5LTe6KRq9LGleRNsg1Frw==", "dev": true }, "@babel/plugin-proposal-async-generator-functions": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.13.tgz", - "integrity": "sha512-1KH46Hx4WqP77f978+5Ye/VUbuwQld2hph70yaw2hXS2v7ER2f3nlpNMu909HO2rbvP0NKLlMVDPh9KXklVMhA==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.13.8.tgz", + "integrity": "sha512-rPBnhj+WgoSmgq+4gQUtXx/vOcU+UYtjy1AA/aeD61Hwj410fwYyqfUcRP3lR8ucgliVJL/G7sXcNUecC75IXA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/helper-remap-async-to-generator": "^7.12.13", - "@babel/plugin-syntax-async-generators": "^7.8.0" + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-remap-async-to-generator": "^7.13.0", + "@babel/plugin-syntax-async-generators": "^7.8.4" } }, "@babel/plugin-proposal-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.13.tgz", - "integrity": "sha512-8SCJ0Ddrpwv4T7Gwb33EmW1V9PY5lggTO+A8WjyIwxrSHDUyBw4MtF96ifn1n8H806YlxbVCoKXbbmzD6RD+cA==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.13.0.tgz", + "integrity": "sha512-KnTDjFNC1g+45ka0myZNvSBFLhNCLN+GeGYLDEA8Oq7MZ6yMgfLoIRh86GRT0FjtJhZw8JyUskP9uvj5pHM9Zg==", "dev": true, "requires": { - "@babel/helper-create-class-features-plugin": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-create-class-features-plugin": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-proposal-dynamic-import": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.12.17.tgz", - "integrity": "sha512-ZNGoFZqrnuy9H2izB2jLlnNDAfVPlGl5NhFEiFe4D84ix9GQGygF+CWMGHKuE+bpyS/AOuDQCnkiRNqW2IzS1Q==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.13.8.tgz", + "integrity": "sha512-ONWKj0H6+wIRCkZi9zSbZtE/r73uOhMVHh256ys0UzfM7I3d4n+spZNWjOnJv2gzopumP2Wxi186vI8N0Y2JyQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/plugin-syntax-dynamic-import": "^7.8.0" + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" } }, "@babel/plugin-proposal-export-namespace-from": { @@ -718,33 +764,33 @@ } }, "@babel/plugin-proposal-json-strings": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.12.13.tgz", - "integrity": "sha512-v9eEi4GiORDg8x+Dmi5r8ibOe0VXoKDeNPYcTTxdGN4eOWikrJfDJCJrr1l5gKGvsNyGJbrfMftC2dTL6oz7pg==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.13.8.tgz", + "integrity": "sha512-w4zOPKUFPX1mgvTmL/fcEqy34hrQ1CRcGxdphBc6snDnnqJ47EZDIyop6IwXzAC8G916hsIuXB2ZMBCExC5k7Q==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/plugin-syntax-json-strings": "^7.8.0" + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-json-strings": "^7.8.3" } }, "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.12.13.tgz", - "integrity": "sha512-fqmiD3Lz7jVdK6kabeSr1PZlWSUVqSitmHEe3Z00dtGTKieWnX9beafvavc32kjORa5Bai4QNHgFDwWJP+WtSQ==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.13.8.tgz", + "integrity": "sha512-aul6znYB4N4HGweImqKn59Su9RS8lbUIqxtXTOcAGtNIDczoEFv+l1EhmX8rUBp3G1jMjKJm8m0jXVp63ZpS4A==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" } }, "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.12.13.tgz", - "integrity": "sha512-Qoxpy+OxhDBI5kRqliJFAl4uWXk3Bn24WeFstPH0iLymFehSAUR8MHpqU7njyXv/qbo7oN6yTy5bfCmXdKpo1Q==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.13.8.tgz", + "integrity": "sha512-iePlDPBn//UhxExyS9KyeYU7RM9WScAG+D3Hhno0PLJebAEpDZMocbDe64eqynhNAnwz/vZoL/q/QB2T1OH39A==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" } }, "@babel/plugin-proposal-numeric-separator": { @@ -758,45 +804,47 @@ } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.13.tgz", - "integrity": "sha512-WvA1okB/0OS/N3Ldb3sziSrXg6sRphsBgqiccfcQq7woEn5wQLNX82Oc4PlaFcdwcWHuQXAtb8ftbS8Fbsg/sg==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.13.8.tgz", + "integrity": "sha512-DhB2EuB1Ih7S3/IRX5AFVgZ16k3EzfRbq97CxAVI1KSYcW+lexV8VZb7G7L8zuPVSdQMRn0kiBpf/Yzu9ZKH0g==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/plugin-syntax-object-rest-spread": "^7.8.0", - "@babel/plugin-transform-parameters": "^7.12.13" + "@babel/compat-data": "^7.13.8", + "@babel/helper-compilation-targets": "^7.13.8", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.13.0" } }, "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.12.13.tgz", - "integrity": "sha512-9+MIm6msl9sHWg58NvqpNpLtuFbmpFYk37x8kgnGzAHvX35E1FyAwSUt5hIkSoWJFSAH+iwU8bJ4fcD1zKXOzg==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.13.8.tgz", + "integrity": "sha512-0wS/4DUF1CuTmGo+NiaHfHcVSeSLj5S3e6RivPTg/2k3wOv3jO35tZ6/ZWsQhQMvdgI7CwphjQa/ccarLymHVA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.0" + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" } }, "@babel/plugin-proposal-optional-chaining": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.12.17.tgz", - "integrity": "sha512-TvxwI80pWftrGPKHNfkvX/HnoeSTR7gC4ezWnAL39PuktYUe6r8kEpOLTYnkBTsaoeazXm2jHJ22EQ81sdgfcA==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.13.8.tgz", + "integrity": "sha512-hpbBwbTgd7Cz1QryvwJZRo1U0k1q8uyBmeXOSQUjdg/A2TASkhR/rz7AyqZ/kS8kbpsNA80rOYbxySBJAqmhhQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1", - "@babel/plugin-syntax-optional-chaining": "^7.8.0" + "@babel/plugin-syntax-optional-chaining": "^7.8.3" } }, "@babel/plugin-proposal-private-methods": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.13.tgz", - "integrity": "sha512-sV0V57uUwpauixvR7s2o75LmwJI6JECwm5oPUY5beZB1nBl2i37hc7CJGqB5G+58fur5Y6ugvl3LRONk5x34rg==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.13.0.tgz", + "integrity": "sha512-MXyyKQd9inhx1kDYPkFRVOBXQ20ES8Pto3T7UZ92xj2mY0EVD8oAVzeyYuVfy/mxAdTSIayOvg+aVzcHV2bn6Q==", "dev": true, "requires": { - "@babel/helper-create-class-features-plugin": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-create-class-features-plugin": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-proposal-unicode-property-regex": { @@ -918,23 +966,23 @@ } }, "@babel/plugin-transform-arrow-functions": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.12.13.tgz", - "integrity": "sha512-tBtuN6qtCTd+iHzVZVOMNp+L04iIJBpqkdY42tWbmjIT5wvR2kx7gxMBsyhQtFzHwBbyGi9h8J8r9HgnOpQHxg==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.13.0.tgz", + "integrity": "sha512-96lgJagobeVmazXFaDrbmCLQxBysKu7U6Do3mLsx27gf5Dk85ezysrs2BZUpXD703U/Su1xTBDxxar2oa4jAGg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-transform-async-to-generator": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.12.13.tgz", - "integrity": "sha512-psM9QHcHaDr+HZpRuJcE1PXESuGWSCcbiGFFhhwfzdbTxaGDVzuVtdNYliAwcRo3GFg0Bc8MmI+AvIGYIJG04A==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.13.0.tgz", + "integrity": "sha512-3j6E004Dx0K3eGmhxVJxwwI89CTJrce7lg3UrtFuDAVQ/2+SJ/h/aSFOeE6/n0WB1GsOffsJp6MnPQNQ8nmwhg==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/helper-remap-async-to-generator": "^7.12.13" + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-remap-async-to-generator": "^7.13.0" }, "dependencies": { "@babel/helper-module-imports": { @@ -953,9 +1001,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -984,36 +1032,36 @@ } }, "@babel/plugin-transform-classes": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.12.13.tgz", - "integrity": "sha512-cqZlMlhCC1rVnxE5ZGMtIb896ijL90xppMiuWXcwcOAuFczynpd3KYemb91XFFPi3wJSe/OcrX9lXoowatkkxA==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.13.0.tgz", + "integrity": "sha512-9BtHCPUARyVH1oXGcSJD3YpsqRLROJx5ZNP6tN5vnk17N0SVf9WCtf8Nuh1CFmgByKKAIMstitKduoCmsaDK5g==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.12.13", "@babel/helper-function-name": "^7.12.13", "@babel/helper-optimise-call-expression": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13", - "@babel/helper-replace-supers": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-replace-supers": "^7.13.0", "@babel/helper-split-export-declaration": "^7.12.13", "globals": "^11.1.0" } }, "@babel/plugin-transform-computed-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.12.13.tgz", - "integrity": "sha512-dDfuROUPGK1mTtLKyDPUavmj2b6kFu82SmgpztBFEO974KMjJT+Ytj3/oWsTUMBmgPcp9J5Pc1SlcAYRpJ2hRA==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.13.0.tgz", + "integrity": "sha512-RRqTYTeZkZAz8WbieLTvKUEUxZlUTdmL5KGMyZj7FnMfLNKV4+r5549aORG/mgojRmFlQMJDUupwAMiF2Q7OUg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-transform-destructuring": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.12.13.tgz", - "integrity": "sha512-Dn83KykIFzjhA3FDPA1z4N+yfF3btDGhjnJwxIj0T43tP0flCujnU8fKgEkf0C1biIpSv9NZegPBQ1J6jYkwvQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.13.0.tgz", + "integrity": "sha512-zym5em7tePoNT9s964c0/KU3JPPnuq7VhIxPRefJ4/s82cD+q1mgKfuGRDMCPL0HTyKz4dISuQlCusfgCJ86HA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-transform-dotall-regex": { @@ -1046,12 +1094,12 @@ } }, "@babel/plugin-transform-for-of": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.12.13.tgz", - "integrity": "sha512-xCbdgSzXYmHGyVX3+BsQjcd4hv4vA/FDy7Kc8eOpzKmBBPEOTurt0w5fCRQaGl+GSBORKgJdstQ1rHl4jbNseQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.13.0.tgz", + "integrity": "sha512-IHKT00mwUVYE0zzbkDgNRP6SRzvfGCYsOxIRz8KsiaaHCcT9BWIkO+H9QRJseHBLOGBZkHUdHiqj6r0POsdytg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-transform-function-name": { @@ -1083,37 +1131,37 @@ } }, "@babel/plugin-transform-modules-amd": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.12.13.tgz", - "integrity": "sha512-JHLOU0o81m5UqG0Ulz/fPC68/v+UTuGTWaZBUwpEk1fYQ1D9LfKV6MPn4ttJKqRo5Lm460fkzjLTL4EHvCprvA==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.13.0.tgz", + "integrity": "sha512-EKy/E2NHhY/6Vw5d1k3rgoobftcNUmp9fGjb9XZwQLtTctsRBOTRO7RHHxfIky1ogMN5BxN7p9uMA3SzPfotMQ==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13", + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0", "babel-plugin-dynamic-import-node": "^2.3.3" } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.13.tgz", - "integrity": "sha512-OGQoeVXVi1259HjuoDnsQMlMkT9UkZT9TpXAsqWplS/M0N1g3TJAn/ByOCeQu7mfjc5WpSsRU+jV1Hd89ts0kQ==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.13.8.tgz", + "integrity": "sha512-9QiOx4MEGglfYZ4XOnU79OHr6vIWUakIj9b4mioN8eQIoEh+pf5p/zEB36JpDFWA12nNMiRf7bfoRvl9Rn79Bw==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13", + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0", "@babel/helper-simple-access": "^7.12.13", "babel-plugin-dynamic-import-node": "^2.3.3" } }, "@babel/plugin-transform-modules-systemjs": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.12.13.tgz", - "integrity": "sha512-aHfVjhZ8QekaNF/5aNdStCGzwTbU7SI5hUybBKlMzqIMC7w7Ho8hx5a4R/DkTHfRfLwHGGxSpFt9BfxKCoXKoA==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.13.8.tgz", + "integrity": "sha512-hwqctPYjhM6cWvVIlOIe27jCIBgHCsdH2xCJVAYQm7V5yTMoilbVMi9f6wKg0rpQAOn6ZG4AOyvCqFF/hUh6+A==", "dev": true, "requires": { - "@babel/helper-hoist-variables": "^7.12.13", - "@babel/helper-module-transforms": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13", + "@babel/helper-hoist-variables": "^7.13.0", + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0", "@babel/helper-validator-identifier": "^7.12.11", "babel-plugin-dynamic-import-node": "^2.3.3" }, @@ -1127,13 +1175,13 @@ } }, "@babel/plugin-transform-modules-umd": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.12.13.tgz", - "integrity": "sha512-BgZndyABRML4z6ibpi7Z98m4EVLFI9tVsZDADC14AElFaNHHBcJIovflJ6wtCqFxwy2YJ1tJhGRsr0yLPKoN+w==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.13.0.tgz", + "integrity": "sha512-D/ILzAh6uyvkWjKKyFE/W0FzWwasv6vPTSqPcjxFqn6QpX3u8DjRVliq4F2BamO2Wee/om06Vyy+vPkNrd4wxw==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-transform-named-capturing-groups-regex": { @@ -1165,12 +1213,12 @@ } }, "@babel/plugin-transform-parameters": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.12.13.tgz", - "integrity": "sha512-e7QqwZalNiBRHCpJg/P8s/VJeSRYgmtWySs1JwvfwPqhBbiWfOcHDKdeAi6oAyIimoKWBlwc8oTgbZHdhCoVZA==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.13.0.tgz", + "integrity": "sha512-Jt8k/h/mIwE2JFEOb3lURoY5C85ETcYPnbuAJ96zRBzh1XHtQZfs62ChZ6EP22QlC8c7Xqr9q+e1SU5qttwwjw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-transform-property-literals": { @@ -1210,12 +1258,12 @@ } }, "@babel/plugin-transform-spread": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.12.13.tgz", - "integrity": "sha512-dUCrqPIowjqk5pXsx1zPftSq4sT0aCeZVAxhdgs3AMgyaDmoUT0G+5h3Dzja27t76aUEIJWlFgPJqJ/d4dbTtg==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.13.0.tgz", + "integrity": "sha512-V6vkiXijjzYeFmQTr3dBxPtZYLPcUfY34DebOU27jIl2M/Y8Egm52Hw82CSjjPqd54GTlJs5x+CR7HeNr24ckg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1" } }, @@ -1229,12 +1277,12 @@ } }, "@babel/plugin-transform-template-literals": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.12.13.tgz", - "integrity": "sha512-arIKlWYUgmNsF28EyfmiQHJLJFlAJNYkuQO10jL46ggjBpeb2re1P9K9YGxNJB45BqTbaslVysXDYm/g3sN/Qg==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.13.0.tgz", + "integrity": "sha512-d67umW6nlfmr1iehCcBv69eSUSySk1EsIS8aTDX4Xo9qajAh6mYtcl4kJrBkGXuxZPEgVr7RVfAvNW6YQkd4Mw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.13.0" } }, "@babel/plugin-transform-typeof-symbol": { @@ -1266,88 +1314,81 @@ } }, "@babel/preset-env": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.12.17.tgz", - "integrity": "sha512-9PMijx8zFbCwTHrd2P4PJR5nWGH3zWebx2OcpTjqQrHhCiL2ssSR2Sc9ko2BsI2VmVBfoaQmPrlMTCui4LmXQg==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.13.9.tgz", + "integrity": "sha512-mcsHUlh2rIhViqMG823JpscLMesRt3QbMsv1+jhopXEb3W2wXvQ9QoiOlZI9ZbR3XqPtaFpZwEZKYqGJnGMZTQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.12.13", - "@babel/helper-compilation-targets": "^7.12.17", - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-plugin-utils": "^7.12.13", + "@babel/compat-data": "^7.13.8", + "@babel/helper-compilation-targets": "^7.13.8", + "@babel/helper-plugin-utils": "^7.13.0", "@babel/helper-validator-option": "^7.12.17", - "@babel/plugin-proposal-async-generator-functions": "^7.12.13", - "@babel/plugin-proposal-class-properties": "^7.12.13", - "@babel/plugin-proposal-dynamic-import": "^7.12.17", + "@babel/plugin-proposal-async-generator-functions": "^7.13.8", + "@babel/plugin-proposal-class-properties": "^7.13.0", + "@babel/plugin-proposal-dynamic-import": "^7.13.8", "@babel/plugin-proposal-export-namespace-from": "^7.12.13", - "@babel/plugin-proposal-json-strings": "^7.12.13", - "@babel/plugin-proposal-logical-assignment-operators": "^7.12.13", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13", + "@babel/plugin-proposal-json-strings": "^7.13.8", + "@babel/plugin-proposal-logical-assignment-operators": "^7.13.8", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", "@babel/plugin-proposal-numeric-separator": "^7.12.13", - "@babel/plugin-proposal-object-rest-spread": "^7.12.13", - "@babel/plugin-proposal-optional-catch-binding": "^7.12.13", - "@babel/plugin-proposal-optional-chaining": "^7.12.17", - "@babel/plugin-proposal-private-methods": "^7.12.13", + "@babel/plugin-proposal-object-rest-spread": "^7.13.8", + "@babel/plugin-proposal-optional-catch-binding": "^7.13.8", + "@babel/plugin-proposal-optional-chaining": "^7.13.8", + "@babel/plugin-proposal-private-methods": "^7.13.0", "@babel/plugin-proposal-unicode-property-regex": "^7.12.13", - "@babel/plugin-syntax-async-generators": "^7.8.0", + "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-dynamic-import": "^7.8.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.0", + "@babel/plugin-syntax-json-strings": "^7.8.3", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", "@babel/plugin-syntax-top-level-await": "^7.12.13", - "@babel/plugin-transform-arrow-functions": "^7.12.13", - "@babel/plugin-transform-async-to-generator": "^7.12.13", + "@babel/plugin-transform-arrow-functions": "^7.13.0", + "@babel/plugin-transform-async-to-generator": "^7.13.0", "@babel/plugin-transform-block-scoped-functions": "^7.12.13", "@babel/plugin-transform-block-scoping": "^7.12.13", - "@babel/plugin-transform-classes": "^7.12.13", - "@babel/plugin-transform-computed-properties": "^7.12.13", - "@babel/plugin-transform-destructuring": "^7.12.13", + "@babel/plugin-transform-classes": "^7.13.0", + "@babel/plugin-transform-computed-properties": "^7.13.0", + "@babel/plugin-transform-destructuring": "^7.13.0", "@babel/plugin-transform-dotall-regex": "^7.12.13", "@babel/plugin-transform-duplicate-keys": "^7.12.13", "@babel/plugin-transform-exponentiation-operator": "^7.12.13", - "@babel/plugin-transform-for-of": "^7.12.13", + "@babel/plugin-transform-for-of": "^7.13.0", "@babel/plugin-transform-function-name": "^7.12.13", "@babel/plugin-transform-literals": "^7.12.13", "@babel/plugin-transform-member-expression-literals": "^7.12.13", - "@babel/plugin-transform-modules-amd": "^7.12.13", - "@babel/plugin-transform-modules-commonjs": "^7.12.13", - "@babel/plugin-transform-modules-systemjs": "^7.12.13", - "@babel/plugin-transform-modules-umd": "^7.12.13", + "@babel/plugin-transform-modules-amd": "^7.13.0", + "@babel/plugin-transform-modules-commonjs": "^7.13.8", + "@babel/plugin-transform-modules-systemjs": "^7.13.8", + "@babel/plugin-transform-modules-umd": "^7.13.0", "@babel/plugin-transform-named-capturing-groups-regex": "^7.12.13", "@babel/plugin-transform-new-target": "^7.12.13", "@babel/plugin-transform-object-super": "^7.12.13", - "@babel/plugin-transform-parameters": "^7.12.13", + "@babel/plugin-transform-parameters": "^7.13.0", "@babel/plugin-transform-property-literals": "^7.12.13", "@babel/plugin-transform-regenerator": "^7.12.13", "@babel/plugin-transform-reserved-words": "^7.12.13", "@babel/plugin-transform-shorthand-properties": "^7.12.13", - "@babel/plugin-transform-spread": "^7.12.13", + "@babel/plugin-transform-spread": "^7.13.0", "@babel/plugin-transform-sticky-regex": "^7.12.13", - "@babel/plugin-transform-template-literals": "^7.12.13", + "@babel/plugin-transform-template-literals": "^7.13.0", "@babel/plugin-transform-typeof-symbol": "^7.12.13", "@babel/plugin-transform-unicode-escapes": "^7.12.13", "@babel/plugin-transform-unicode-regex": "^7.12.13", - "@babel/preset-modules": "^0.1.3", - "@babel/types": "^7.12.17", - "core-js-compat": "^3.8.0", - "semver": "^5.5.0" + "@babel/preset-modules": "^0.1.4", + "@babel/types": "^7.13.0", + "babel-plugin-polyfill-corejs2": "^0.1.4", + "babel-plugin-polyfill-corejs3": "^0.1.3", + "babel-plugin-polyfill-regenerator": "^0.1.2", + "core-js-compat": "^3.9.0", + "semver": "^6.3.0" }, "dependencies": { - "@babel/helper-module-imports": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.13.tgz", - "integrity": "sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g==", - "dev": true, - "requires": { - "@babel/types": "^7.12.13" - } - }, "@babel/helper-validator-identifier": { "version": "7.12.11", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", @@ -1355,9 +1396,9 @@ "dev": true }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -1381,9 +1422,9 @@ } }, "@babel/runtime": { - "version": "7.12.18", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.18.tgz", - "integrity": "sha512-BogPQ7ciE6SYAUPtlm9tWbgI9+2AgqSam6QivMgXgAT+fKbgppaj4ZX15MHeLC1PVF5sNk70huBu20XxWOs8Cg==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.9.tgz", + "integrity": "sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==", "dev": true, "requires": { "regenerator-runtime": "^0.13.4" @@ -1416,9 +1457,9 @@ "dev": true }, "@babel/highlight": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.12.13.tgz", - "integrity": "sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.8.tgz", + "integrity": "sha512-4vrIhfJyfNf+lCtXC2ck1rKSzDwciqF7IWFhXXrSOUC2O5DrVp+w4c6ed4AllTxhTkUP5x2tYj41VaxdVMMRDw==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -1427,9 +1468,9 @@ } }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -1440,17 +1481,17 @@ } }, "@babel/traverse": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.17.tgz", - "integrity": "sha512-LGkTqDqdiwC6Q7fWSwQoas/oyiEYw6Hqjve5KOSykXkmFJFqzvGMb9niaUEag3Rlve492Mkye3gLw9FTv94fdQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.13.0.tgz", + "integrity": "sha512-xys5xi5JEhzC3RzEmSGrs/b3pJW/o87SypZ+G/PhaE7uqVQNv/jlmVIBXuoh5atqQ434LfXV+sf23Oxj0bchJQ==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.12.17", + "@babel/generator": "^7.13.0", "@babel/helper-function-name": "^7.12.13", "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.12.17", - "@babel/types": "^7.12.17", + "@babel/parser": "^7.13.0", + "@babel/types": "^7.13.0", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.19" @@ -1472,9 +1513,9 @@ "dev": true }, "@babel/highlight": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.12.13.tgz", - "integrity": "sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.8.tgz", + "integrity": "sha512-4vrIhfJyfNf+lCtXC2ck1rKSzDwciqF7IWFhXXrSOUC2O5DrVp+w4c6ed4AllTxhTkUP5x2tYj41VaxdVMMRDw==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -1483,9 +1524,9 @@ } }, "@babel/types": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.17.tgz", - "integrity": "sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz", + "integrity": "sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -1744,6 +1785,36 @@ "object.assign": "^4.1.0" } }, + "babel-plugin-polyfill-corejs2": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.1.10.tgz", + "integrity": "sha512-DO95wD4g0A8KRaHKi0D51NdGXzvpqVLnLu5BTvDlpqUEpTmeEtypgC1xqesORaWmiUOQI14UHKlzNd9iZ2G3ZA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.0", + "@babel/helper-define-polyfill-provider": "^0.1.5", + "semver": "^6.1.1" + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.1.7.tgz", + "integrity": "sha512-u+gbS9bbPhZWEeyy1oR/YaaSpod/KDT07arZHb80aTpl8H5ZBq+uN1nN9/xtX7jQyfLdPfoqI4Rue/MQSWJquw==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.1.5", + "core-js-compat": "^3.8.1" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.1.6.tgz", + "integrity": "sha512-OUrYG9iKPKz8NxswXbRAdSwF0GhRdIEMTloQATJi4bDuFqrXaXcCUT/VGNrr8pBcjMh1RxZ7Xt9cytVJTJfvMg==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.1.5" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -1835,9 +1906,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001191", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001191.tgz", - "integrity": "sha512-xJJqzyd+7GCJXkcoBiQ1GuxEiOBCLQ0aVW9HMekifZsAVGdj5eJ4mFB9fEhSHipq9IOk/QXFJUiIr9lZT+EsGw==", + "version": "1.0.30001196", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001196.tgz", + "integrity": "sha512-CPvObjD3ovWrNBaXlAIGWmg2gQQuJ5YhuciUOjPRox6hIQttu8O+b51dx6VIpIY9ESd2d0Vac1RKpICdG4rGUg==", "dev": true }, "chalk": { @@ -1946,9 +2017,9 @@ } }, "core-js-compat": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.9.0.tgz", - "integrity": "sha512-YK6fwFjCOKWwGnjFUR3c544YsnA/7DoLL0ysncuOJ4pwbriAtOpvM2bygdlcXbvQCQZ7bBU9CL4t7tGl7ETRpQ==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.9.1.tgz", + "integrity": "sha512-jXAirMQxrkbiiLsCx9bQPJFA6llDadKMpYrBJQJ3/c4/vsPP/fAf29h24tviRlvwUL6AmY5CHLu2GvjuYviQqA==", "dev": true, "requires": { "browserslist": "^4.16.3", @@ -2077,9 +2148,9 @@ "integrity": "sha512-9xUSSj7qcUxz+0r4X3+bwUNttEfGfK5AH+LVa1aTpqdAfrN5VhROYCfcF+up4hp5OL7IUKcZJJrzAGipQRDoiQ==" }, "electron-to-chromium": { - "version": "1.3.671", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.671.tgz", - "integrity": "sha512-RTD97QkdrJKaKwRv9h/wGAaoR2lGxNXEcBXS31vjitgTPwTWAbLdS7cEsBK68eEQy7p6YyT8D5BxBEYHu2SuwQ==", + "version": "1.3.680", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.680.tgz", + "integrity": "sha512-XBACJT9RdpdWtoMXQPR8Be3ZtmizWWbxfw8cY2b5feUwiDO3FUl8qo4W2jXoq/WnnA3xBRqafu1XbpczqyUvlA==", "dev": true }, "emoji-regex": { @@ -2089,25 +2160,27 @@ "dev": true }, "es-abstract": { - "version": "1.18.0-next.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.2.tgz", - "integrity": "sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", + "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2", + "get-intrinsic": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", + "has-symbols": "^1.0.2", + "is-callable": "^1.2.3", "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.1", + "is-regex": "^1.1.2", + "is-string": "^1.0.5", "object-inspect": "^1.9.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.3", - "string.prototype.trimstart": "^1.0.3" + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.0" } }, "es-get-iterator": { @@ -2334,6 +2407,12 @@ "function-bind": "^1.1.1" } }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -2341,9 +2420,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, "hasha": { @@ -2815,6 +2894,12 @@ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "dev": true }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, "lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", @@ -2890,9 +2975,9 @@ } }, "node-releases": { - "version": "1.1.70", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.70.tgz", - "integrity": "sha512-Slf2s69+2/uAD79pVVQo8uSiC34+g8GWY8UH2Qtqv34ZfhYrxpYpfzs9Js9d6O0mbDmALuxaTlplnBTnSELcrw==", + "version": "1.1.71", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz", + "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==", "dev": true }, "normalize-path": { @@ -3258,21 +3343,12 @@ } }, "rollup": { - "version": "2.39.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.39.0.tgz", - "integrity": "sha512-+WR3bttcq7zE+BntH09UxaW3bQo3vItuYeLsyk4dL2tuwbeSKJuvwiawyhEnvRdRgrII0Uzk00FpctHO/zB1kw==", + "version": "2.40.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.40.0.tgz", + "integrity": "sha512-WiOGAPbXoHu+TOz6hyYUxIksOwsY/21TRWoO593jgYt8mvYafYqQl+axaA8y1z2HFazNUUrsMSjahV2A6/2R9A==", "dev": true, "requires": { "fsevents": "~2.3.1" - }, - "dependencies": { - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - } } }, "rollup-plugin-babel": { @@ -3327,9 +3403,9 @@ "dev": true }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, "serialize-javascript": { @@ -3487,22 +3563,22 @@ } }, "string.prototype.trimend": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", - "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", "dev": true, "requires": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3" } }, "string.prototype.trimstart": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", - "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", "dev": true, "requires": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3" } }, @@ -3619,9 +3695,9 @@ } }, "tape": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/tape/-/tape-5.2.0.tgz", - "integrity": "sha512-J7stlwNrBEpHlZvbvPEAFvMmqIy79kMYvXiyekl5w6O7C2HF63bFKi8su70mdUtZZvNMm7EbIzLyI+fk6U9Ntg==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.2.2.tgz", + "integrity": "sha512-grXrzPC1ly2kyTMKdqxh5GiLpb0BpNctCuecTB0psHX4Gu0nc+uxWR4xKjTh/4CfQlH4zhvTM2/EXmHXp6v/uA==", "dev": true, "requires": { "call-bind": "^1.0.2", @@ -3635,11 +3711,11 @@ "is-regex": "^1.1.2", "minimist": "^1.2.5", "object-inspect": "^1.9.0", - "object-is": "^1.1.4", + "object-is": "^1.1.5", "object.assign": "^4.1.2", "resolve": "^2.0.0-next.3", "resumer": "^0.0.0", - "string.prototype.trim": "^1.2.3", + "string.prototype.trim": "^1.2.4", "through": "^2.3.8" }, "dependencies": { @@ -3746,6 +3822,18 @@ "is-typedarray": "^1.0.0" } }, + "unbox-primitive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz", + "integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.0", + "has-symbols": "^1.0.0", + "which-boxed-primitive": "^1.0.1" + } + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/package.json b/package.json index 2321e0484..8f1ce38c4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Spencer Kelly (http://spencermounta.in)", "name": "compromise", "description": "modest natural language processing", - "version": "13.10.0", + "version": "13.10.1", "main": "./builds/compromise.js", "unpkg": "./builds/compromise.min.js", "module": "./builds/compromise.mjs", @@ -70,8 +70,8 @@ "efrt-unpack": "2.2.0" }, "devDependencies": { - "@babel/core": "7.12.17", - "@babel/preset-env": "7.12.17", + "@babel/core": "7.13.8", + "@babel/preset-env": "7.13.9", "@rollup/plugin-alias": "3.1.2", "@rollup/plugin-commonjs": "17.1.0", "@rollup/plugin-json": "4.1.0", @@ -80,13 +80,13 @@ "codecov": "3.8.1", "efrt": "2.2.2", "nyc": "^15.1.0", - "rollup": "2.39.0", + "rollup": "2.40.0", "rollup-plugin-babel": "4.4.0", "rollup-plugin-filesize-check": "0.0.1", "rollup-plugin-terser": "7.0.2", "shelljs": "0.8.4", "tap-dancer": "0.3.1", - "tape": "5.2.0" + "tape": "5.2.2" }, "eslintIgnore": [ "builds/*.js", diff --git a/plugins/dates/builds/compromise-dates.js b/plugins/dates/builds/compromise-dates.js index 6529a0857..0ec61ec78 100644 --- a/plugins/dates/builds/compromise-dates.js +++ b/plugins/dates/builds/compromise-dates.js @@ -1,4 +1,4 @@ -/* compromise-dates 1.4.2 MIT */ +/* compromise-dates 1.4.3 MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -312,7 +312,13 @@ var m = doc.match('^/^20[012][0-9]$/$'); tagYearSafe(m, '2020-ish'); // in 20mins - doc.match('(in|after) /^[0-9]+(min|sec|wk)s?/').tag('Date', 'shift-units'); + doc.match('(in|after) /^[0-9]+(min|sec|wk)s?/').tag('Date', 'shift-units'); //tuesday night + + doc.match('#Date [(now|night|sometime)]', 0).tag('Time', 'date-now'); // 4 days from now + + doc.match('(from|starting|until|by) now').tag('Date', 'for-now'); // every night + + doc.match('(each|every) night').tag('Date', 'for-now'); return doc; }; @@ -368,13 +374,11 @@ //friday to sunday doc.match('#Date #Preposition #Date').tag('Date', here$4); //once a day.. - doc.match('(once|twice) (a|an|each) #Date').tag('Date', here$4); //TODO:fixme - - doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', here$4); //tuesday + doc.match('(once|twice) (a|an|each) #Date').tag('Date', here$4); //tuesday doc.match('#Date+').tag('Date', here$4); //by June - doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', here$4); //a year after.. + doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', 'until-june'); //a year after.. doc.match('a #Duration').tag('Date', here$4); //between x and y @@ -654,12 +658,28 @@ return fn(module, module.exports), module.exports; } - /* spencermountain/spacetime 6.12.5 Apache 2.0 */ + /* spencermountain/spacetime 6.13.0 Apache 2.0 */ var spacetime = createCommonjsModule(function (module, exports) { (function (global, factory) { module.exports = factory() ; })(commonjsGlobal, function () { + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof(obj) { + return typeof obj; + }; + } else { + _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } @@ -1002,7 +1022,7 @@ return null; }; - var parseOffset = function parseOffset(tz) { + var parseOffset$1 = function parseOffset(tz) { // '+5hrs' var m = tz.match(isOffset); @@ -1035,7 +1055,7 @@ return null; }; - var parseOffset_1 = parseOffset; + var parseOffset_1$1 = parseOffset$1; var local = guessTz_1(); //add all the city names by themselves var cities = Object.keys(unpack).reduce(function (h, k) { @@ -1092,7 +1112,7 @@ if (/[0-9]/.test(tz) === true) { - var id = parseOffset_1(tz); + var id = parseOffset_1$1(tz); if (id) { return id; @@ -1172,7 +1192,7 @@ }; //find the desired date by a increment/check while loop - var units = { + var units$3 = { year: { valid: function valid(n) { return n > -4000 && n < 4000; @@ -1259,7 +1279,7 @@ }; var walkTo = function walkTo(s, wants) { - var keys = Object.keys(units); + var keys = Object.keys(units$3); var old = s.clone(); for (var i = 0; i < keys.length; i++) { @@ -1275,7 +1295,7 @@ } //make-sure it's valid - if (!units[k].valid(n)) { + if (!units$3[k].valid(n)) { s.epoch = null; if (s.silent === false) { @@ -1285,7 +1305,7 @@ return; } - units[k].walkTo(s, n); + units$3[k].walkTo(s, n); } return; @@ -1312,7 +1332,7 @@ return obj; } - var months = { + var months$1 = { "short": function _short() { return shortMonths; }, @@ -1328,7 +1348,7 @@ } }; //pull-apart ISO offsets, like "+0100" - var parseOffset$1 = function parseOffset(s, offset) { + var parseOffset = function parseOffset(s, offset) { if (!offset) { return s; } //this is a fancy-move @@ -1386,7 +1406,7 @@ return s; }; - var parseOffset_1$1 = parseOffset$1; + var parseOffset_1 = parseOffset; var parseTime = function parseTime(s) { var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; @@ -1599,7 +1619,7 @@ fns.getEpoch; fns.beADate; fns.formatTimezone; - var isLeapYear = fns.isLeapYear; //given a month, return whether day number exists in it + var isLeapYear$2 = fns.isLeapYear; //given a month, return whether day number exists in it var hasDate = function hasDate(obj) { //invalid values @@ -1609,7 +1629,7 @@ if (obj.month === 1) { - if (isLeapYear(obj.year) && obj.date <= 29) { + if (isLeapYear$2(obj.year) && obj.date <= 29) { return true; } else { return obj.date <= 28; @@ -1627,7 +1647,7 @@ }; var hasDate_1 = hasDate; - var months$1 = months.mapping(); + var months = months$1.mapping(); var parseYear = function parseYear() { var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; @@ -1659,7 +1679,7 @@ return s; } - parseOffset_1$1(s, arr[5]); + parseOffset_1(s, arr[5]); walk_1(s, obj); s = parseTime_1(s, arr[4]); return s; @@ -1733,7 +1753,7 @@ return s; } - parseOffset_1$1(s, arr[5]); + parseOffset_1(s, arr[5]); walk_1(s, obj); s = parseTime_1(s, arr[4]); return s; @@ -1742,7 +1762,7 @@ { reg: /^([0-9]{1,2})[\-\/]([a-z]+)[\-\/]?([0-9]{4})?$/i, parse: function parse(s, arr) { - var month = months$1[arr[2].toLowerCase()]; + var month = months[arr[2].toLowerCase()]; var year = parseYear(arr[3], s._today); var obj = { year: year, @@ -1763,7 +1783,7 @@ { reg: /^([a-z]+)[\-\/]([0-9]{1,2})[\-\/]?([0-9]{4})?$/i, parse: function parse(s, arr) { - var month = months$1[arr[1].toLowerCase()]; + var month = months[arr[1].toLowerCase()]; var year = parseYear(arr[3], s._today); var obj = { year: year, @@ -1785,7 +1805,7 @@ { reg: /^([a-z]+) ([0-9]{1,2}(?:st|nd|rd|th)?),?( [0-9]{4})?( ([0-9:]+( ?am| ?pm| ?gmt)?))?$/i, parse: function parse(s, arr) { - var month = months$1[arr[1].toLowerCase()]; + var month = months[arr[1].toLowerCase()]; var year = parseYear(arr[3], s._today); var obj = { year: year, @@ -1806,7 +1826,7 @@ { reg: /^([a-z]+) ([0-9]{4})$/i, parse: function parse(s, arr) { - var month = months$1[arr[1].toLowerCase()]; + var month = months[arr[1].toLowerCase()]; var year = parseYear(arr[2], s._today); var obj = { year: year, @@ -1827,7 +1847,7 @@ { reg: /^([0-9]{1,2}(?:st|nd|rd|th)?) ([a-z]+),?( [0-9]{4})?,? ?([0-9]{1,2}:[0-9]{2}:?[0-9]{0,2}? ?(am|pm|gmt))?$/i, parse: function parse(s, arr) { - var month = months$1[arr[2].toLowerCase()]; + var month = months[arr[2].toLowerCase()]; if (!month) { return null; @@ -2179,7 +2199,16 @@ longDays = i18n["long"] || longDays; }, aliases: { + mo: 1, + tu: 2, + we: 3, + th: 4, + fr: 5, + sa: 6, + su: 7, tues: 2, + weds: 3, + wedn: 3, thur: 4, thurs: 4 } @@ -2239,7 +2268,7 @@ return applyCaseFormat(s.monthName()); }, 'month-short': function monthShort(s) { - return applyCaseFormat(months["short"]()[s.month()]); + return applyCaseFormat(months$1["short"]()[s.month()]); }, 'month-number': function monthNumber(s) { return s.month(); @@ -2380,16 +2409,16 @@ }, //i made these up nice: function nice(s) { - return "".concat(months["short"]()[s.month()], " ").concat(fns.ordinal(s.date()), ", ").concat(s.time()); + return "".concat(months$1["short"]()[s.month()], " ").concat(fns.ordinal(s.date()), ", ").concat(s.time()); }, 'nice-24': function nice24(s) { - return "".concat(months["short"]()[s.month()], " ").concat(fns.ordinal(s.date()), ", ").concat(s.hour24(), ":").concat(fns.zeroPad(s.minute())); + return "".concat(months$1["short"]()[s.month()], " ").concat(fns.ordinal(s.date()), ", ").concat(s.hour24(), ":").concat(fns.zeroPad(s.minute())); }, 'nice-year': function niceYear(s) { - return "".concat(months["short"]()[s.month()], " ").concat(fns.ordinal(s.date()), ", ").concat(s.year()); + return "".concat(months$1["short"]()[s.month()], " ").concat(fns.ordinal(s.date()), ", ").concat(s.year()); }, 'nice-day': function niceDay(s) { - return "".concat(days["short"]()[s.day()], " ").concat(applyCaseFormat(months["short"]()[s.month()]), " ").concat(fns.ordinal(s.date())); + return "".concat(days["short"]()[s.day()], " ").concat(applyCaseFormat(months$1["short"]()[s.month()]), " ").concat(fns.ordinal(s.date())); }, 'nice-full': function niceFull(s) { return "".concat(s.dayName(), " ").concat(applyCaseFormat(s.monthName()), " ").concat(fns.ordinal(s.date()), ", ").concat(s.time()); @@ -2762,7 +2791,7 @@ }; var unixFmt_1 = unixFmt; - var units$1 = ['year', 'season', 'quarter', 'month', 'week', 'day', 'quarterHour', 'hour', 'minute']; + var units$2 = ['year', 'season', 'quarter', 'month', 'week', 'day', 'quarterHour', 'hour', 'minute']; var doUnit = function doUnit(s, k) { var start = s.clone().startOf(k); @@ -2780,7 +2809,7 @@ } var obj = {}; - units$1.forEach(function (k) { + units$2.forEach(function (k) { obj[k] = doUnit(s, k); }); return obj; @@ -2860,7 +2889,7 @@ // ... then ms-math for any very-small units - var diff = function diff(a, b) { + var diff$1 = function diff(a, b) { // an hour is always the same # of milliseconds // so these units can be 'pre-calculated' var msDiff = b.epoch - a.epoch; @@ -2890,7 +2919,7 @@ return obj; }; - var waterfall = diff; + var waterfall = diff$1; var reverseDiff = function reverseDiff(obj) { Object.keys(obj).forEach(function (k) { @@ -2902,7 +2931,7 @@ // '1 year' means 366 days in a leap year - var main = function main(a, b, unit) { + var main$1 = function main(a, b, unit) { b = fns.beADate(b, a); //reverse values, if necessary var reversed = false; @@ -2940,7 +2969,7 @@ return obj; }; - var diff$1 = main; //our conceptual 'break-points' for each unit + var diff = main$1; //our conceptual 'break-points' for each unit var qualifiers = { months: { @@ -3103,7 +3132,7 @@ [6, 1], //july 1 [9, 1] //oct 1 ]; - var units$2 = { + var units$1 = { minute: function minute(s) { walk_1(s, { second: 0, @@ -3248,19 +3277,19 @@ return s; } }; - units$2.date = units$2.day; + units$1.date = units$1.day; var startOf = function startOf(a, unit) { var s = a.clone(); unit = fns.normalize(unit); - if (units$2[unit]) { - return units$2[unit](s); + if (units$1[unit]) { + return units$1[unit](s); } if (unit === 'summer' || unit === 'winter') { s = s.season(unit); - return units$2.season(s); + return units$1.season(s); } return s; @@ -3271,9 +3300,9 @@ var s = a.clone(); unit = fns.normalize(unit); - if (units$2[unit]) { + if (units$1[unit]) { // go to beginning, go to next one, step back 1ms - s = units$2[unit](s); // startof + s = units$1[unit](s); // startof s = s.add(1, unit); s = s.subtract(1, 'millisecond'); @@ -3437,9 +3466,9 @@ }; var timezone_1 = timezone; - var units$3 = ['century', 'decade', 'year', 'month', 'date', 'day', 'hour', 'minute', 'second', 'millisecond']; //the spacetime instance methods (also, the API) + var units = ['century', 'decade', 'year', 'month', 'date', 'day', 'hour', 'minute', 'second', 'millisecond']; //the spacetime instance methods (also, the API) - var methods = { + var methods$4 = { set: function set(input$1, tz) { var s = this.clone(); s = input(s, input$1, null); @@ -3487,8 +3516,8 @@ nearest: function nearest(unit) { return nearest_1(this, unit); }, - diff: function diff(d, unit) { - return diff$1(this, d, unit); + diff: function diff$1(d, unit) { + return diff(this, d, unit); }, since: function since(d) { if (!d) { @@ -3523,6 +3552,13 @@ }, //get each week/month/day between a -> b every: function every(unit, to) { + // allow swapping these params: + if (_typeof(unit) === 'object' && typeof to === 'string') { + var tmp = to; + to = unit; + unit = tmp; + } + return every_1(this, unit, to); }, isAwake: function isAwake() { @@ -3551,7 +3587,7 @@ json: function json() { var _this = this; - return units$3.reduce(function (h, unit) { + return units.reduce(function (h, unit) { h[unit] = _this[unit](); return h; }, {}); @@ -3601,10 +3637,10 @@ } }; // aliases - methods.inDST = methods.isDST; - methods.round = methods.nearest; - methods.each = methods.every; - var methods_1 = methods; //these methods wrap around them. + methods$4.inDST = methods$4.isDST; + methods$4.round = methods$4.nearest; + methods$4.each = methods$4.every; + var methods_1 = methods$4; //these methods wrap around them. var isLeapYear$1 = fns.isLeapYear; @@ -3617,11 +3653,11 @@ return n; }; - var order = ['year', 'month', 'date', 'hour', 'minute', 'second', 'millisecond']; //reduce hostile micro-changes when moving dates by millisecond + var order$1 = ['year', 'month', 'date', 'hour', 'minute', 'second', 'millisecond']; //reduce hostile micro-changes when moving dates by millisecond var confirm = function confirm(s, tmp, unit) { - var n = order.indexOf(unit); - var arr = order.slice(n, order.length); + var n = order$1.indexOf(unit); + var arr = order$1.slice(n, order$1.length); for (var i = 0; i < arr.length; i++) { var want = tmp[arr[i]](); @@ -3773,7 +3809,7 @@ //this one's tricky month: function month(s, n) { if (typeof n === 'string') { - n = months.mapping()[n.toLowerCase()]; + n = months$1.mapping()[n.toLowerCase()]; } n = validate(n); //don't go past december @@ -3837,7 +3873,7 @@ return s.epoch; } }; - var methods$1 = { + var methods$3 = { millisecond: function millisecond(num) { if (num !== undefined) { var s = this.clone(); @@ -4032,7 +4068,7 @@ return this.format('iso'); } }; - var _01Time = methods$1; + var _01Time = methods$3; var methods$2 = { // # day in the month date: function date(num) { @@ -4109,7 +4145,7 @@ return s; }; - var methods$3 = { + var methods$1 = { // day 0-366 dayOfYear: function dayOfYear(num) { if (num !== undefined) { @@ -4191,7 +4227,7 @@ tmp.epoch += milliseconds.week * skipWeeks; i += skipWeeks; - for (; i < 52; i++) { + for (; i <= 52; i++) { if (tmp.epoch > thisOne) { return i + toAdd; } @@ -4204,7 +4240,7 @@ //'january' monthName: function monthName(input) { if (input === undefined) { - return months["long"]()[this.month()]; + return months$1["long"]()[this.month()]; } var s = this.clone(); @@ -4422,30 +4458,30 @@ return num; } }; - var _03Year = methods$3; - var methods$4 = Object.assign({}, _01Time, _02Date, _03Year); //aliases - - methods$4.milliseconds = methods$4.millisecond; - methods$4.seconds = methods$4.second; - methods$4.minutes = methods$4.minute; - methods$4.hours = methods$4.hour; - methods$4.hour24 = methods$4.hour; - methods$4.h12 = methods$4.hour12; - methods$4.h24 = methods$4.hour24; - methods$4.days = methods$4.day; - - var addMethods = function addMethods(Space) { + var _03Year = methods$1; + var methods = Object.assign({}, _01Time, _02Date, _03Year); //aliases + + methods.milliseconds = methods.millisecond; + methods.seconds = methods.second; + methods.minutes = methods.minute; + methods.hours = methods.hour; + methods.hour24 = methods.hour; + methods.h12 = methods.hour12; + methods.h24 = methods.hour24; + methods.days = methods.day; + + var addMethods$4 = function addMethods(Space) { //hook the methods into prototype - Object.keys(methods$4).forEach(function (k) { - Space.prototype[k] = methods$4[k]; + Object.keys(methods).forEach(function (k) { + Space.prototype[k] = methods[k]; }); }; - var query = addMethods; - var isLeapYear$2 = fns.isLeapYear; + var query = addMethods$4; + var isLeapYear = fns.isLeapYear; var getMonthLength = function getMonthLength(month, year) { - if (month === 1 && isLeapYear$2(year)) { + if (month === 1 && isLeapYear(year)) { return 29; } @@ -4532,19 +4568,19 @@ // we 'model' the calendar here only a little bit // and that usually works-out... - var order$1 = ['millisecond', 'second', 'minute', 'hour', 'date', 'month']; + var order = ['millisecond', 'second', 'minute', 'hour', 'date', 'month']; var keep = { - second: order$1.slice(0, 1), - minute: order$1.slice(0, 2), - quarterhour: order$1.slice(0, 2), - hour: order$1.slice(0, 3), - date: order$1.slice(0, 4), - month: order$1.slice(0, 4), - quarter: order$1.slice(0, 4), - season: order$1.slice(0, 4), - year: order$1, - decade: order$1, - century: order$1 + second: order.slice(0, 1), + minute: order.slice(0, 2), + quarterhour: order.slice(0, 2), + hour: order.slice(0, 3), + date: order.slice(0, 4), + month: order.slice(0, 4), + quarter: order.slice(0, 4), + season: order.slice(0, 4), + year: order, + decade: order, + century: order }; keep.week = keep.hour; keep.season = keep.date; @@ -4565,7 +4601,7 @@ year: true }; - var addMethods$1 = function addMethods(SpaceTime) { + var addMethods$3 = function addMethods(SpaceTime) { SpaceTime.prototype.add = function (num, unit) { var s = this.clone(); @@ -4705,7 +4741,7 @@ SpaceTime.prototype.plus = SpaceTime.prototype.add; }; - var add = addMethods$1; //make a string, for easy comparison between dates + var add = addMethods$3; //make a string, for easy comparison between dates var print = { millisecond: function millisecond(s) { @@ -4745,6 +4781,13 @@ if (!unit) { return null; + } // support swapped params + + + if (typeof b === 'string' && _typeof(unit) === 'object') { + var tmp = b; + b = unit; + unit = tmp; } if (typeof b === 'string' || typeof b === 'number') { @@ -4769,7 +4812,7 @@ var same = addMethods$2; - var addMethods$3 = function addMethods(SpaceTime) { + var addMethods$1 = function addMethods(SpaceTime) { var methods = { isAfter: function isAfter(d) { d = fns.beADate(d, this); @@ -4830,9 +4873,9 @@ }); }; - var compare = addMethods$3; + var compare = addMethods$1; - var addMethods$4 = function addMethods(SpaceTime) { + var addMethods = function addMethods(SpaceTime) { var methods = { i18n: function i18n(data) { //change the day names @@ -4842,7 +4885,7 @@ if (fns.isObject(data.months)) { - months.set(data.months); + months$1.set(data.months); } // change the the display style of the month / day names @@ -4857,7 +4900,7 @@ }); }; - var i18n = addMethods$4; + var i18n = addMethods; var timezones = unpack; //fake timezone-support, for fakers (es5 class) var SpaceTime = function SpaceTime(input$1, tz) { @@ -4983,9 +5026,9 @@ }; var whereIts_1 = whereIts; - var _version = '6.12.5'; + var _version = '6.13.0'; - var main$1 = function main(input, tz, options) { + var main = function main(input, tz, options) { return new spacetime(input, tz, options); }; // set all properties of a given 'today' object @@ -4999,48 +5042,48 @@ }; //some helper functions on the main method - main$1.now = function (tz, options) { + main.now = function (tz, options) { var s = new spacetime(new Date().getTime(), tz, options); s = setToday(s); return s; }; - main$1.today = function (tz, options) { + main.today = function (tz, options) { var s = new spacetime(new Date().getTime(), tz, options); s = setToday(s); return s.startOf('day'); }; - main$1.tomorrow = function (tz, options) { + main.tomorrow = function (tz, options) { var s = new spacetime(new Date().getTime(), tz, options); s = setToday(s); return s.add(1, 'day').startOf('day'); }; - main$1.yesterday = function (tz, options) { + main.yesterday = function (tz, options) { var s = new spacetime(new Date().getTime(), tz, options); s = setToday(s); return s.subtract(1, 'day').startOf('day'); }; - main$1.extend = function (obj) { + main.extend = function (obj) { Object.keys(obj).forEach(function (k) { spacetime.prototype[k] = obj[k]; }); return this; }; - main$1.timezones = function () { + main.timezones = function () { var s = new spacetime(); return s.timezones; }; //find tz by time - main$1.whereIts = whereIts_1; - main$1.version = _version; //aliases: + main.whereIts = whereIts_1; + main.version = _version; //aliases: - main$1.plugin = main$1.extend; - var src = main$1; + main.plugin = main.extend; + var src = main; return src; }); }); @@ -5309,7 +5352,11 @@ 'isra and miraj', 'lailat al-qadr', 'eid al-fitr', 'id al-Fitr', 'eid ul-Fitr', 'ramadan', 'eid al-adha', 'muharram', 'the prophets birthday', 'ostara', 'march equinox', 'vernal equinox', 'litha', 'june solistice', 'summer solistice', 'mabon', 'september equinox', 'fall equinox', 'autumnal equinox', 'yule', 'december solstice', 'winter solstice', // Additional important holidays 'chinese new year', 'diwali']; - var times$1 = ['noon', 'midnight', 'now', 'morning', 'tonight', 'evening', 'afternoon', 'night', 'breakfast time', 'lunchtime', 'dinnertime', 'sometime', 'midday', 'eod', 'oclock', 'oclock', 'all day', 'at night']; + var times$1 = ['noon', 'midnight', 'morning', 'tonight', 'evening', 'afternoon', 'breakfast time', 'lunchtime', 'dinnertime', 'midday', 'eod', 'oclock', 'oclock', 'at night' // 'now', + // 'night', + // 'sometime', + // 'all day', + ]; var data = [[dates, '#Date'], [durations$1, '#Duration'], [holidays, '#Holiday'], [times$1, '#Time'], [Object.keys(_timezones), '#Timezone']]; var lex = { @@ -5417,7 +5464,8 @@ return this.next(); } - if (rel === 'last') { + if (rel === 'last' || rel === 'this-past') { + // special 'this past' logic is handled in WeekDay return this.last(); } @@ -5643,6 +5691,51 @@ value: function last() { this.d = this.d.minus(7, 'days'); this.d = this.d.day(this.weekDay); + return this; + } // the millescond before + + }, { + key: "before", + value: function before() { + this.d = this.d.minus(1, 'day'); + this.d = this.d.endOf('day'); + + if (this.context.dayEnd) { + this.d = this.d.time(this.context.dayEnd); + } + + return this; + } + }, { + key: "applyRel", + value: function applyRel(rel) { + if (rel === 'next') { + var tooFar = this.context.today.endOf('week').add(1, 'week'); + this.next(); // did we go too-far? + + if (this.d.isAfter(tooFar)) { + this.last(); // go back + } + + return this; + } // the closest-one backwards + + + if (rel === 'this-past') { + return this.last(); + } + + if (rel === 'last') { + var start = this.context.today.startOf('week'); + this.last(); // are we still in 'this week' though? + + if (this.d.isBefore(start) === false) { + this.last(); // do it again + } + + return this; + } + return this; } }]); @@ -6376,46 +6469,44 @@ // interpret 'this halloween' or 'next june' var parseRelative = function parseRelative(doc) { - // avoid parsing 'last month of 2019' - // if (doc.has('^(this|current|next|upcoming|last|previous) #Duration')) { - // return null - // } - // parse 'this evening' - // let m = doc.match('^(next|last|this)$') - // if (m.found) { - // doc.remove(m) - // return doc.text('reduced') - // } - // but avoid parsing 'day after next' + // avoid parsing 'day after next' if (doc.has('(next|last|this)$')) { return null; - } + } // next monday + - var rel = null; var m = doc.match('^this? (next|upcoming|coming)'); if (m.found) { - rel = 'next'; doc.remove(m); - } + return 'next'; + } // 'this past monday' is not-always 'last monday' + + + m = doc.match('^this? (past)'); + + if (m.found) { + doc.remove(m); + return 'this-past'; + } // last monday + m = doc.match('^this? (last|previous)'); if (m.found) { - rel = 'last'; doc.remove(m); - } + return 'last'; + } // this monday + m = doc.match('^(this|current)'); if (m.found) { - rel = 'this'; doc.remove(m); - } // finally, remove it from our text - // doc.remove('^(this|current|next|upcoming|last|previous)') - + return 'this'; + } - return rel; + return null; }; var _04Relative = parseRelative; @@ -6532,7 +6623,7 @@ if (day.found && !doc.has('^#WeekDay$')) { // handle relative-day logic elsewhere. - if (doc.has('(this|next|last) (next|upcoming|coming)? #WeekDay')) { + if (doc.has('(this|next|last) (next|upcoming|coming|past)? #WeekDay')) { return null; } @@ -7545,7 +7636,17 @@ unit = unit || parse$3.yearly(doc, context); // 'this june 2nd' - unit = unit || parse$3.explicit(doc, context); + unit = unit || parse$3.explicit(doc, context); // debugging + // console.log('\n\n=-=-=-=-=-=-=-=-=-=-=-=Date-=-=-=-=-=-=-=-=-=-=-=-=-\n') + // console.log(` shift: ${JSON.stringify(shift)}`) + // console.log(` counter: `, counter) + // console.log(` rel: ${rel || '-'}`) + // console.log(` section: ${section || '-'}`) + // console.log(` time: ${time || '-'}`) + // console.log(` str: '${doc.text()}'`) + // console.log(' unit: ', unit, '\n') + // doc.debug() + // console.log('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n') if (!unit) { return null; @@ -7583,18 +7684,7 @@ if (counter && counter.unit) { unit = transform.counter(unit, counter); - } // debugging - // console.log('\n\n=-=-=-=-=-=-=-=-=-=-=-=Date-=-=-=-=-=-=-=-=-=-=-=-=-\n') - // console.log(` shift: ${JSON.stringify(shift)}`) - // console.log(` counter: `, counter) - // console.log(` rel: ${rel || '-'}`) - // console.log(` section: ${section || '-'}`) - // console.log(` time: ${time || '-'}`) - // console.log(` str: '${doc.text()}'`) - // console.log(' unit: ', unit, '\n') - // doc.debug() - // console.log('=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n') - + } return unit; }; @@ -7753,11 +7843,12 @@ start = parse_1$2(start, context); var end = m.groups('end'); end = parse_1$2(end, context); + end = end.before(); if (start && end) { return { start: start, - end: end.before() + end: end }; } @@ -8653,19 +8744,43 @@ } // 'tuesday, wednesday' - m = dates.match('^[#WeekDay] #WeekDay$', 0); + m = dates.match('^[#WeekDay] and? #WeekDay$', 0); + + if (m.found) { + if (m.first().has('@hasDash') === false) { + dates = dates.splitAfter(m); + dates = dates.not('^and'); + } + } // 'june, august' + + + m = dates.match('^[#Month] and? #Month #Ordinal?$', 0); if (m.found) { dates = dates.splitAfter(m); - dates = dates.not('^(and|or)'); + dates = dates.not('^and'); } // 'tuesday, wednesday, and friday' - m = dates.match('#WeekDay #WeekDay and #WeekDay'); + m = dates.match('#WeekDay #WeekDay and? #WeekDay'); if (m.found) { dates = dates.splitOn('#WeekDay'); - dates = dates.not('^(and|or)'); + dates = dates.not('^and'); + } // 'june 5th, june 10th' + + + m = dates.match('[#Month #Value] #Month', 0); + + if (m.found) { + dates = dates.splitAfter(m); + } // '20 minutes june 5th' + + + m = dates.match('[#Cardinal #Duration] #Date', 0); //but allow '20 minutes ago' + + if (m.found && !dates.has('#Cardinal #Duration] (ago|from|before|after|back)')) { + dates = dates.not(m); } // for 20 minutes diff --git a/plugins/dates/builds/compromise-dates.js.map b/plugins/dates/builds/compromise-dates.js.map index 1252b540a..d49a672dd 100644 --- a/plugins/dates/builds/compromise-dates.js.map +++ b/plugins/dates/builds/compromise-dates.js.map @@ -1 +1 @@ -{"version":3,"file":"compromise-dates.js","sources":["../src/01-tagger/00-basic.js","../src/01-tagger/01-values.js","../src/01-tagger/02-dates.js","../src/01-tagger/03-sections.js","../src/01-tagger/04-time.js","../src/01-tagger/05-shifts.js","../src/01-tagger/06-intervals.js","../src/01-tagger/07-fixup.js","../src/01-tagger/index.js","../src/data/_tags.js","../node_modules/spacetime/builds/spacetime.js","../src/data/_timezones.js","../src/data/words/dates.js","../src/data/words/durations.js","../src/data/words/holidays.js","../src/data/words/times.js","../src/data/words/index.js","../src/parseDate/units/Unit.js","../src/parseDate/units/_day.js","../src/parseDate/units/_year.js","../src/parseDate/units/_week.js","../src/parseDate/units/_time.js","../src/parseDate/units/index.js","../src/parseDate/01-tokenize/01-shift.js","../src/parseDate/01-tokenize/02-counter.js","../src/parseDate/01-tokenize/03-time.js","../src/parseDate/01-tokenize/04-relative.js","../src/parseDate/01-tokenize/05-section.js","../src/parseDate/01-tokenize/06-timezone.js","../src/parseDate/01-tokenize/07-weekday.js","../src/parseDate/02-parse/01-today.js","../node_modules/spacetime-holiday/builds/spacetime-holiday.js","../src/parseDate/02-parse/02-holidays.js","../src/parseDate/02-parse/03-next-last.js","../src/parseDate/02-parse/04-yearly.js","../src/parseDate/02-parse/05-explicit.js","../src/parseDate/03-transform/addCounter.js","../src/parseDate/parse.js","../src/02-ranges/intervals.js","../src/02-ranges/ranges.js","../src/02-ranges/index.js","../src/normalize.js","../src/generate.js","../src/parse.js","../src/data/_abbrevs.js","../src/methods.js","../src/durations/parse.js","../src/durations/index.js","../src/times/parse.js","../src/times/index.js","../src/find.js","../src/index.js"],"sourcesContent":["//ambiguous 'may' and 'march'\nconst preps = '(in|by|before|during|on|until|after|of|within|all)' //6\nconst thisNext = '(last|next|this|previous|current|upcoming|coming)' //2\nconst sections = '(start|end|middle|starting|ending|midpoint|beginning)' //2\nconst seasons = '(spring|summer|winter|fall|autumn)'\n\n//ensure a year is approximately typical for common years\n//please change in one thousand years\nconst tagYear = (m, reason) => {\n if (m.found !== true) {\n return\n }\n m.forEach((p) => {\n let str = p.text('reduced')\n let num = parseInt(str, 10)\n if (num && num > 1000 && num < 3000) {\n p.tag('Year', reason)\n }\n })\n}\n//same, but for less-confident values\nconst tagYearSafe = (m, reason) => {\n if (m.found !== true) {\n return\n }\n m.forEach((p) => {\n let str = p.text('reduced')\n let num = parseInt(str, 10)\n if (num && num > 1900 && num < 2030) {\n p.tag('Year', reason)\n }\n })\n}\n\nconst tagDates = function (doc) {\n // in the evening\n doc.match('in the (night|evening|morning|afternoon|day|daytime)').tag('Time', 'in-the-night')\n // 8 pm\n doc.match('(#Value|#Time) (am|pm)').tag('Time', 'value-ampm')\n // 22-aug\n // doc.match('/^[0-9]{2}-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov)/').tag('Date', '20-jan')\n // 2012-06\n doc.match('/^[0-9]{4}-[0-9]{2}$/').tag('Date', '2012-06')\n\n // misc weekday words\n doc.match('(tue|thu)').tag('WeekDay', 'misc-weekday')\n\n //months:\n let month = doc.if('#Month')\n if (month.found === true) {\n //June 5-7th\n month.match(`#Month #Date+`).tag('Date', 'correction-numberRange')\n //5th of March\n month.match('#Value of #Month').tag('Date', 'value-of-month')\n //5 March\n month.match('#Cardinal #Month').tag('Date', 'cardinal-month')\n //march 5 to 7\n month.match('#Month #Value to #Value').tag('Date', 'value-to-value')\n //march the 12th\n month.match('#Month the #Value').tag('Date', 'month-the-value')\n }\n\n //months:\n let val = doc.if('#Value')\n if (val.found === true) {\n //june 7\n val.match('(#WeekDay|#Month) #Value').ifNo('#Money').tag('Date', 'date-value')\n\n //7 june\n val.match('#Value (#WeekDay|#Month)').ifNo('#Money').tag('Date', 'value-date')\n\n //may twenty five\n val.match('#TextValue #TextValue').if('#Date').tag('#Date', 'textvalue-date')\n\n //two thursdays back\n val.match('#Value (#WeekDay|#Duration) back').tag('#Date', '3-back')\n\n //eg 'year'\n let duration = val.if('#Duration')\n if (duration.found === true) {\n //for 4 months\n duration.match('for #Value #Duration').tag('Date', 'for-x-duration')\n //two days before\n duration.match('#Value #Duration #Conjunction').tag('Date', 'val-duration-conjunction')\n //for four days\n duration.match(`${preps}? #Value #Duration`).tag('Date', 'value-duration')\n //two years old\n duration.match('#Value #Duration old').unTag('Date', 'val-years-old')\n }\n }\n\n //seasons\n let season = doc.if(seasons)\n if (season.found === true) {\n season.match(`${preps}? ${thisNext} ${seasons}`).tag('Date', 'thisNext-season')\n season.match(`the? ${sections} of ${seasons}`).tag('Date', 'section-season')\n season.match(`${seasons} ${preps}? #Cardinal`).tag('Date', 'season-year')\n }\n\n //rest-dates\n let date = doc.if('#Date')\n if (date.found === true) {\n //june the 5th\n date.match('#Date the? #Ordinal').tag('Date', 'correction')\n //last month\n date.match(`${thisNext} #Date`).tag('Date', 'thisNext')\n //by 5 March\n date.match('due? (by|before|after|until) #Date').tag('Date', 'by')\n //next feb\n date.match('(last|next|this|previous|current|upcoming|coming|the) #Date').tag('Date', 'next-feb')\n //start of june\n date.match(`the? ${sections} of #Date`).tag('Date', 'section-of')\n //fifth week in 1998\n date.match('#Ordinal #Duration in #Date').tag('Date', 'duration-in')\n //early in june\n date.match('(early|late) (at|in)? the? #Date').tag('Time', 'early-evening')\n //tomorrow before 3\n date.match('#Date (by|before|after|at|@|about) #Cardinal').not('^#Date').tag('Time', 'date-before-Cardinal')\n //saturday am\n date.match('#Date [(am|pm)]', 0).unTag('Verb').unTag('Copula').tag('Time', 'date-am')\n //feb to june\n date.match('#Date (#Preposition|to) #Date').ifNo('#Duration').tag('Date', 'date-prep-date')\n //2nd quarter of 2019\n // date.match('#Date of #Date').tag('Date', 'date-of-date')\n }\n\n //year/cardinal tagging\n let cardinal = doc.if('#Cardinal')\n if (cardinal.found === true) {\n let v = cardinal.match(`#Date #Value [#Cardinal]`, 0)\n tagYear(v, 'date-value-year')\n //scoops up a bunch\n v = cardinal.match(`#Date [#Cardinal]`, 0)\n tagYearSafe(v, 'date-year')\n //middle of 1999\n v = cardinal.match(`${sections} of [#Cardinal]`)\n tagYearSafe(v, 'section-year')\n //feb 8 2018\n v = cardinal.match(`#Month #Value [#Cardinal]`, 0)\n tagYear(v, 'month-value-year')\n //feb 8 to 10th 2018\n v = cardinal.match(`#Month #Value to #Value [#Cardinal]`, 0)\n tagYear(v, 'month-range-year')\n //in 1998\n v = cardinal.match(`(in|of|by|during|before|starting|ending|for|year|since) [#Cardinal]`, 0)\n tagYear(v, 'in-year-1')\n //q2 2009\n v = cardinal.match('(q1|q2|q3|q4) [#Cardinal]', 0)\n tagYear(v, 'in-year-2')\n //2nd quarter 2009\n v = cardinal.match('#Ordinal quarter of? [#Cardinal]', 0)\n tagYear(v, 'in-year-3')\n //in the year 1998\n v = cardinal.match('the year [#Cardinal]', 0)\n tagYear(v, 'in-year-4')\n //it was 1998\n v = cardinal.match('it (is|was) [#Cardinal]', 0)\n tagYearSafe(v, 'in-year-5')\n // re-tag this part\n cardinal.match(`${sections} of #Year`).tag('Date')\n //between 1999 and 1998\n let m = cardinal.match('between [#Cardinal] and [#Cardinal]')\n tagYear(m.groups('0'), 'between-year-and-year-1')\n tagYear(m.groups('1'), 'between-year-and-year-2')\n }\n\n let time = doc.if('#Time')\n if (time.found === true) {\n //by 6pm\n time.match('(by|before|after|at|@|about) #Time').tag('Time', 'preposition-time')\n //7 7pm\n // time.match('#Cardinal #Time').not('#Year').tag('Time', 'value-time')\n //2pm est\n time.match('#Time [(eastern|pacific|central|mountain)]', 0).tag('Date', 'timezone')\n //6pm est\n time.match('#Time [(est|pst|gmt)]', 0).tag('Date', 'timezone abbr')\n }\n //'2020' bare input\n let m = doc.match('^/^20[012][0-9]$/$')\n tagYearSafe(m, '2020-ish')\n\n // in 20mins\n doc.match('(in|after) /^[0-9]+(min|sec|wk)s?/').tag('Date', 'shift-units')\n return doc\n}\nmodule.exports = tagDates\n","const here = 'date-values'\n//\nconst values = function (doc) {\n // a year ago\n if (!doc.has('once [a] #Duration')) {\n doc.match('[a] #Duration', 0).replaceWith('1').tag('Cardinal', here)\n }\n if (doc.has('#Value')) {\n //june 5 to 7th\n doc.match('#Month #Value to #Value of? #Year?').tag('Date', here)\n //5 to 7th june\n doc.match('#Value to #Value of? #Month #Year?').tag('Date', here)\n //third week of may\n doc.match('#Value #Duration of #Date').tag('Date', here)\n //two days after\n doc.match('#Value+ #Duration (after|before|into|later|afterwards|ago)?').tag('Date', here)\n //two days\n doc.match('#Value #Date').tag('Date', here)\n //june 5th\n doc.match('#Date #Value').tag('Date', here)\n //tuesday at 5\n doc.match('#Date #Preposition #Value').tag('Date', here)\n //tomorrow before 3\n doc.match('#Date (after|before|during|on|in) #Value').tag('Date', here)\n //a year and a half\n doc.match('#Value (year|month|week|day) and a half').tag('Date', here)\n //5 and a half years\n doc.match('#Value and a half (years|months|weeks|days)').tag('Date', here)\n //on the fifth\n doc.match('on the #Ordinal').tag('Date', here)\n }\n return doc\n}\nmodule.exports = values\n","const here = 'date-tagger'\n//\nconst dateTagger = function (doc) {\n doc.match('(spring|summer|winter|fall|autumn|springtime|wintertime|summertime)').match('#Noun').tag('Season', here)\n doc.match('(q1|q2|q3|q4)').tag('FinancialQuarter', here)\n doc.match('(this|next|last|current) quarter').tag('FinancialQuarter', here)\n doc.match('(this|next|last|current) season').tag('Season', here)\n\n if (doc.has('#Date')) {\n //friday to sunday\n doc.match('#Date #Preposition #Date').tag('Date', here)\n //once a day..\n doc.match('(once|twice) (a|an|each) #Date').tag('Date', here)\n //TODO:fixme\n doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', here)\n //tuesday\n doc.match('#Date+').tag('Date', here)\n //by June\n doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', here)\n //a year after..\n doc.match('a #Duration').tag('Date', here)\n //between x and y\n doc.match('(between|from) #Date').tag('Date', here)\n doc.match('(to|until|upto) #Date').tag('Date', here)\n doc.match('#Date and #Date').tag('Date', here)\n //during this june\n doc.match('(by|until|after|before|during|on|in|following|since) (next|this|last)? (#Date|#Date)').tag('Date', here)\n //day after next\n doc.match('the? #Date after next one?').tag('Date', here)\n //approximately...\n doc.match('(about|approx|approximately|around) #Date').tag('Date', here)\n }\n return doc\n}\nmodule.exports = dateTagger\n","const here = 'section-tagger'\n//\nconst sectionTagger = function (doc) {\n if (doc.has('#Date')) {\n // //next september\n doc.match('this? (last|next|past|this|previous|current|upcoming|coming|the) #Date').tag('Date', here)\n //starting this june\n doc.match('(starting|beginning|ending) #Date').tag('Date', here)\n //start of june\n doc.match('the? (start|end|middle|beginning) of (last|next|this|the) (#Date|#Date)').tag('Date', here)\n //this coming june\n doc.match('(the|this) #Date').tag('Date', here)\n //january up to june\n doc.match('#Date up to #Date').tag('Date', here)\n }\n return doc\n}\nmodule.exports = sectionTagger\n","const here = 'time-tagger'\n\n//\nconst timeTagger = function (doc) {\n // 2 oclock\n doc.match('#Cardinal oclock').tag('Time', here)\n // 13h30\n doc.match('/^[0-9]{2}h[0-9]{2}$/').tag('Time', here)\n // 03/02\n doc.match('/^[0-9]{2}/[0-9]{2}/').tag('Date', here).unTag('Value')\n // 3 in the morning\n doc.match('[#Value] (in|at) the? (morning|evening|night|nighttime)').tag('Time', here)\n if (doc.has('#Cardinal') && !doc.has('#Month')) {\n // quarter to seven (not march 5 to 7)\n doc.match('1? (half|quarter|25|15|10|5) (past|after|to) #Cardinal').tag('Time', here)\n // ten to seven\n doc.match('(5|10|15|20|five|ten|fifteen|20) (to|after|past) [#Cardinal]').tag('Time', here) //add check for 1 to 1 etc.\n }\n //timezone\n if (doc.has('#Date')) {\n // iso (2020-03-02T00:00:00.000Z)\n doc.match('/^[0-9]{4}[:-][0-9]{2}[:-][0-9]{2}T[0-9]/').tag('Time', here)\n // tuesday at 4\n doc.match('#Date [at #Cardinal]', 0).notIf('#Year').tag('Time', here)\n // half an hour\n doc.match('half an (hour|minute|second)').tag('Date', here)\n //eastern daylight time\n doc.match('#Noun (standard|daylight|central|mountain)? time').tag('Timezone', here)\n //utc+5\n doc.match('/^utc[+-][0-9]/').tag('Timezone', here)\n doc.match('/^gmt[+-][0-9]/').tag('Timezone', here)\n\n doc.match('(in|for|by|near|at) #Timezone').tag('Timezone', here)\n // 2pm eastern\n doc.match('#Time [(eastern|mountain|pacific|central)]', 0).tag('Timezone', here)\n }\n // around four thirty\n doc.match('(at|around|near) [#Cardinal (thirty|fifteen) (am|pm)?]', 0).tag('Time', here)\n return doc\n}\nmodule.exports = timeTagger\n","const here = 'shift-tagger'\n//\nconst shiftTagger = function (doc) {\n if (doc.has('#Date')) {\n //'two days before'/ 'nine weeks frow now'\n doc.match('#Cardinal #Duration (before|after|ago|from|hence|back)').tag('DateShift', here)\n // in two weeks\n doc.match('in #Cardinal #Duration').tag('DateShift', here)\n // in a few weeks\n doc.match('in a (few|couple) of? #Duration').tag('DateShift', here)\n //two weeks and three days before\n doc.match('#Cardinal #Duration and? #DateShift').tag('DateShift', here)\n doc.match('#DateShift and #Cardinal #Duration').tag('DateShift', here)\n // 'day after tomorrow'\n doc.match('[#Duration (after|before)] #Date', 0).tag('DateShift', here)\n // in half an hour\n doc.match('in half (a|an) #Duration').tag('DateShift', here)\n }\n return doc\n}\nmodule.exports = shiftTagger\n","const tagIntervals = function (doc) {\n // july 3rd and 4th\n doc.match('#Month #Ordinal and #Ordinal').tag('Date', 'ord-and-ord')\n // every other week\n doc.match('every other #Duration').tag('Date', 'every-other')\n // every weekend\n doc.match('(every|any|each|a) (day|weekday|week day|weekend|weekend day)').tag('Date', 'any-weekday')\n // any-wednesday\n doc.match('(every|any|each|a) (#WeekDay)').tag('Date', 'any-wednesday')\n // any week\n doc.match('(every|any|each|a) (#Duration)').tag('Date', 'any-week')\n}\nmodule.exports = tagIntervals\n","const here = 'fix-tagger'\n//\nconst fixUp = function (doc) {\n //fixups\n if (doc.has('#Date')) {\n //first day by monday\n let oops = doc.match('#Date+ by #Date+')\n if (oops.found && !oops.has('^due')) {\n oops.match('^#Date+').unTag('Date', 'by-monday')\n }\n\n let d = doc.match('#Date+')\n //'spa day'\n d.match('^day$').unTag('Date', 'spa-day')\n // tomorrow's meeting\n d.match('(in|of|by|for)? (#Possessive && #Date)').unTag('Date', 'tomorrows meeting')\n\n let knownDate = '(yesterday|today|tomorrow)'\n if (d.has(knownDate)) {\n //yesterday 7\n d.match(`${knownDate} [#Value]$`).unTag('Date', 'yesterday-7')\n //7 yesterday\n d.match(`^[#Value] ${knownDate}$`, 0).unTag('Date', '7 yesterday')\n //friday yesterday\n d.match(`#WeekDay+ ${knownDate}$`).unTag('Date').lastTerm().tag('Date', 'fri-yesterday')\n\n // yesterday yesterday\n // d.match(`${knownDate}+ ${knownDate}$`)\n // .unTag('Date')\n // .lastTerm()\n // .tag('Date', here)\n d.match(`(this|last|next) #Date ${knownDate}$`).unTag('Date').lastTerm().tag('Date', 'this month yesterday')\n }\n //tomorrow on 5\n d.match(`on #Cardinal$`).unTag('Date', here)\n //this tomorrow\n d.match(`this tomorrow`).terms(0).unTag('Date', 'this-tomorrow')\n //q2 2019\n d.match(`(q1|q2|q3|q4) #Year`).tag('Date', here)\n //5 tuesday\n // d.match(`^#Value #WeekDay`).terms(0).unTag('Date');\n //5 next week\n d.match(`^#Value (this|next|last)`).terms(0).unTag('Date', here)\n\n if (d.has('(last|this|next)')) {\n //this month 7\n d.match(`(last|this|next) #Duration #Value`).terms(2).unTag('Date', here)\n //7 this month\n d.match(`!#Month #Value (last|this|next) #Date`).terms(0).unTag('Date', here)\n }\n //january 5 5\n if (d.has('(#Year|#Time|#TextValue|#NumberRange)') === false) {\n d.match('(#Month|#WeekDay) #Value #Value').terms(2).unTag('Date', here)\n }\n //between june\n if (d.has('^between') && !d.has('and .')) {\n d.unTag('Date', here)\n }\n //june june\n if (d.has('#Month #Month') && !d.has('@hasHyphen') && !d.has('@hasComma')) {\n d.match('#Month').lastTerm().unTag('Date', 'month-month')\n }\n // log the hours\n if (d.has('(minutes|seconds|weeks|hours|days|months)') && !d.has('#Value #Duration')) {\n d.match('(minutes|seconds|weeks|hours|days|months)').unTag('Date', 'log-hours')\n }\n // about thanksgiving\n if (d.has('about #Holiday')) {\n d.match('about').unTag('#Date', 'about-thanksgiving')\n }\n\n // second quarter of 2020\n d.match('#Ordinal quarter of? #Year').unTag('Fraction')\n\n // a month from now\n d.match('(from|by|before) now').unTag('Time')\n // dangling date-chunks\n // if (d.has('!#Date (in|of|by|for) !#Date')) {\n // d.unTag('Date', 'dangling-date')\n // }\n // the day after next\n d.match('#Date+').match('^the').unTag('Date')\n }\n return doc\n}\nmodule.exports = fixUp\n","const methods = [\n require('./00-basic'),\n require('./01-values'),\n require('./02-dates'),\n require('./03-sections'),\n require('./04-time'),\n require('./05-shifts'),\n require('./06-intervals'),\n require('./07-fixup'),\n]\n\n// normalizations to run before tagger\nconst normalize = function (doc) {\n // turn '20mins' into '20 mins'\n doc.numbers().normalize() // this is sorta problematic\n return doc\n}\n\n// run each of the taggers\nconst tagDate = function (doc) {\n doc = normalize(doc)\n // run taggers\n methods.forEach((fn) => fn(doc))\n return doc\n}\nmodule.exports = tagDate\n","module.exports = {\n FinancialQuarter: {\n isA: 'Date',\n notA: 'Fraction',\n },\n // 'summer'\n Season: {\n isA: 'Date',\n },\n // '1982'\n Year: {\n isA: ['Date'],\n notA: 'RomanNumeral',\n },\n // 'months'\n Duration: {\n isA: ['Date', 'Noun'],\n },\n // 'easter'\n Holiday: {\n isA: ['Date', 'Noun'],\n },\n // 'PST'\n Timezone: {\n isA: ['Date', 'Noun'],\n notA: ['Adjective', 'DateShift'],\n },\n // 'two weeks before'\n DateShift: {\n isA: ['Date'],\n notA: ['TimeZone', 'Holiday'],\n },\n}\n","/* spencermountain/spacetime 6.12.5 Apache 2.0 */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.spacetime = factory());\n}(this, (function () { 'use strict';\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var MSEC_IN_HOUR = 60 * 60 * 1000; //convert our local date syntax a javascript UTC date\n\n var toUtc = function toUtc(dstChange, offset, year) {\n var _dstChange$split = dstChange.split('/'),\n _dstChange$split2 = _slicedToArray(_dstChange$split, 2),\n month = _dstChange$split2[0],\n rest = _dstChange$split2[1];\n\n var _rest$split = rest.split(':'),\n _rest$split2 = _slicedToArray(_rest$split, 2),\n day = _rest$split2[0],\n hour = _rest$split2[1];\n\n return Date.UTC(year, month - 1, day, hour) - offset * MSEC_IN_HOUR;\n }; // compare epoch with dst change events (in utc)\n\n\n var inSummerTime = function inSummerTime(epoch, start, end, summerOffset, winterOffset) {\n var year = new Date(epoch).getUTCFullYear();\n var startUtc = toUtc(start, winterOffset, year);\n var endUtc = toUtc(end, summerOffset, year); // simple number comparison now\n\n return epoch >= startUtc && epoch < endUtc;\n };\n\n var summerTime = inSummerTime;\n\n // it reproduces some things in ./index.js, but speeds up spacetime considerably\n\n var quickOffset = function quickOffset(s) {\n var zones = s.timezones;\n var obj = zones[s.tz];\n\n if (obj === undefined) {\n console.warn(\"Warning: couldn't find timezone \" + s.tz);\n return 0;\n }\n\n if (obj.dst === undefined) {\n return obj.offset;\n } //get our two possible offsets\n\n\n var jul = obj.offset;\n var dec = obj.offset + 1; // assume it's the same for now\n\n if (obj.hem === 'n') {\n dec = jul - 1;\n }\n\n var split = obj.dst.split('->');\n var inSummer = summerTime(s.epoch, split[0], split[1], jul, dec);\n\n if (inSummer === true) {\n return jul;\n }\n\n return dec;\n };\n\n var quick = quickOffset;\n\n var _build = {\n \t\"9|s\": \"2/dili,2/jayapura\",\n \t\"9|n\": \"2/chita,2/khandyga,2/pyongyang,2/seoul,2/tokyo,11/palau\",\n \t\"9.5|s|04/04:03->10/03:02\": \"4/adelaide,4/broken_hill,4/south,4/yancowinna\",\n \t\"9.5|s\": \"4/darwin,4/north\",\n \t\"8|s|03/08:01->10/04:00\": \"12/casey\",\n \t\"8|s\": \"2/kuala_lumpur,2/makassar,2/singapore,4/perth,4/west\",\n \t\"8|n|03/25:03->09/29:23\": \"2/ulan_bator\",\n \t\"8|n\": \"2/brunei,2/choibalsan,2/chongqing,2/chungking,2/harbin,2/hong_kong,2/irkutsk,2/kuching,2/macao,2/macau,2/manila,2/shanghai,2/taipei,2/ujung_pandang,2/ulaanbaatar\",\n \t\"8.75|s\": \"4/eucla\",\n \t\"7|s\": \"12/davis,2/jakarta,9/christmas\",\n \t\"7|n\": \"2/bangkok,2/barnaul,2/ho_chi_minh,2/hovd,2/krasnoyarsk,2/novokuznetsk,2/novosibirsk,2/phnom_penh,2/pontianak,2/saigon,2/tomsk,2/vientiane\",\n \t\"6|s\": \"12/vostok\",\n \t\"6|n\": \"2/almaty,2/bishkek,2/dacca,2/dhaka,2/kashgar,2/omsk,2/qyzylorda,2/qostanay,2/thimbu,2/thimphu,2/urumqi,9/chagos\",\n \t\"6.5|n\": \"2/rangoon,2/yangon,9/cocos\",\n \t\"5|s\": \"12/mawson,9/kerguelen\",\n \t\"5|n\": \"2/aqtau,2/aqtobe,2/ashgabat,2/ashkhabad,2/atyrau,2/baku,2/dushanbe,2/karachi,2/oral,2/samarkand,2/tashkent,2/yekaterinburg,9/maldives\",\n \t\"5.75|n\": \"2/kathmandu,2/katmandu\",\n \t\"5.5|n\": \"2/calcutta,2/colombo,2/kolkata\",\n \t\"4|s\": \"9/reunion\",\n \t\"4|n\": \"2/dubai,2/muscat,2/tbilisi,2/yerevan,8/astrakhan,8/samara,8/saratov,8/ulyanovsk,8/volgograd,2/volgograd,9/mahe,9/mauritius\",\n \t\"4.5|n|03/22:00->09/21:24\": \"2/tehran\",\n \t\"4.5|n\": \"2/kabul\",\n \t\"3|s\": \"12/syowa,9/antananarivo\",\n \t\"3|n|03/28:03->10/31:04\": \"2/famagusta,2/nicosia,8/athens,8/bucharest,8/helsinki,8/kiev,8/mariehamn,8/nicosia,8/riga,8/sofia,8/tallinn,8/uzhgorod,8/vilnius,8/zaporozhye\",\n \t\"3|n|03/28:02->10/31:03\": \"8/chisinau,8/tiraspol\",\n \t\"3|n|03/28:00->10/30:24\": \"2/beirut\",\n \t\"3|n|03/27:00->10/30:01\": \"2/gaza,2/hebron\",\n \t\"3|n|03/26:02->10/31:02\": \"2/jerusalem,2/tel_aviv\",\n \t\"3|n|03/26:00->10/29:01\": \"2/amman\",\n \t\"3|n|03/26:00->10/28:24\": \"2/damascus\",\n \t\"3|n\": \"0/addis_ababa,0/asmara,0/asmera,0/dar_es_salaam,0/djibouti,0/juba,0/kampala,0/mogadishu,0/nairobi,2/aden,2/baghdad,2/bahrain,2/istanbul,2/kuwait,2/qatar,2/riyadh,8/istanbul,8/kirov,8/minsk,8/moscow,8/simferopol,9/comoro,9/mayotte\",\n \t\"2|s|03/28:02->10/31:02\": \"12/troll\",\n \t\"2|s\": \"0/gaborone,0/harare,0/johannesburg,0/lubumbashi,0/lusaka,0/maputo,0/maseru,0/mbabane\",\n \t\"2|n|03/28:02->10/31:03\": \"0/ceuta,arctic/longyearbyen,3/jan_mayen,8/amsterdam,8/andorra,8/belgrade,8/berlin,8/bratislava,8/brussels,8/budapest,8/busingen,8/copenhagen,8/gibraltar,8/ljubljana,8/luxembourg,8/madrid,8/malta,8/monaco,8/oslo,8/paris,8/podgorica,8/prague,8/rome,8/san_marino,8/sarajevo,8/skopje,8/stockholm,8/tirane,8/vaduz,8/vatican,8/vienna,8/warsaw,8/zagreb,8/zurich\",\n \t\"2|n\": \"0/blantyre,0/bujumbura,0/cairo,0/khartoum,0/kigali,0/tripoli,8/kaliningrad\",\n \t\"1|s|04/02:01->09/03:03\": \"0/windhoek\",\n \t\"1|s\": \"0/kinshasa,0/luanda\",\n \t\"1|n|04/11:03->05/16:02\": \"0/casablanca,0/el_aaiun\",\n \t\"1|n|03/28:01->10/31:02\": \"3/canary,3/faeroe,3/faroe,3/madeira,8/belfast,8/dublin,8/guernsey,8/isle_of_man,8/jersey,8/lisbon,8/london\",\n \t\"1|n\": \"0/algiers,0/bangui,0/brazzaville,0/douala,0/lagos,0/libreville,0/malabo,0/ndjamena,0/niamey,0/porto-novo,0/tunis\",\n \t\"14|n\": \"11/kiritimati\",\n \t\"13|s|04/04:04->09/26:03\": \"11/apia\",\n \t\"13|s|01/15:02->11/05:03\": \"11/tongatapu\",\n \t\"13|n\": \"11/enderbury,11/fakaofo\",\n \t\"12|s|04/04:03->09/26:02\": \"12/mcmurdo,12/south_pole,11/auckland\",\n \t\"12|s|01/17:03->11/14:02\": \"11/fiji\",\n \t\"12|n\": \"2/anadyr,2/kamchatka,2/srednekolymsk,11/funafuti,11/kwajalein,11/majuro,11/nauru,11/tarawa,11/wake,11/wallis\",\n \t\"12.75|s|04/04:03->04/04:02\": \"11/chatham\",\n \t\"11|s|04/04:03->10/03:02\": \"12/macquarie\",\n \t\"11|s\": \"11/bougainville\",\n \t\"11|n\": \"2/magadan,2/sakhalin,11/efate,11/guadalcanal,11/kosrae,11/noumea,11/pohnpei,11/ponape\",\n \t\"11.5|n|04/04:03->10/03:02\": \"11/norfolk\",\n \t\"10|s|04/04:03->10/03:02\": \"4/act,4/canberra,4/currie,4/hobart,4/melbourne,4/nsw,4/sydney,4/tasmania,4/victoria\",\n \t\"10|s\": \"12/dumontdurville,4/brisbane,4/lindeman,4/queensland\",\n \t\"10|n\": \"2/ust-nera,2/vladivostok,2/yakutsk,11/chuuk,11/guam,11/port_moresby,11/saipan,11/truk,11/yap\",\n \t\"10.5|s|04/04:01->10/03:02\": \"4/lhi,4/lord_howe\",\n \t\"0|n|03/28:00->10/31:01\": \"1/scoresbysund,3/azores\",\n \t\"0|n\": \"0/abidjan,0/accra,0/bamako,0/banjul,0/bissau,0/conakry,0/dakar,0/freetown,0/lome,0/monrovia,0/nouakchott,0/ouagadougou,0/sao_tome,0/timbuktu,1/danmarkshavn,3/reykjavik,3/st_helena,13/gmt,13/gmt+0,13/gmt-0,13/gmt0,13/greenwich,13/utc,13/universal,13/zulu\",\n \t\"-9|n|03/14:02->11/07:02\": \"1/adak,1/atka\",\n \t\"-9|n\": \"11/gambier\",\n \t\"-9.5|n\": \"11/marquesas\",\n \t\"-8|n|03/14:02->11/07:02\": \"1/anchorage,1/juneau,1/metlakatla,1/nome,1/sitka,1/yakutat\",\n \t\"-8|n\": \"11/pitcairn\",\n \t\"-7|n|03/14:02->11/07:02\": \"1/ensenada,1/los_angeles,1/santa_isabel,1/tijuana,1/vancouver,6/pacific,10/bajanorte\",\n \t\"-7|n|03/08:02->11/01:01\": \"1/dawson,1/whitehorse,6/yukon\",\n \t\"-7|n\": \"1/creston,1/dawson_creek,1/fort_nelson,1/hermosillo,1/phoenix\",\n \t\"-6|s|04/03:22->09/04:22\": \"7/easterisland,11/easter\",\n \t\"-6|n|04/04:02->10/31:02\": \"1/chihuahua,1/mazatlan,10/bajasur\",\n \t\"-6|n|03/14:02->11/07:02\": \"1/boise,1/cambridge_bay,1/denver,1/edmonton,1/inuvik,1/ojinaga,1/shiprock,1/yellowknife,6/mountain\",\n \t\"-6|n\": \"1/belize,1/costa_rica,1/el_salvador,1/guatemala,1/managua,1/regina,1/swift_current,1/tegucigalpa,6/east-saskatchewan,6/saskatchewan,11/galapagos\",\n \t\"-5|s\": \"1/lima,1/rio_branco,5/acre\",\n \t\"-5|n|04/04:02->10/31:02\": \"1/bahia_banderas,1/merida,1/mexico_city,1/monterrey,10/general\",\n \t\"-5|n|03/14:02->11/07:02\": \"1/chicago,1/knox_in,1/matamoros,1/menominee,1/rainy_river,1/rankin_inlet,1/resolute,1/winnipeg,6/central\",\n \t\"-5|n|03/12:03->11/05:01\": \"1/north_dakota\",\n \t\"-5|n\": \"1/atikokan,1/bogota,1/cancun,1/cayman,1/coral_harbour,1/eirunepe,1/guayaquil,1/jamaica,1/panama,1/porto_acre\",\n \t\"-4|s|05/13:23->08/13:01\": \"12/palmer\",\n \t\"-4|s|04/03:24->09/05:00\": \"1/santiago,7/continental\",\n \t\"-4|s|03/27:24->10/03:00\": \"1/asuncion\",\n \t\"-4|s|02/16:24->11/03:00\": \"1/campo_grande,1/cuiaba\",\n \t\"-4|s\": \"1/la_paz,1/manaus,5/west\",\n \t\"-4|n|03/14:02->11/07:02\": \"1/detroit,1/fort_wayne,1/grand_turk,1/indianapolis,1/iqaluit,1/louisville,1/montreal,1/nassau,1/new_york,1/nipigon,1/pangnirtung,1/port-au-prince,1/thunder_bay,1/toronto,6/eastern\",\n \t\"-4|n|03/14:00->11/07:01\": \"1/havana\",\n \t\"-4|n|03/12:03->11/05:01\": \"1/indiana,1/kentucky\",\n \t\"-4|n\": \"1/anguilla,1/antigua,1/aruba,1/barbados,1/blanc-sablon,1/boa_vista,1/caracas,1/curacao,1/dominica,1/grenada,1/guadeloupe,1/guyana,1/kralendijk,1/lower_princes,1/marigot,1/martinique,1/montserrat,1/port_of_spain,1/porto_velho,1/puerto_rico,1/santo_domingo,1/st_barthelemy,1/st_kitts,1/st_lucia,1/st_thomas,1/st_vincent,1/tortola,1/virgin\",\n \t\"-3|s\": \"1/argentina,1/buenos_aires,1/cordoba,1/fortaleza,1/montevideo,1/punta_arenas,1/sao_paulo,12/rothera,3/stanley,5/east\",\n \t\"-3|n|03/27:22->10/30:23\": \"1/nuuk\",\n \t\"-3|n|03/14:02->11/07:02\": \"1/glace_bay,1/goose_bay,1/halifax,1/moncton,1/thule,3/bermuda,6/atlantic\",\n \t\"-3|n\": \"1/araguaina,1/bahia,1/belem,1/catamarca,1/cayenne,1/jujuy,1/maceio,1/mendoza,1/paramaribo,1/recife,1/rosario,1/santarem\",\n \t\"-2|s\": \"5/denoronha\",\n \t\"-2|n|03/27:22->10/30:23\": \"1/godthab\",\n \t\"-2|n|03/14:02->11/07:02\": \"1/miquelon\",\n \t\"-2|n\": \"1/noronha,3/south_georgia\",\n \t\"-2.5|n|03/14:02->11/07:02\": \"1/st_johns,6/newfoundland\",\n \t\"-1|n\": \"3/cape_verde\",\n \t\"-11|n\": \"11/midway,11/niue,11/pago_pago,11/samoa\",\n \t\"-10|n\": \"11/honolulu,11/johnston,11/rarotonga,11/tahiti\"\n };\n\n var _build$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n 'default': _build\n });\n\n //prefixes for iana names..\n var _prefixes = ['africa', 'america', 'asia', 'atlantic', 'australia', 'brazil', 'canada', 'chile', 'europe', 'indian', 'mexico', 'pacific', 'antarctica', 'etc'];\n\n function createCommonjsModule(fn, module) {\n \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n }\n\n function getCjsExportFromNamespace (n) {\n \treturn n && n['default'] || n;\n }\n\n var data = getCjsExportFromNamespace(_build$1);\n\n var all = {};\n Object.keys(data).forEach(function (k) {\n var split = k.split('|');\n var obj = {\n offset: Number(split[0]),\n hem: split[1]\n };\n\n if (split[2]) {\n obj.dst = split[2];\n }\n\n var names = data[k].split(',');\n names.forEach(function (str) {\n str = str.replace(/(^[0-9]+)\\//, function (before, num) {\n num = Number(num);\n return _prefixes[num] + '/';\n });\n all[str] = obj;\n });\n });\n all['utc'] = {\n offset: 0,\n hem: 'n' //default to northern hemisphere - (sorry!)\n\n }; //add etc/gmt+n\n\n for (var i = -14; i <= 14; i += 0.5) {\n var num = i;\n\n if (num > 0) {\n num = '+' + num;\n }\n\n var name = 'etc/gmt' + num;\n all[name] = {\n offset: i * -1,\n //they're negative!\n hem: 'n' //(sorry)\n\n };\n name = 'utc/gmt' + num; //this one too, why not.\n\n all[name] = {\n offset: i * -1,\n hem: 'n'\n };\n }\n\n var unpack = all;\n\n //find the implicit iana code for this machine.\n //safely query the Intl object\n //based on - https://bitbucket.org/pellepim/jstimezonedetect/src\n var fallbackTZ = 'utc'; //\n //this Intl object is not supported often, yet\n\n var safeIntl = function safeIntl() {\n if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {\n return null;\n }\n\n var format = Intl.DateTimeFormat();\n\n if (typeof format === 'undefined' || typeof format.resolvedOptions === 'undefined') {\n return null;\n }\n\n var timezone = format.resolvedOptions().timeZone;\n\n if (!timezone) {\n return null;\n }\n\n return timezone.toLowerCase();\n };\n\n var guessTz = function guessTz() {\n var timezone = safeIntl();\n\n if (timezone === null) {\n return fallbackTZ;\n }\n\n return timezone;\n }; //do it once per computer\n\n\n var guessTz_1 = guessTz;\n\n var isOffset = /(\\-?[0-9]+)h(rs)?/i;\n var isNumber = /(\\-?[0-9]+)/;\n var utcOffset = /utc([\\-+]?[0-9]+)/i;\n var gmtOffset = /gmt([\\-+]?[0-9]+)/i;\n\n var toIana = function toIana(num) {\n num = Number(num);\n\n if (num >= -13 && num <= 13) {\n num = num * -1; //it's opposite!\n\n num = (num > 0 ? '+' : '') + num; //add plus sign\n\n return 'etc/gmt' + num;\n }\n\n return null;\n };\n\n var parseOffset = function parseOffset(tz) {\n // '+5hrs'\n var m = tz.match(isOffset);\n\n if (m !== null) {\n return toIana(m[1]);\n } // 'utc+5'\n\n\n m = tz.match(utcOffset);\n\n if (m !== null) {\n return toIana(m[1]);\n } // 'GMT-5' (not opposite)\n\n\n m = tz.match(gmtOffset);\n\n if (m !== null) {\n var num = Number(m[1]) * -1;\n return toIana(num);\n } // '+5'\n\n\n m = tz.match(isNumber);\n\n if (m !== null) {\n return toIana(m[1]);\n }\n\n return null;\n };\n\n var parseOffset_1 = parseOffset;\n\n var local = guessTz_1(); //add all the city names by themselves\n\n var cities = Object.keys(unpack).reduce(function (h, k) {\n var city = k.split('/')[1] || '';\n city = city.replace(/_/g, ' ');\n h[city] = k;\n return h;\n }, {}); //try to match these against iana form\n\n var normalize = function normalize(tz) {\n tz = tz.replace(/ time/g, '');\n tz = tz.replace(/ (standard|daylight|summer)/g, '');\n tz = tz.replace(/\\b(east|west|north|south)ern/g, '$1');\n tz = tz.replace(/\\b(africa|america|australia)n/g, '$1');\n tz = tz.replace(/\\beuropean/g, 'europe');\n tz = tz.replace(/\\islands/g, 'island');\n return tz;\n }; // try our best to reconcile the timzone to this given string\n\n\n var lookupTz = function lookupTz(str, zones) {\n if (!str) {\n return local;\n }\n\n if (typeof str !== 'string') {\n console.error(\"Timezone must be a string - recieved: '\", str, \"'\\n\");\n }\n\n var tz = str.trim();\n var split = str.split('/'); //support long timezones like 'America/Argentina/Rio_Gallegos'\n\n if (split.length > 2 && zones.hasOwnProperty(tz) === false) {\n tz = split[0] + '/' + split[1];\n }\n\n tz = tz.toLowerCase();\n\n if (zones.hasOwnProperty(tz) === true) {\n return tz;\n } //lookup more loosely..\n\n\n tz = normalize(tz);\n\n if (zones.hasOwnProperty(tz) === true) {\n return tz;\n } //try city-names\n\n\n if (cities.hasOwnProperty(tz) === true) {\n return cities[tz];\n } // //try to parse '-5h'\n\n\n if (/[0-9]/.test(tz) === true) {\n var id = parseOffset_1(tz);\n\n if (id) {\n return id;\n }\n }\n\n throw new Error(\"Spacetime: Cannot find timezone named: '\" + str + \"'. Please enter an IANA timezone id.\");\n };\n\n var find = lookupTz;\n\n var o = {\n millisecond: 1\n };\n o.second = 1000;\n o.minute = 60000;\n o.hour = 3.6e6; // dst is supported post-hoc\n\n o.day = 8.64e7; //\n\n o.date = o.day;\n o.month = 8.64e7 * 29.5; //(average)\n\n o.week = 6.048e8;\n o.year = 3.154e10; // leap-years are supported post-hoc\n //add plurals\n\n Object.keys(o).forEach(function (k) {\n o[k + 's'] = o[k];\n });\n var milliseconds = o;\n\n var walk = function walk(s, n, fn, unit, previous) {\n var current = s.d[fn]();\n\n if (current === n) {\n return; //already there\n }\n\n var startUnit = previous === null ? null : s.d[previous]();\n var original = s.epoch; //try to get it as close as we can\n\n var diff = n - current;\n s.epoch += milliseconds[unit] * diff; //DST edge-case: if we are going many days, be a little conservative\n // console.log(unit, diff)\n\n if (unit === 'day') {\n // s.epoch -= ms.minute\n //but don't push it over a month\n if (Math.abs(diff) > 28 && n < 28) {\n s.epoch += milliseconds.hour;\n }\n } // 1st time: oops, did we change previous unit? revert it.\n\n\n if (previous !== null && startUnit !== s.d[previous]()) {\n // console.warn('spacetime warning: missed setting ' + unit)\n s.epoch = original; // s.epoch += ms[unit] * diff * 0.89 // maybe try and make it close...?\n } //repair it if we've gone too far or something\n //(go by half-steps, just in case)\n\n\n var halfStep = milliseconds[unit] / 2;\n\n while (s.d[fn]() < n) {\n s.epoch += halfStep;\n }\n\n while (s.d[fn]() > n) {\n s.epoch -= halfStep;\n } // 2nd time: did we change previous unit? revert it.\n\n\n if (previous !== null && startUnit !== s.d[previous]()) {\n // console.warn('spacetime warning: missed setting ' + unit)\n s.epoch = original;\n }\n }; //find the desired date by a increment/check while loop\n\n\n var units = {\n year: {\n valid: function valid(n) {\n return n > -4000 && n < 4000;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getFullYear', 'year', null);\n }\n },\n month: {\n valid: function valid(n) {\n return n >= 0 && n <= 11;\n },\n walkTo: function walkTo(s, n) {\n var d = s.d;\n var current = d.getMonth();\n var original = s.epoch;\n var startUnit = d.getFullYear();\n\n if (current === n) {\n return;\n } //try to get it as close as we can..\n\n\n var diff = n - current;\n s.epoch += milliseconds.day * (diff * 28); //special case\n //oops, did we change the year? revert it.\n\n if (startUnit !== s.d.getFullYear()) {\n s.epoch = original;\n } //increment by day\n\n\n while (s.d.getMonth() < n) {\n s.epoch += milliseconds.day;\n }\n\n while (s.d.getMonth() > n) {\n s.epoch -= milliseconds.day;\n }\n }\n },\n date: {\n valid: function valid(n) {\n return n > 0 && n <= 31;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getDate', 'day', 'getMonth');\n }\n },\n hour: {\n valid: function valid(n) {\n return n >= 0 && n < 24;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getHours', 'hour', 'getDate');\n }\n },\n minute: {\n valid: function valid(n) {\n return n >= 0 && n < 60;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getMinutes', 'minute', 'getHours');\n }\n },\n second: {\n valid: function valid(n) {\n return n >= 0 && n < 60;\n },\n walkTo: function walkTo(s, n) {\n //do this one directly\n s.epoch = s.seconds(n).epoch;\n }\n },\n millisecond: {\n valid: function valid(n) {\n return n >= 0 && n < 1000;\n },\n walkTo: function walkTo(s, n) {\n //do this one directly\n s.epoch = s.milliseconds(n).epoch;\n }\n }\n };\n\n var walkTo = function walkTo(s, wants) {\n var keys = Object.keys(units);\n var old = s.clone();\n\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n var n = wants[k];\n\n if (n === undefined) {\n n = old[k]();\n }\n\n if (typeof n === 'string') {\n n = parseInt(n, 10);\n } //make-sure it's valid\n\n\n if (!units[k].valid(n)) {\n s.epoch = null;\n\n if (s.silent === false) {\n console.warn('invalid ' + k + ': ' + n);\n }\n\n return;\n }\n\n units[k].walkTo(s, n);\n }\n\n return;\n };\n\n var walk_1 = walkTo;\n\n var shortMonths = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec'];\n var longMonths = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];\n\n function buildMapping() {\n var obj = {\n sep: 8 //support this format\n\n };\n\n for (var i = 0; i < shortMonths.length; i++) {\n obj[shortMonths[i]] = i;\n }\n\n for (var _i = 0; _i < longMonths.length; _i++) {\n obj[longMonths[_i]] = _i;\n }\n\n return obj;\n }\n\n var months = {\n \"short\": function short() {\n return shortMonths;\n },\n \"long\": function long() {\n return longMonths;\n },\n mapping: function mapping() {\n return buildMapping();\n },\n set: function set(i18n) {\n shortMonths = i18n[\"short\"] || shortMonths;\n longMonths = i18n[\"long\"] || longMonths;\n }\n };\n\n //pull-apart ISO offsets, like \"+0100\"\n var parseOffset$1 = function parseOffset(s, offset) {\n if (!offset) {\n return s;\n } //this is a fancy-move\n\n\n if (offset === 'Z' || offset === 'z') {\n offset = '+0000';\n } // according to ISO8601, tz could be hh:mm, hhmm or hh\n // so need few more steps before the calculation.\n\n\n var num = 0; // for (+-)hh:mm\n\n if (/^[\\+-]?[0-9]{2}:[0-9]{2}$/.test(offset)) {\n //support \"+01:00\"\n if (/:00/.test(offset) === true) {\n offset = offset.replace(/:00/, '');\n } //support \"+01:30\"\n\n\n if (/:30/.test(offset) === true) {\n offset = offset.replace(/:30/, '.5');\n }\n } // for (+-)hhmm\n\n\n if (/^[\\+-]?[0-9]{4}$/.test(offset)) {\n offset = offset.replace(/30$/, '.5');\n }\n\n num = parseFloat(offset); //divide by 100 or 10 - , \"+0100\", \"+01\"\n\n if (Math.abs(num) > 100) {\n num = num / 100;\n } //okay, try to match it to a utc timezone\n //remember - this is opposite! a -5 offset maps to Etc/GMT+5 ¯\\_(:/)_/¯\n //https://askubuntu.com/questions/519550/why-is-the-8-timezone-called-gmt-8-in-the-filesystem\n\n\n num *= -1;\n\n if (num >= 0) {\n num = '+' + num;\n }\n\n var tz = 'etc/gmt' + num;\n var zones = s.timezones;\n\n if (zones[tz]) {\n // log a warning if we're over-writing a given timezone?\n // console.log('changing timezone to: ' + tz)\n s.tz = tz;\n }\n\n return s;\n };\n\n var parseOffset_1$1 = parseOffset$1;\n\n var parseTime = function parseTime(s) {\n var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n str = str.replace(/^\\s+/, '').toLowerCase(); //trim\n //formal time formats - 04:30.23\n\n var arr = str.match(/([0-9]{1,2}):([0-9]{1,2}):?([0-9]{1,2})?[:\\.]?([0-9]{1,4})?/);\n\n if (arr !== null) {\n //validate it a little\n var h = Number(arr[1]);\n\n if (h < 0 || h > 24) {\n return s.startOf('day');\n }\n\n var m = Number(arr[2]); //don't accept '5:3pm'\n\n if (arr[2].length < 2 || m < 0 || m > 59) {\n return s.startOf('day');\n }\n\n if (arr[4] > 999) {\n // fix overflow issue with milliseconds, if input is longer than standard (e.g. 2017-08-06T09:00:00.123456Z)\n arr[4] = parseInt(\"\".concat(arr[4]).substring(0, 3), 10);\n }\n\n s = s.hour(h);\n s = s.minute(m);\n s = s.seconds(arr[3] || 0);\n s = s.millisecond(arr[4] || 0); //parse-out am/pm\n\n var ampm = str.match(/[\\b0-9](am|pm)\\b/);\n\n if (ampm !== null && ampm[1]) {\n s = s.ampm(ampm[1]);\n }\n\n return s;\n } //try an informal form - 5pm (no minutes)\n\n\n arr = str.match(/([0-9]+) ?(am|pm)/);\n\n if (arr !== null && arr[1]) {\n var _h = Number(arr[1]); //validate it a little..\n\n\n if (_h > 12 || _h < 1) {\n return s.startOf('day');\n }\n\n s = s.hour(arr[1] || 0);\n s = s.ampm(arr[2]);\n s = s.startOf('hour');\n return s;\n } //no time info found, use start-of-day\n\n\n s = s.startOf('day');\n return s;\n };\n\n var parseTime_1 = parseTime;\n\n var monthLengths = [31, // January - 31 days\n 28, // February - 28 days in a common year and 29 days in leap years\n 31, // March - 31 days\n 30, // April - 30 days\n 31, // May - 31 days\n 30, // June - 30 days\n 31, // July - 31 days\n 31, // August - 31 days\n 30, // September - 30 days\n 31, // October - 31 days\n 30, // November - 30 days\n 31 // December - 31 days\n ];\n var monthLengths_1 = monthLengths; // 28 - feb\n\n var fns = createCommonjsModule(function (module, exports) {\n //git:blame @JuliasCaesar https://www.timeanddate.com/date/leapyear.html\n exports.isLeapYear = function (year) {\n return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n }; // unsurprisingly-nasty `typeof date` call\n\n\n exports.isDate = function (d) {\n return Object.prototype.toString.call(d) === '[object Date]' && !isNaN(d.valueOf());\n };\n\n exports.isArray = function (input) {\n return Object.prototype.toString.call(input) === '[object Array]';\n };\n\n exports.isObject = function (input) {\n return Object.prototype.toString.call(input) === '[object Object]';\n };\n\n exports.isBoolean = function (input) {\n return Object.prototype.toString.call(input) === '[object Boolean]';\n };\n\n exports.zeroPad = function (str) {\n var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n var pad = '0';\n str = str + '';\n return str.length >= len ? str : new Array(len - str.length + 1).join(pad) + str;\n };\n\n exports.titleCase = function (str) {\n if (!str) {\n return '';\n }\n\n return str[0].toUpperCase() + str.substr(1);\n };\n\n exports.ordinal = function (i) {\n var j = i % 10;\n var k = i % 100;\n\n if (j === 1 && k !== 11) {\n return i + 'st';\n }\n\n if (j === 2 && k !== 12) {\n return i + 'nd';\n }\n\n if (j === 3 && k !== 13) {\n return i + 'rd';\n }\n\n return i + 'th';\n }; //strip 'st' off '1st'..\n\n\n exports.toCardinal = function (str) {\n str = String(str);\n str = str.replace(/([0-9])(st|nd|rd|th)$/i, '$1');\n return parseInt(str, 10);\n }; //used mostly for cleanup of unit names, like 'months'\n\n\n exports.normalize = function () {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n str = str.toLowerCase().trim();\n str = str.replace(/ies$/, 'y'); //'centuries'\n\n str = str.replace(/s$/, '');\n str = str.replace(/-/g, '');\n\n if (str === 'day' || str === 'days') {\n return 'date';\n }\n\n if (str === 'min' || str === 'mins') {\n return 'minute';\n }\n\n return str;\n };\n\n exports.getEpoch = function (tmp) {\n //support epoch\n if (typeof tmp === 'number') {\n return tmp;\n } //suport date objects\n\n\n if (exports.isDate(tmp)) {\n return tmp.getTime();\n }\n\n if (tmp.epoch) {\n return tmp.epoch;\n }\n\n return null;\n }; //make sure this input is a spacetime obj\n\n\n exports.beADate = function (d, s) {\n if (exports.isObject(d) === false) {\n return s.clone().set(d);\n }\n\n return d;\n };\n\n exports.formatTimezone = function (offset) {\n var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var sign = offset > 0 ? '+' : '-';\n var absOffset = Math.abs(offset);\n var hours = exports.zeroPad(parseInt('' + absOffset, 10));\n var minutes = exports.zeroPad(absOffset % 1 * 60);\n return \"\".concat(sign).concat(hours).concat(delimiter).concat(minutes);\n };\n });\n fns.isLeapYear;\n fns.isDate;\n fns.isArray;\n fns.isObject;\n fns.isBoolean;\n fns.zeroPad;\n fns.titleCase;\n fns.ordinal;\n fns.toCardinal;\n fns.normalize;\n fns.getEpoch;\n fns.beADate;\n fns.formatTimezone;\n\n var isLeapYear = fns.isLeapYear; //given a month, return whether day number exists in it\n\n var hasDate = function hasDate(obj) {\n //invalid values\n if (monthLengths_1.hasOwnProperty(obj.month) !== true) {\n return false;\n } //support leap-year in february\n\n\n if (obj.month === 1) {\n if (isLeapYear(obj.year) && obj.date <= 29) {\n return true;\n } else {\n return obj.date <= 28;\n }\n } //is this date too-big for this month?\n\n\n var max = monthLengths_1[obj.month] || 0;\n\n if (obj.date <= max) {\n return true;\n }\n\n return false;\n };\n\n var hasDate_1 = hasDate;\n\n var months$1 = months.mapping();\n\n var parseYear = function parseYear() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var today = arguments.length > 1 ? arguments[1] : undefined;\n var year = parseInt(str.trim(), 10); // use a given year from options.today\n\n if (!year && today) {\n year = today.year;\n } // fallback to this year\n\n\n year = year || new Date().getFullYear();\n return year;\n };\n\n var strFmt = [//iso-this 1998-05-30T22:00:00:000Z, iso-that 2017-04-03T08:00:00-0700\n {\n reg: /^(\\-?0?0?[0-9]{3,4})-([0-9]{1,2})-([0-9]{1,2})[T| ]([0-9.:]+)(Z|[0-9\\-\\+:]+)?$/i,\n parse: function parse(s, arr, givenTz, options) {\n var month = parseInt(arr[2], 10) - 1;\n var obj = {\n year: arr[1],\n month: month,\n date: arr[3]\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n parseOffset_1$1(s, arr[5]);\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //iso \"2015-03-25\" or \"2015/03/25\" or \"2015/03/25 12:26:14 PM\"\n {\n reg: /^([0-9]{4})[\\-\\/.]([0-9]{1,2})[\\-\\/.]([0-9]{1,2}),?( [0-9]{1,2}:[0-9]{2}:?[0-9]{0,2}? ?(am|pm|gmt))?$/i,\n parse: function parse(s, arr) {\n var obj = {\n year: arr[1],\n month: parseInt(arr[2], 10) - 1,\n date: parseInt(arr[3], 10)\n };\n\n if (obj.month >= 12) {\n //support yyyy/dd/mm (weird, but ok)\n obj.date = parseInt(arr[2], 10);\n obj.month = parseInt(arr[3], 10) - 1;\n }\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //mm/dd/yyyy - uk/canada \"6/28/2019, 12:26:14 PM\"\n {\n reg: /^([0-9]{1,2})[\\-\\/.]([0-9]{1,2})[\\-\\/.]?([0-9]{4})?,?( [0-9]{1,2}:[0-9]{2}:?[0-9]{0,2}? ?(am|pm|gmt))?$/i,\n parse: function parse(s, arr) {\n var month = parseInt(arr[1], 10) - 1;\n var date = parseInt(arr[2], 10); //support dd/mm/yyy\n\n if (s.british || month >= 12) {\n date = parseInt(arr[1], 10);\n month = parseInt(arr[2], 10) - 1;\n }\n\n var year = parseYear(arr[3], s._today) || new Date().getFullYear();\n var obj = {\n year: year,\n month: month,\n date: date\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, // '2012-06' last attempt at iso-like format\n {\n reg: /^([0-9]{4})[\\-\\/]([0-9]{2})$/i,\n parse: function parse(s, arr, givenTz, options) {\n var month = parseInt(arr[2], 10) - 1;\n var obj = {\n year: arr[1],\n month: month,\n date: 1\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n parseOffset_1$1(s, arr[5]);\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //common british format - \"25-feb-2015\"\n {\n reg: /^([0-9]{1,2})[\\-\\/]([a-z]+)[\\-\\/]?([0-9]{4})?$/i,\n parse: function parse(s, arr) {\n var month = months$1[arr[2].toLowerCase()];\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[1] || '')\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //alt short format - \"feb-25-2015\"\n {\n reg: /^([a-z]+)[\\-\\/]([0-9]{1,2})[\\-\\/]?([0-9]{4})?$/i,\n parse: function parse(s, arr) {\n var month = months$1[arr[1].toLowerCase()];\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[2] || '')\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //Long \"Mar 25 2015\"\n //February 22, 2017 15:30:00\n {\n reg: /^([a-z]+) ([0-9]{1,2}(?:st|nd|rd|th)?),?( [0-9]{4})?( ([0-9:]+( ?am| ?pm| ?gmt)?))?$/i,\n parse: function parse(s, arr) {\n var month = months$1[arr[1].toLowerCase()];\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[2] || '')\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //February 2017 (implied date)\n {\n reg: /^([a-z]+) ([0-9]{4})$/i,\n parse: function parse(s, arr) {\n var month = months$1[arr[1].toLowerCase()];\n var year = parseYear(arr[2], s._today);\n var obj = {\n year: year,\n month: month,\n date: s._today.date || 1\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //Long \"25 Mar 2015\"\n {\n reg: /^([0-9]{1,2}(?:st|nd|rd|th)?) ([a-z]+),?( [0-9]{4})?,? ?([0-9]{1,2}:[0-9]{2}:?[0-9]{0,2}? ?(am|pm|gmt))?$/i,\n parse: function parse(s, arr) {\n var month = months$1[arr[2].toLowerCase()];\n\n if (!month) {\n return null;\n }\n\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[1])\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, {\n // 'q2 2002'\n reg: /^(q[0-9])( of)?( [0-9]{4})?/i,\n parse: function parse(s, arr) {\n var quarter = arr[1] || '';\n s = s.quarter(quarter);\n var year = arr[3] || '';\n\n if (year) {\n year = year.trim();\n s = s.year(year);\n }\n\n return s;\n }\n }, {\n // 'summer 2002'\n reg: /^(spring|summer|winter|fall|autumn)( of)?( [0-9]{4})?/i,\n parse: function parse(s, arr) {\n var season = arr[1] || '';\n s = s.season(season);\n var year = arr[3] || '';\n\n if (year) {\n year = year.trim();\n s = s.year(year);\n }\n\n return s;\n }\n }, {\n // '200bc'\n reg: /^[0-9,]+ ?b\\.?c\\.?$/i,\n parse: function parse(s, arr) {\n var str = arr[0] || ''; //make negative-year\n\n str = str.replace(/^([0-9,]+) ?b\\.?c\\.?$/i, '-$1'); //remove commas\n\n str = str.replace(/,/g, '');\n var year = parseInt(str.trim(), 10);\n var d = new Date();\n var obj = {\n year: year,\n month: d.getMonth(),\n date: d.getDate()\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s);\n return s;\n }\n }, {\n // '200ad'\n reg: /^[0-9,]+ ?(a\\.?d\\.?|c\\.?e\\.?)$/i,\n parse: function parse(s, arr) {\n var str = arr[0] || ''; //remove commas\n\n str = str.replace(/,/g, '');\n var year = parseInt(str.trim(), 10);\n var d = new Date();\n var obj = {\n year: year,\n month: d.getMonth(),\n date: d.getDate()\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s);\n return s;\n }\n }, {\n // '1992'\n reg: /^[0-9]{4}( ?a\\.?d\\.?)?$/i,\n parse: function parse(s, arr) {\n var today = s._today;\n var year = parseYear(arr[0], today);\n var d = new Date(); // using today's date, but a new month is awkward.\n\n if (today.month && !today.date) {\n today.date = 1;\n }\n\n var obj = {\n year: year,\n month: today.month || d.getMonth(),\n date: today.date || d.getDate()\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s);\n return s;\n }\n }];\n var strParse = strFmt;\n\n // pull in 'today' data for the baseline moment\n var getNow = function getNow(s) {\n s.epoch = Date.now();\n Object.keys(s._today || {}).forEach(function (k) {\n if (typeof s[k] === 'function') {\n s = s[k](s._today[k]);\n }\n });\n return s;\n };\n\n var dates = {\n now: function now(s) {\n return getNow(s);\n },\n today: function today(s) {\n return getNow(s);\n },\n tonight: function tonight(s) {\n s = getNow(s);\n s = s.hour(18); //6pm\n\n return s;\n },\n tomorrow: function tomorrow(s) {\n s = getNow(s);\n s = s.add(1, 'day');\n s = s.startOf('day');\n return s;\n },\n yesterday: function yesterday(s) {\n s = getNow(s);\n s = s.subtract(1, 'day');\n s = s.startOf('day');\n return s;\n },\n christmas: function christmas(s) {\n var year = getNow(s).year();\n s = s.set([year, 11, 25, 18, 0, 0]); // Dec 25\n\n return s;\n },\n 'new years': function newYears(s) {\n var year = getNow(s).year();\n s = s.set([year, 11, 31, 18, 0, 0]); // Dec 31\n\n return s;\n }\n };\n dates['new years eve'] = dates['new years'];\n var namedDates = dates;\n\n // - can't use built-in js parser ;(\n //=========================================\n // ISO Date\t \"2015-03-25\"\n // Short Date\t\"03/25/2015\" or \"2015/03/25\"\n // Long Date\t\"Mar 25 2015\" or \"25 Mar 2015\"\n // Full Date\t\"Wednesday March 25 2015\"\n //=========================================\n //-- also -\n // if the given epoch is really small, they've probably given seconds and not milliseconds\n // anything below this number is likely (but not necessarily) a mistaken input.\n // this may seem like an arbitrary number, but it's 'within jan 1970'\n // this is only really ambiguous until 2054 or so\n\n var minimumEpoch = 2500000000;\n var defaults = {\n year: new Date().getFullYear(),\n month: 0,\n date: 1\n }; //support [2016, 03, 01] format\n\n var handleArray = function handleArray(s, arr, today) {\n if (arr.length === 0) {\n return s;\n }\n\n var order = ['year', 'month', 'date', 'hour', 'minute', 'second', 'millisecond'];\n\n for (var i = 0; i < order.length; i++) {\n var num = arr[i] || today[order[i]] || defaults[order[i]] || 0;\n s = s[order[i]](num);\n }\n\n return s;\n }; //support {year:2016, month:3} format\n\n\n var handleObject = function handleObject(s, obj, today) {\n // if obj is empty, do nothing\n if (Object.keys(obj).length === 0) {\n return s;\n }\n\n obj = Object.assign({}, defaults, today, obj);\n var keys = Object.keys(obj);\n\n for (var i = 0; i < keys.length; i++) {\n var unit = keys[i]; //make sure we have this method\n\n if (s[unit] === undefined || typeof s[unit] !== 'function') {\n continue;\n } //make sure the value is a number\n\n\n if (obj[unit] === null || obj[unit] === undefined || obj[unit] === '') {\n continue;\n }\n\n var num = obj[unit] || today[unit] || defaults[unit] || 0;\n s = s[unit](num);\n }\n\n return s;\n }; //find the epoch from different input styles\n\n\n var parseInput = function parseInput(s, input, givenTz) {\n var today = s._today || defaults; //if we've been given a epoch number, it's easy\n\n if (typeof input === 'number') {\n if (input > 0 && input < minimumEpoch && s.silent === false) {\n console.warn(' - Warning: You are setting the date to January 1970.');\n console.warn(' - did input seconds instead of milliseconds?');\n }\n\n s.epoch = input;\n return s;\n } //set tmp time\n\n\n s.epoch = Date.now(); // overwrite tmp time with 'today' value, if exists\n\n if (s._today && fns.isObject(s._today) && Object.keys(s._today).length > 0) {\n var res = handleObject(s, today, defaults);\n\n if (res.isValid()) {\n s.epoch = res.epoch;\n }\n } // null input means 'now'\n\n\n if (input === null || input === undefined || input === '') {\n return s; //k, we're good.\n } //support input of Date() object\n\n\n if (fns.isDate(input) === true) {\n s.epoch = input.getTime();\n return s;\n } //support [2016, 03, 01] format\n\n\n if (fns.isArray(input) === true) {\n s = handleArray(s, input, today);\n return s;\n } //support {year:2016, month:3} format\n\n\n if (fns.isObject(input) === true) {\n //support spacetime object as input\n if (input.epoch) {\n s.epoch = input.epoch;\n s.tz = input.tz;\n return s;\n }\n\n s = handleObject(s, input, today);\n return s;\n } //input as a string..\n\n\n if (typeof input !== 'string') {\n return s;\n } //little cleanup..\n\n\n input = input.replace(/\\b(mon|tues|wed|wednes|thu|thurs|fri|sat|satur|sun)(day)?\\b/i, '');\n input = input.replace(/,/g, '');\n input = input.replace(/ +/g, ' ').trim(); //try some known-words, like 'now'\n\n if (namedDates.hasOwnProperty(input) === true) {\n s = namedDates[input](s);\n return s;\n } //try each text-parse template, use the first good result\n\n\n for (var i = 0; i < strParse.length; i++) {\n var m = input.match(strParse[i].reg);\n\n if (m) {\n // console.log(strFmt[i].reg)\n var _res = strParse[i].parse(s, m, givenTz);\n\n if (_res !== null && _res.isValid()) {\n return _res;\n }\n }\n }\n\n if (s.silent === false) {\n console.warn(\"Warning: couldn't parse date-string: '\" + input + \"'\");\n }\n\n s.epoch = null;\n return s;\n };\n\n var input = parseInput;\n\n var shortDays = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n var longDays = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\n var days = {\n \"short\": function short() {\n return shortDays;\n },\n \"long\": function long() {\n return longDays;\n },\n set: function set(i18n) {\n shortDays = i18n[\"short\"] || shortDays;\n longDays = i18n[\"long\"] || longDays;\n },\n aliases: {\n tues: 2,\n thur: 4,\n thurs: 4\n }\n };\n\n var titleCaseEnabled = true;\n var caseFormat = {\n useTitleCase: function useTitleCase() {\n return titleCaseEnabled;\n },\n set: function set(useTitleCase) {\n titleCaseEnabled = useTitleCase;\n }\n };\n\n // it's kind of nuts how involved this is\n // \"+01:00\", \"+0100\", or simply \"+01\"\n\n var isoOffset = function isoOffset(s) {\n var offset = s.timezone().current.offset;\n return !offset ? 'Z' : fns.formatTimezone(offset, ':');\n };\n\n var _offset = isoOffset;\n\n var applyCaseFormat = function applyCaseFormat(str) {\n if (caseFormat.useTitleCase()) {\n return fns.titleCase(str);\n }\n\n return str;\n };\n\n var format = {\n day: function day(s) {\n return applyCaseFormat(s.dayName());\n },\n 'day-short': function dayShort(s) {\n return applyCaseFormat(days[\"short\"]()[s.day()]);\n },\n 'day-number': function dayNumber(s) {\n return s.day();\n },\n 'day-ordinal': function dayOrdinal(s) {\n return fns.ordinal(s.day());\n },\n 'day-pad': function dayPad(s) {\n return fns.zeroPad(s.day());\n },\n date: function date(s) {\n return s.date();\n },\n 'date-ordinal': function dateOrdinal(s) {\n return fns.ordinal(s.date());\n },\n 'date-pad': function datePad(s) {\n return fns.zeroPad(s.date());\n },\n month: function month(s) {\n return applyCaseFormat(s.monthName());\n },\n 'month-short': function monthShort(s) {\n return applyCaseFormat(months[\"short\"]()[s.month()]);\n },\n 'month-number': function monthNumber(s) {\n return s.month();\n },\n 'month-ordinal': function monthOrdinal(s) {\n return fns.ordinal(s.month());\n },\n 'month-pad': function monthPad(s) {\n return fns.zeroPad(s.month());\n },\n 'iso-month': function isoMonth(s) {\n return fns.zeroPad(s.month() + 1);\n },\n //1-based months\n year: function year(s) {\n var year = s.year();\n\n if (year > 0) {\n return year;\n }\n\n year = Math.abs(year);\n return year + ' BC';\n },\n 'year-short': function yearShort(s) {\n var year = s.year();\n\n if (year > 0) {\n return \"'\".concat(String(s.year()).substr(2, 4));\n }\n\n year = Math.abs(year);\n return year + ' BC';\n },\n 'iso-year': function isoYear(s) {\n var year = s.year();\n var isNegative = year < 0;\n var str = fns.zeroPad(Math.abs(year), 4); //0-padded\n\n if (isNegative) {\n //negative years are for some reason 6-digits ('-00008')\n str = fns.zeroPad(str, 6);\n str = '-' + str;\n }\n\n return str;\n },\n time: function time(s) {\n return s.time();\n },\n 'time-24': function time24(s) {\n return \"\".concat(s.hour24(), \":\").concat(fns.zeroPad(s.minute()));\n },\n hour: function hour(s) {\n return s.hour12();\n },\n 'hour-pad': function hourPad(s) {\n return fns.zeroPad(s.hour12());\n },\n 'hour-24': function hour24(s) {\n return s.hour24();\n },\n 'hour-24-pad': function hour24Pad(s) {\n return fns.zeroPad(s.hour24());\n },\n minute: function minute(s) {\n return s.minute();\n },\n 'minute-pad': function minutePad(s) {\n return fns.zeroPad(s.minute());\n },\n second: function second(s) {\n return s.second();\n },\n 'second-pad': function secondPad(s) {\n return fns.zeroPad(s.second());\n },\n ampm: function ampm(s) {\n return s.ampm();\n },\n quarter: function quarter(s) {\n return 'Q' + s.quarter();\n },\n season: function season(s) {\n return s.season();\n },\n era: function era(s) {\n return s.era();\n },\n json: function json(s) {\n return s.json();\n },\n timezone: function timezone(s) {\n return s.timezone().name;\n },\n offset: function offset(s) {\n return _offset(s);\n },\n numeric: function numeric(s) {\n return \"\".concat(s.year(), \"/\").concat(fns.zeroPad(s.month() + 1), \"/\").concat(fns.zeroPad(s.date()));\n },\n // yyyy/mm/dd\n 'numeric-us': function numericUs(s) {\n return \"\".concat(fns.zeroPad(s.month() + 1), \"/\").concat(fns.zeroPad(s.date()), \"/\").concat(s.year());\n },\n // mm/dd/yyyy\n 'numeric-uk': function numericUk(s) {\n return \"\".concat(fns.zeroPad(s.date()), \"/\").concat(fns.zeroPad(s.month() + 1), \"/\").concat(s.year());\n },\n //dd/mm/yyyy\n 'mm/dd': function mmDd(s) {\n return \"\".concat(fns.zeroPad(s.month() + 1), \"/\").concat(fns.zeroPad(s.date()));\n },\n //mm/dd\n // ... https://en.wikipedia.org/wiki/ISO_8601 ;(((\n iso: function iso(s) {\n var year = s.format('iso-year');\n var month = fns.zeroPad(s.month() + 1); //1-based months\n\n var date = fns.zeroPad(s.date());\n var hour = fns.zeroPad(s.h24());\n var minute = fns.zeroPad(s.minute());\n var second = fns.zeroPad(s.second());\n var ms = fns.zeroPad(s.millisecond(), 3);\n var offset = _offset(s);\n return \"\".concat(year, \"-\").concat(month, \"-\").concat(date, \"T\").concat(hour, \":\").concat(minute, \":\").concat(second, \".\").concat(ms).concat(offset); //2018-03-09T08:50:00.000-05:00\n },\n 'iso-short': function isoShort(s) {\n var month = fns.zeroPad(s.month() + 1); //1-based months\n\n var date = fns.zeroPad(s.date());\n return \"\".concat(s.year(), \"-\").concat(month, \"-\").concat(date); //2017-02-15\n },\n 'iso-utc': function isoUtc(s) {\n return new Date(s.epoch).toISOString(); //2017-03-08T19:45:28.367Z\n },\n //i made these up\n nice: function nice(s) {\n return \"\".concat(months[\"short\"]()[s.month()], \" \").concat(fns.ordinal(s.date()), \", \").concat(s.time());\n },\n 'nice-24': function nice24(s) {\n return \"\".concat(months[\"short\"]()[s.month()], \" \").concat(fns.ordinal(s.date()), \", \").concat(s.hour24(), \":\").concat(fns.zeroPad(s.minute()));\n },\n 'nice-year': function niceYear(s) {\n return \"\".concat(months[\"short\"]()[s.month()], \" \").concat(fns.ordinal(s.date()), \", \").concat(s.year());\n },\n 'nice-day': function niceDay(s) {\n return \"\".concat(days[\"short\"]()[s.day()], \" \").concat(applyCaseFormat(months[\"short\"]()[s.month()]), \" \").concat(fns.ordinal(s.date()));\n },\n 'nice-full': function niceFull(s) {\n return \"\".concat(s.dayName(), \" \").concat(applyCaseFormat(s.monthName()), \" \").concat(fns.ordinal(s.date()), \", \").concat(s.time());\n },\n 'nice-full-24': function niceFull24(s) {\n return \"\".concat(s.dayName(), \" \").concat(applyCaseFormat(s.monthName()), \" \").concat(fns.ordinal(s.date()), \", \").concat(s.hour24(), \":\").concat(fns.zeroPad(s.minute()));\n }\n }; //aliases\n\n var aliases = {\n 'day-name': 'day',\n 'month-name': 'month',\n 'iso 8601': 'iso',\n 'time-h24': 'time-24',\n 'time-12': 'time',\n 'time-h12': 'time',\n tz: 'timezone',\n 'day-num': 'day-number',\n 'month-num': 'month-number',\n 'month-iso': 'iso-month',\n 'year-iso': 'iso-year',\n 'nice-short': 'nice',\n 'nice-short-24': 'nice-24',\n mdy: 'numeric-us',\n dmy: 'numeric-uk',\n ymd: 'numeric',\n 'yyyy/mm/dd': 'numeric',\n 'mm/dd/yyyy': 'numeric-us',\n 'dd/mm/yyyy': 'numeric-us',\n 'little-endian': 'numeric-uk',\n 'big-endian': 'numeric',\n 'day-nice': 'nice-day'\n };\n Object.keys(aliases).forEach(function (k) {\n return format[k] = format[aliases[k]];\n });\n\n var printFormat = function printFormat(s) {\n var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n\n //don't print anything if it's an invalid date\n if (s.isValid() !== true) {\n return '';\n } //support .format('month')\n\n\n if (format.hasOwnProperty(str)) {\n var out = format[str](s) || '';\n\n if (str !== 'json') {\n out = String(out);\n\n if (str !== 'ampm') {\n out = applyCaseFormat(out);\n }\n }\n\n return out;\n } //support '{hour}:{minute}' notation\n\n\n if (str.indexOf('{') !== -1) {\n var sections = /\\{(.+?)\\}/g;\n str = str.replace(sections, function (_, fmt) {\n fmt = fmt.toLowerCase().trim();\n\n if (format.hasOwnProperty(fmt)) {\n var _out = String(format[fmt](s));\n\n if (fmt !== 'ampm') {\n return applyCaseFormat(_out);\n }\n\n return _out;\n }\n\n return '';\n });\n return str;\n }\n\n return s.format('iso-short');\n };\n\n var format_1 = printFormat;\n\n var pad = fns.zeroPad;\n var formatTimezone = fns.formatTimezone; //parse this insane unix-time-templating thing, from the 19th century\n //http://unicode.org/reports/tr35/tr35-25.html#Date_Format_Patterns\n //time-symbols we support\n\n var mapping = {\n G: function G(s) {\n return s.era();\n },\n GG: function GG(s) {\n return s.era();\n },\n GGG: function GGG(s) {\n return s.era();\n },\n GGGG: function GGGG(s) {\n return s.era() === 'AD' ? 'Anno Domini' : 'Before Christ';\n },\n //year\n y: function y(s) {\n return s.year();\n },\n yy: function yy(s) {\n //last two chars\n return parseInt(String(s.year()).substr(2, 4), 10);\n },\n yyy: function yyy(s) {\n return s.year();\n },\n yyyy: function yyyy(s) {\n return s.year();\n },\n yyyyy: function yyyyy(s) {\n return '0' + s.year();\n },\n // u: (s) => {},//extended non-gregorian years\n //quarter\n Q: function Q(s) {\n return s.quarter();\n },\n QQ: function QQ(s) {\n return s.quarter();\n },\n QQQ: function QQQ(s) {\n return s.quarter();\n },\n QQQQ: function QQQQ(s) {\n return s.quarter();\n },\n //month\n M: function M(s) {\n return s.month() + 1;\n },\n MM: function MM(s) {\n return pad(s.month() + 1);\n },\n MMM: function MMM(s) {\n return s.format('month-short');\n },\n MMMM: function MMMM(s) {\n return s.format('month');\n },\n //week\n w: function w(s) {\n return s.week();\n },\n ww: function ww(s) {\n return pad(s.week());\n },\n //week of month\n // W: (s) => s.week(),\n //date of month\n d: function d(s) {\n return s.date();\n },\n dd: function dd(s) {\n return pad(s.date());\n },\n //date of year\n D: function D(s) {\n return s.dayOfYear();\n },\n DD: function DD(s) {\n return pad(s.dayOfYear());\n },\n DDD: function DDD(s) {\n return pad(s.dayOfYear(), 3);\n },\n // F: (s) => {},//date of week in month\n // g: (s) => {},//modified julian day\n //day\n E: function E(s) {\n return s.format('day-short');\n },\n EE: function EE(s) {\n return s.format('day-short');\n },\n EEE: function EEE(s) {\n return s.format('day-short');\n },\n EEEE: function EEEE(s) {\n return s.format('day');\n },\n EEEEE: function EEEEE(s) {\n return s.format('day')[0];\n },\n e: function e(s) {\n return s.day();\n },\n ee: function ee(s) {\n return s.day();\n },\n eee: function eee(s) {\n return s.format('day-short');\n },\n eeee: function eeee(s) {\n return s.format('day');\n },\n eeeee: function eeeee(s) {\n return s.format('day')[0];\n },\n //am/pm\n a: function a(s) {\n return s.ampm().toUpperCase();\n },\n aa: function aa(s) {\n return s.ampm().toUpperCase();\n },\n aaa: function aaa(s) {\n return s.ampm().toUpperCase();\n },\n aaaa: function aaaa(s) {\n return s.ampm().toUpperCase();\n },\n //hour\n h: function h(s) {\n return s.h12();\n },\n hh: function hh(s) {\n return pad(s.h12());\n },\n H: function H(s) {\n return s.hour();\n },\n HH: function HH(s) {\n return pad(s.hour());\n },\n // j: (s) => {},//weird hour format\n m: function m(s) {\n return s.minute();\n },\n mm: function mm(s) {\n return pad(s.minute());\n },\n s: function s(_s) {\n return _s.second();\n },\n ss: function ss(s) {\n return pad(s.second());\n },\n //milliseconds in the day\n A: function A(s) {\n return s.epoch - s.startOf('day').epoch;\n },\n //timezone\n z: function z(s) {\n return s.timezone().name;\n },\n zz: function zz(s) {\n return s.timezone().name;\n },\n zzz: function zzz(s) {\n return s.timezone().name;\n },\n zzzz: function zzzz(s) {\n return s.timezone().name;\n },\n Z: function Z(s) {\n return formatTimezone(s.timezone().current.offset);\n },\n ZZ: function ZZ(s) {\n return formatTimezone(s.timezone().current.offset);\n },\n ZZZ: function ZZZ(s) {\n return formatTimezone(s.timezone().current.offset);\n },\n ZZZZ: function ZZZZ(s) {\n return formatTimezone(s.timezone().current.offset, ':');\n }\n };\n\n var addAlias = function addAlias(_char, to, n) {\n var name = _char;\n var toName = to;\n\n for (var i = 0; i < n; i += 1) {\n mapping[name] = mapping[toName];\n name += _char;\n toName += to;\n }\n };\n\n addAlias('q', 'Q', 4);\n addAlias('L', 'M', 4);\n addAlias('Y', 'y', 4);\n addAlias('c', 'e', 4);\n addAlias('k', 'H', 2);\n addAlias('K', 'h', 2);\n addAlias('S', 's', 2);\n addAlias('v', 'z', 4);\n addAlias('V', 'Z', 4); // support unix-style escaping with ' character\n\n var escapeChars = function escapeChars(arr) {\n for (var i = 0; i < arr.length; i += 1) {\n if (arr[i] === \"'\") {\n // greedy-search for next apostrophe\n for (var o = i + 1; o < arr.length; o += 1) {\n if (arr[o]) {\n arr[i] += arr[o];\n }\n\n if (arr[o] === \"'\") {\n arr[o] = null;\n break;\n }\n\n arr[o] = null;\n }\n }\n }\n\n return arr.filter(function (ch) {\n return ch;\n });\n }; //combine consecutive chars, like 'yyyy' as one.\n\n\n var combineRepeated = function combineRepeated(arr) {\n for (var i = 0; i < arr.length; i += 1) {\n var c = arr[i]; // greedy-forward\n\n for (var o = i + 1; o < arr.length; o += 1) {\n if (arr[o] === c) {\n arr[i] += arr[o];\n arr[o] = null;\n } else {\n break;\n }\n }\n } // '' means one apostrophe\n\n\n arr = arr.filter(function (ch) {\n return ch;\n });\n arr = arr.map(function (str) {\n if (str === \"''\") {\n str = \"'\";\n }\n\n return str;\n });\n return arr;\n };\n\n var unixFmt = function unixFmt(s, str) {\n var arr = str.split(''); // support character escaping\n\n arr = escapeChars(arr); //combine 'yyyy' as string.\n\n arr = combineRepeated(arr);\n return arr.reduce(function (txt, c) {\n if (mapping[c] !== undefined) {\n txt += mapping[c](s) || '';\n } else {\n // 'unescape'\n if (/^'.{1,}'$/.test(c)) {\n c = c.replace(/'/g, '');\n }\n\n txt += c;\n }\n\n return txt;\n }, '');\n };\n\n var unixFmt_1 = unixFmt;\n\n var units$1 = ['year', 'season', 'quarter', 'month', 'week', 'day', 'quarterHour', 'hour', 'minute'];\n\n var doUnit = function doUnit(s, k) {\n var start = s.clone().startOf(k);\n var end = s.clone().endOf(k);\n var duration = end.epoch - start.epoch;\n var percent = (s.epoch - start.epoch) / duration;\n return parseFloat(percent.toFixed(2));\n }; //how far it is along, from 0-1\n\n\n var progress = function progress(s, unit) {\n if (unit) {\n unit = fns.normalize(unit);\n return doUnit(s, unit);\n }\n\n var obj = {};\n units$1.forEach(function (k) {\n obj[k] = doUnit(s, k);\n });\n return obj;\n };\n\n var progress_1 = progress;\n\n var nearest = function nearest(s, unit) {\n //how far have we gone?\n var prog = s.progress();\n unit = fns.normalize(unit); //fix camel-case for this one\n\n if (unit === 'quarterhour') {\n unit = 'quarterHour';\n }\n\n if (prog[unit] !== undefined) {\n // go forward one?\n if (prog[unit] > 0.5) {\n s = s.add(1, unit);\n } // go to start\n\n\n s = s.startOf(unit);\n } else if (s.silent === false) {\n console.warn(\"no known unit '\" + unit + \"'\");\n }\n\n return s;\n };\n\n var nearest_1 = nearest;\n\n //increment until dates are the same\n var climb = function climb(a, b, unit) {\n var i = 0;\n a = a.clone();\n\n while (a.isBefore(b)) {\n //do proper, expensive increment to catch all-the-tricks\n a = a.add(1, unit);\n i += 1;\n } //oops, we went too-far..\n\n\n if (a.isAfter(b, unit)) {\n i -= 1;\n }\n\n return i;\n }; // do a thurough +=1 on the unit, until they match\n // for speed-reasons, only used on day, month, week.\n\n\n var diffOne = function diffOne(a, b, unit) {\n if (a.isBefore(b)) {\n return climb(a, b, unit);\n } else {\n return climb(b, a, unit) * -1; //reverse it\n }\n };\n\n var one = diffOne;\n\n // 2020 - 2019 may be 1 year, or 0 years\n // - '1 year difference' means 366 days during a leap year\n\n var fastYear = function fastYear(a, b) {\n var years = b.year() - a.year(); // should we decrement it by 1?\n\n a = a.year(b.year());\n\n if (a.isAfter(b)) {\n years -= 1;\n }\n\n return years;\n }; // use a waterfall-method for computing a diff of any 'pre-knowable' units\n // compute years, then compute months, etc..\n // ... then ms-math for any very-small units\n\n\n var diff = function diff(a, b) {\n // an hour is always the same # of milliseconds\n // so these units can be 'pre-calculated'\n var msDiff = b.epoch - a.epoch;\n var obj = {\n milliseconds: msDiff,\n seconds: parseInt(msDiff / 1000, 10)\n };\n obj.minutes = parseInt(obj.seconds / 60, 10);\n obj.hours = parseInt(obj.minutes / 60, 10); //do the year\n\n var tmp = a.clone();\n obj.years = fastYear(tmp, b);\n tmp = a.add(obj.years, 'year'); //there's always 12 months in a year...\n\n obj.months = obj.years * 12;\n tmp = a.add(obj.months, 'month');\n obj.months += one(tmp, b, 'month'); // there's always atleast 52 weeks in a year..\n // (month * 4) isn't as close\n\n obj.weeks = obj.years * 52;\n tmp = a.add(obj.weeks, 'week');\n obj.weeks += one(tmp, b, 'week'); // there's always atleast 7 days in a week\n\n obj.days = obj.weeks * 7;\n tmp = a.add(obj.days, 'day');\n obj.days += one(tmp, b, 'day');\n return obj;\n };\n\n var waterfall = diff;\n\n var reverseDiff = function reverseDiff(obj) {\n Object.keys(obj).forEach(function (k) {\n obj[k] *= -1;\n });\n return obj;\n }; // this method counts a total # of each unit, between a, b.\n // '1 month' means 28 days in february\n // '1 year' means 366 days in a leap year\n\n\n var main = function main(a, b, unit) {\n b = fns.beADate(b, a); //reverse values, if necessary\n\n var reversed = false;\n\n if (a.isAfter(b)) {\n var tmp = a;\n a = b;\n b = tmp;\n reversed = true;\n } //compute them all (i know!)\n\n\n var obj = waterfall(a, b);\n\n if (reversed) {\n obj = reverseDiff(obj);\n } //return just the requested unit\n\n\n if (unit) {\n //make sure it's plural-form\n unit = fns.normalize(unit);\n\n if (/s$/.test(unit) !== true) {\n unit += 's';\n }\n\n if (unit === 'dates') {\n unit = 'days';\n }\n\n return obj[unit];\n }\n\n return obj;\n };\n\n var diff$1 = main;\n\n //our conceptual 'break-points' for each unit\n\n var qualifiers = {\n months: {\n almost: 10,\n over: 4\n },\n days: {\n almost: 25,\n over: 10\n },\n hours: {\n almost: 20,\n over: 8\n },\n minutes: {\n almost: 50,\n over: 20\n },\n seconds: {\n almost: 50,\n over: 20\n }\n }; //get number of hours/minutes... between the two dates\n\n function getDiff(a, b) {\n var isBefore = a.isBefore(b);\n var later = isBefore ? b : a;\n var earlier = isBefore ? a : b;\n earlier = earlier.clone();\n var diff = {\n years: 0,\n months: 0,\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0\n };\n Object.keys(diff).forEach(function (unit) {\n if (earlier.isSame(later, unit)) {\n return;\n }\n\n var max = earlier.diff(later, unit);\n earlier = earlier.add(max, unit);\n diff[unit] = max;\n }); //reverse it, if necessary\n\n if (isBefore) {\n Object.keys(diff).forEach(function (u) {\n if (diff[u] !== 0) {\n diff[u] *= -1;\n }\n });\n }\n\n return diff;\n } // Expects a plural unit arg\n\n\n function pluralize(value, unit) {\n if (value === 1) {\n unit = unit.slice(0, -1);\n }\n\n return value + ' ' + unit;\n } //create the human-readable diff between the two dates\n\n\n var since = function since(start, end) {\n end = fns.beADate(end, start);\n var diff = getDiff(start, end);\n var isNow = Object.keys(diff).every(function (u) {\n return !diff[u];\n });\n\n if (isNow === true) {\n return {\n diff: diff,\n rounded: 'now',\n qualified: 'now',\n precise: 'now'\n };\n }\n\n var rounded;\n var qualified;\n var precise;\n var englishValues = []; //go through each value and create its text-representation\n\n Object.keys(diff).forEach(function (unit, i, units) {\n var value = Math.abs(diff[unit]);\n\n if (value === 0) {\n return;\n }\n\n var englishValue = pluralize(value, unit);\n englishValues.push(englishValue);\n\n if (!rounded) {\n rounded = qualified = englishValue;\n\n if (i > 4) {\n return;\n } //is it a 'almost' something, etc?\n\n\n var nextUnit = units[i + 1];\n var nextValue = Math.abs(diff[nextUnit]);\n\n if (nextValue > qualifiers[nextUnit].almost) {\n rounded = pluralize(value + 1, unit);\n qualified = 'almost ' + rounded;\n } else if (nextValue > qualifiers[nextUnit].over) qualified = 'over ' + englishValue;\n }\n }); //make them into a string\n\n precise = englishValues.splice(0, 2).join(', '); //handle before/after logic\n\n if (start.isAfter(end) === true) {\n rounded += ' ago';\n qualified += ' ago';\n precise += ' ago';\n } else {\n rounded = 'in ' + rounded;\n qualified = 'in ' + qualified;\n precise = 'in ' + precise;\n }\n\n return {\n diff: diff,\n rounded: rounded,\n qualified: qualified,\n precise: precise\n };\n };\n\n var since_1 = since;\n\n //https://www.timeanddate.com/calendar/aboutseasons.html\n // Spring - from March 1 to May 31;\n // Summer - from June 1 to August 31;\n // Fall (autumn) - from September 1 to November 30; and,\n // Winter - from December 1 to February 28 (February 29 in a leap year).\n var seasons = {\n north: [['spring', 2, 1], //spring march 1\n ['summer', 5, 1], //june 1\n ['fall', 8, 1], //sept 1\n ['autumn', 8, 1], //sept 1\n ['winter', 11, 1] //dec 1\n ],\n south: [['fall', 2, 1], //march 1\n ['autumn', 2, 1], //march 1\n ['winter', 5, 1], //june 1\n ['spring', 8, 1], //sept 1\n ['summer', 11, 1] //dec 1\n ]\n };\n\n var quarters = [null, [0, 1], //jan 1\n [3, 1], //apr 1\n [6, 1], //july 1\n [9, 1] //oct 1\n ];\n\n var units$2 = {\n minute: function minute(s) {\n walk_1(s, {\n second: 0,\n millisecond: 0\n });\n return s;\n },\n quarterhour: function quarterhour(s) {\n var minute = s.minutes();\n\n if (minute >= 45) {\n s = s.minutes(45);\n } else if (minute >= 30) {\n s = s.minutes(30);\n } else if (minute >= 15) {\n s = s.minutes(15);\n } else {\n s = s.minutes(0);\n }\n\n walk_1(s, {\n second: 0,\n millisecond: 0\n });\n return s;\n },\n hour: function hour(s) {\n walk_1(s, {\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n day: function day(s) {\n walk_1(s, {\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n week: function week(s) {\n var original = s.clone();\n s = s.day(s._weekStart); //monday\n\n if (s.isAfter(original)) {\n s = s.subtract(1, 'week');\n }\n\n walk_1(s, {\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n month: function month(s) {\n walk_1(s, {\n date: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n quarter: function quarter(s) {\n var q = s.quarter();\n\n if (quarters[q]) {\n walk_1(s, {\n month: quarters[q][0],\n date: quarters[q][1],\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n }\n\n return s;\n },\n season: function season(s) {\n var current = s.season();\n var hem = 'north';\n\n if (s.hemisphere() === 'South') {\n hem = 'south';\n }\n\n for (var i = 0; i < seasons[hem].length; i++) {\n if (seasons[hem][i][0] === current) {\n //winter goes between years\n var year = s.year();\n\n if (current === 'winter' && s.month() < 3) {\n year -= 1;\n }\n\n walk_1(s, {\n year: year,\n month: seasons[hem][i][1],\n date: seasons[hem][i][2],\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n }\n }\n\n return s;\n },\n year: function year(s) {\n walk_1(s, {\n month: 0,\n date: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n decade: function decade(s) {\n s = s.startOf('year');\n var year = s.year();\n var decade = parseInt(year / 10, 10) * 10;\n s = s.year(decade);\n return s;\n },\n century: function century(s) {\n s = s.startOf('year');\n var year = s.year(); // near 0AD goes '-1 | +1'\n\n var decade = parseInt(year / 100, 10) * 100;\n s = s.year(decade);\n return s;\n }\n };\n units$2.date = units$2.day;\n\n var startOf = function startOf(a, unit) {\n var s = a.clone();\n unit = fns.normalize(unit);\n\n if (units$2[unit]) {\n return units$2[unit](s);\n }\n\n if (unit === 'summer' || unit === 'winter') {\n s = s.season(unit);\n return units$2.season(s);\n }\n\n return s;\n }; //piggy-backs off startOf\n\n\n var endOf = function endOf(a, unit) {\n var s = a.clone();\n unit = fns.normalize(unit);\n\n if (units$2[unit]) {\n // go to beginning, go to next one, step back 1ms\n s = units$2[unit](s); // startof\n\n s = s.add(1, unit);\n s = s.subtract(1, 'millisecond');\n return s;\n }\n\n return s;\n };\n\n var startOf_1 = {\n startOf: startOf,\n endOf: endOf\n };\n\n var isDay = function isDay(unit) {\n if (days[\"short\"]().find(function (s) {\n return s === unit;\n })) {\n return true;\n }\n\n if (days[\"long\"]().find(function (s) {\n return s === unit;\n })) {\n return true;\n }\n\n return false;\n }; // return a list of the weeks/months/days between a -> b\n // returns spacetime objects in the timezone of the input\n\n\n var every = function every(start) {\n var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var end = arguments.length > 2 ? arguments[2] : undefined;\n\n if (!unit || !end) {\n return [];\n } //cleanup unit param\n\n\n unit = fns.normalize(unit); //cleanup to param\n\n end = start.clone().set(end); //swap them, if they're backwards\n\n if (start.isAfter(end)) {\n var tmp = start;\n start = end;\n end = tmp;\n } //support 'every wednesday'\n\n\n var d = start.clone();\n\n if (isDay(unit)) {\n d = d.next(unit);\n unit = 'week';\n } else {\n d = d.next(unit);\n } //okay, actually start doing it\n\n\n var result = [];\n\n while (d.isBefore(end)) {\n result.push(d);\n d = d.add(1, unit);\n }\n\n return result;\n };\n\n var every_1 = every;\n\n var parseDst = function parseDst(dst) {\n if (!dst) {\n return [];\n }\n\n return dst.split('->');\n };\n\n var titleCase = function titleCase(str) {\n str = str[0].toUpperCase() + str.substr(1);\n str = str.replace(/\\/gmt/, '/GMT');\n str = str.replace(/[\\/_]([a-z])/gi, function (s) {\n return s.toUpperCase();\n });\n return str;\n }; //get metadata about this timezone\n\n\n var timezone = function timezone(s) {\n var zones = s.timezones;\n var tz = s.tz;\n\n if (zones.hasOwnProperty(tz) === false) {\n tz = find(s.tz, zones);\n }\n\n if (tz === null) {\n if (s.silent === false) {\n console.warn(\"Warn: could not find given or local timezone - '\" + s.tz + \"'\");\n }\n\n return {\n current: {\n epochShift: 0\n }\n };\n }\n\n var found = zones[tz];\n var result = {\n name: titleCase(tz),\n hasDst: Boolean(found.dst),\n default_offset: found.offset,\n //do north-hemisphere version as default (sorry!)\n hemisphere: found.hem === 's' ? 'South' : 'North',\n current: {}\n };\n\n if (result.hasDst) {\n var arr = parseDst(found.dst);\n result.change = {\n start: arr[0],\n back: arr[1]\n };\n } //find the offsets for summer/winter times\n //(these variable names are north-centric)\n\n\n var summer = found.offset; // (july)\n\n var winter = summer; // (january) assume it's the same for now\n\n if (result.hasDst === true) {\n if (result.hemisphere === 'North') {\n winter = summer - 1;\n } else {\n //southern hemisphere\n winter = found.offset + 1;\n }\n } //find out which offset to use right now\n //use 'summer' time july-time\n\n\n if (result.hasDst === false) {\n result.current.offset = summer;\n result.current.isDST = false;\n } else if (summerTime(s.epoch, result.change.start, result.change.back, summer, winter) === true) {\n result.current.offset = summer;\n result.current.isDST = result.hemisphere === 'North'; //dst 'on' in winter in north\n } else {\n //use 'winter' january-time\n result.current.offset = winter;\n result.current.isDST = result.hemisphere === 'South'; //dst 'on' in summer in south\n }\n\n return result;\n };\n\n var timezone_1 = timezone;\n\n var units$3 = ['century', 'decade', 'year', 'month', 'date', 'day', 'hour', 'minute', 'second', 'millisecond']; //the spacetime instance methods (also, the API)\n\n var methods = {\n set: function set(input$1, tz) {\n var s = this.clone();\n s = input(s, input$1, null);\n\n if (tz) {\n this.tz = find(tz);\n }\n\n return s;\n },\n timezone: function timezone() {\n return timezone_1(this);\n },\n isDST: function isDST() {\n return timezone_1(this).current.isDST;\n },\n hasDST: function hasDST() {\n return timezone_1(this).hasDst;\n },\n offset: function offset() {\n return timezone_1(this).current.offset * 60;\n },\n hemisphere: function hemisphere() {\n return timezone_1(this).hemisphere;\n },\n format: function format(fmt) {\n return format_1(this, fmt);\n },\n unixFmt: function unixFmt(fmt) {\n return unixFmt_1(this, fmt);\n },\n startOf: function startOf(unit) {\n return startOf_1.startOf(this, unit);\n },\n endOf: function endOf(unit) {\n return startOf_1.endOf(this, unit);\n },\n leapYear: function leapYear() {\n var year = this.year();\n return fns.isLeapYear(year);\n },\n progress: function progress(unit) {\n return progress_1(this, unit);\n },\n nearest: function nearest(unit) {\n return nearest_1(this, unit);\n },\n diff: function diff(d, unit) {\n return diff$1(this, d, unit);\n },\n since: function since(d) {\n if (!d) {\n d = this.clone().set();\n }\n\n return since_1(this, d);\n },\n next: function next(unit) {\n var s = this.add(1, unit);\n return s.startOf(unit);\n },\n //the start of the previous year/week/century\n last: function last(unit) {\n var s = this.subtract(1, unit);\n return s.startOf(unit);\n },\n isValid: function isValid() {\n //null/undefined epochs\n if (!this.epoch && this.epoch !== 0) {\n return false;\n }\n\n return !isNaN(this.d.getTime());\n },\n //travel to this timezone\n \"goto\": function goto(tz) {\n var s = this.clone();\n s.tz = find(tz, s.timezones); //science!\n\n return s;\n },\n //get each week/month/day between a -> b\n every: function every(unit, to) {\n return every_1(this, unit, to);\n },\n isAwake: function isAwake() {\n var hour = this.hour(); //10pm -> 8am\n\n if (hour < 8 || hour > 22) {\n return false;\n }\n\n return true;\n },\n isAsleep: function isAsleep() {\n return !this.isAwake();\n },\n //pretty-printing\n log: function log() {\n console.log('');\n console.log(format_1(this, 'nice-short'));\n return this;\n },\n logYear: function logYear() {\n console.log('');\n console.log(format_1(this, 'full-short'));\n return this;\n },\n json: function json() {\n var _this = this;\n\n return units$3.reduce(function (h, unit) {\n h[unit] = _this[unit]();\n return h;\n }, {});\n },\n debug: function debug() {\n var tz = this.timezone();\n var date = this.format('MM') + ' ' + this.format('date-ordinal') + ' ' + this.year();\n date += '\\n - ' + this.format('time');\n console.log('\\n\\n', date + '\\n - ' + tz.name + ' (' + tz.current.offset + ')');\n return this;\n },\n //alias of 'since' but opposite - like moment.js\n from: function from(d) {\n d = this.clone().set(d);\n return d.since(this);\n },\n fromNow: function fromNow() {\n var d = this.clone().set(Date.now());\n return d.since(this);\n },\n weekStart: function weekStart(input) {\n //accept a number directly\n if (typeof input === 'number') {\n this._weekStart = input;\n return this;\n }\n\n if (typeof input === 'string') {\n // accept 'wednesday'\n input = input.toLowerCase().trim();\n var num = days[\"short\"]().indexOf(input);\n\n if (num === -1) {\n num = days[\"long\"]().indexOf(input);\n }\n\n if (num === -1) {\n num = 1; //go back to default\n }\n\n this._weekStart = num;\n } else {\n console.warn('Spacetime Error: Cannot understand .weekStart() input:', input);\n }\n\n return this;\n }\n }; // aliases\n\n methods.inDST = methods.isDST;\n methods.round = methods.nearest;\n methods.each = methods.every;\n var methods_1 = methods;\n\n //these methods wrap around them.\n\n var isLeapYear$1 = fns.isLeapYear;\n\n var validate = function validate(n) {\n //handle number as a string\n if (typeof n === 'string') {\n n = parseInt(n, 10);\n }\n\n return n;\n };\n\n var order = ['year', 'month', 'date', 'hour', 'minute', 'second', 'millisecond']; //reduce hostile micro-changes when moving dates by millisecond\n\n var confirm = function confirm(s, tmp, unit) {\n var n = order.indexOf(unit);\n var arr = order.slice(n, order.length);\n\n for (var i = 0; i < arr.length; i++) {\n var want = tmp[arr[i]]();\n s[arr[i]](want);\n }\n\n return s;\n };\n\n var set = {\n milliseconds: function milliseconds(s, n) {\n n = validate(n);\n var current = s.millisecond();\n var diff = current - n; //milliseconds to shift by\n\n return s.epoch - diff;\n },\n seconds: function seconds(s, n) {\n n = validate(n);\n var diff = s.second() - n;\n var shift = diff * milliseconds.second;\n return s.epoch - shift;\n },\n minutes: function minutes(s, n) {\n n = validate(n);\n var old = s.clone();\n var diff = s.minute() - n;\n var shift = diff * milliseconds.minute;\n s.epoch -= shift; // check against a screw-up\n // if (old.hour() != s.hour()) {\n // walkTo(old, {\n // minute: n\n // })\n // return old.epoch\n // }\n\n confirm(s, old, 'second');\n return s.epoch;\n },\n hours: function hours(s, n) {\n n = validate(n);\n\n if (n >= 24) {\n n = 24;\n } else if (n < 0) {\n n = 0;\n }\n\n var old = s.clone();\n var diff = s.hour() - n;\n var shift = diff * milliseconds.hour;\n s.epoch -= shift; // oops, did we change the day?\n\n if (s.date() !== old.date()) {\n s = old.clone();\n\n if (diff > 1) {\n diff -= 1;\n }\n\n if (diff < 1) {\n diff += 1;\n }\n\n shift = diff * milliseconds.hour;\n s.epoch -= shift;\n }\n\n walk_1(s, {\n hour: n\n });\n confirm(s, old, 'minute');\n return s.epoch;\n },\n //support setting time by '4:25pm' - this isn't very-well developed..\n time: function time(s, str) {\n var m = str.match(/([0-9]{1,2})[:h]([0-9]{1,2})(:[0-9]{1,2})? ?(am|pm)?/);\n\n if (!m) {\n //fallback to support just '2am'\n m = str.match(/([0-9]{1,2}) ?(am|pm)/);\n\n if (!m) {\n return s.epoch;\n }\n\n m.splice(2, 0, '0'); //add implicit 0 minutes\n\n m.splice(3, 0, ''); //add implicit seconds\n }\n\n var h24 = false;\n var hour = parseInt(m[1], 10);\n var minute = parseInt(m[2], 10);\n\n if (hour > 12) {\n h24 = true;\n } //make the hour into proper 24h time\n\n\n if (h24 === false) {\n if (m[4] === 'am' && hour === 12) {\n //12am is midnight\n hour = 0;\n }\n\n if (m[4] === 'pm' && hour < 12) {\n //12pm is noon\n hour += 12;\n }\n } // handle seconds\n\n\n m[3] = m[3] || '';\n m[3] = m[3].replace(/:/, '');\n var sec = parseInt(m[3], 10) || 0;\n s = s.hour(hour);\n s = s.minute(minute);\n s = s.second(sec);\n s = s.millisecond(0);\n return s.epoch;\n },\n date: function date(s, n) {\n n = validate(n); //avoid setting february 31st\n\n if (n > 28) {\n var month = s.month();\n var max = monthLengths_1[month]; // support leap day in february\n\n if (month === 1 && n === 29 && isLeapYear$1(s.year())) {\n max = 29;\n }\n\n if (n > max) {\n n = max;\n }\n } //avoid setting < 0\n\n\n if (n <= 0) {\n n = 1;\n }\n\n walk_1(s, {\n date: n\n });\n return s.epoch;\n },\n //this one's tricky\n month: function month(s, n) {\n if (typeof n === 'string') {\n n = months.mapping()[n.toLowerCase()];\n }\n\n n = validate(n); //don't go past december\n\n if (n >= 12) {\n n = 11;\n }\n\n if (n <= 0) {\n n = 0;\n }\n\n var date = s.date(); //there's no 30th of february, etc.\n\n if (date > monthLengths_1[n]) {\n //make it as close as we can..\n date = monthLengths_1[n];\n }\n\n walk_1(s, {\n month: n,\n date: date\n });\n return s.epoch;\n },\n year: function year(s, n) {\n // support '97\n if (typeof n === 'string' && /^'[0-9]{2}$/.test(n)) {\n n = n.replace(/'/, '').trim();\n n = Number(n); // '89 is 1989\n\n if (n > 30) {\n //change this in 10y\n n = 1900 + n;\n } else {\n // '12 is 2012\n n = 2000 + n;\n }\n }\n\n n = validate(n);\n walk_1(s, {\n year: n\n });\n return s.epoch;\n },\n dayOfYear: function dayOfYear(s, n) {\n n = validate(n);\n var old = s.clone();\n n -= 1; //days are 1-based\n\n if (n <= 0) {\n n = 0;\n } else if (n >= 365) {\n n = 364;\n }\n\n s = s.startOf('year');\n s = s.add(n, 'day');\n confirm(s, old, 'hour');\n return s.epoch;\n }\n };\n\n var methods$1 = {\n millisecond: function millisecond(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.milliseconds(s, num);\n return s;\n }\n\n return this.d.getMilliseconds();\n },\n second: function second(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.seconds(s, num);\n return s;\n }\n\n return this.d.getSeconds();\n },\n minute: function minute(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.minutes(s, num);\n return s;\n }\n\n return this.d.getMinutes();\n },\n hour: function hour(num) {\n var d = this.d;\n\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.hours(s, num);\n return s;\n }\n\n return d.getHours();\n },\n //'3:30' is 3.5\n hourFloat: function hourFloat(num) {\n if (num !== undefined) {\n var s = this.clone();\n\n var _minute = num % 1;\n\n _minute = _minute * 60;\n\n var _hour = parseInt(num, 10);\n\n s.epoch = set.hours(s, _hour);\n s.epoch = set.minutes(s, _minute);\n return s;\n }\n\n var d = this.d;\n var hour = d.getHours();\n var minute = d.getMinutes();\n minute = minute / 60;\n return hour + minute;\n },\n // hour in 12h format\n hour12: function hour12(str) {\n var d = this.d;\n\n if (str !== undefined) {\n var s = this.clone();\n str = '' + str;\n var m = str.match(/^([0-9]+)(am|pm)$/);\n\n if (m) {\n var hour = parseInt(m[1], 10);\n\n if (m[2] === 'pm') {\n hour += 12;\n }\n\n s.epoch = set.hours(s, hour);\n }\n\n return s;\n } //get the hour\n\n\n var hour12 = d.getHours();\n\n if (hour12 > 12) {\n hour12 = hour12 - 12;\n }\n\n if (hour12 === 0) {\n hour12 = 12;\n }\n\n return hour12;\n },\n //some ambiguity here with 12/24h\n time: function time(str) {\n if (str !== undefined) {\n var s = this.clone();\n str = str.toLowerCase().trim();\n s.epoch = set.time(s, str);\n return s;\n }\n\n return \"\".concat(this.h12(), \":\").concat(fns.zeroPad(this.minute())).concat(this.ampm());\n },\n // either 'am' or 'pm'\n ampm: function ampm(input) {\n var which = 'am';\n var hour = this.hour();\n\n if (hour >= 12) {\n which = 'pm';\n }\n\n if (typeof input !== 'string') {\n return which;\n } //okay, we're doing a setter\n\n\n var s = this.clone();\n input = input.toLowerCase().trim(); //ampm should never change the day\n // - so use `.hour(n)` instead of `.minus(12,'hour')`\n\n if (hour >= 12 && input === 'am') {\n //noon is 12pm\n hour -= 12;\n return s.hour(hour);\n }\n\n if (hour < 12 && input === 'pm') {\n hour += 12;\n return s.hour(hour);\n }\n\n return s;\n },\n //some hard-coded times of day, like 'noon'\n dayTime: function dayTime(str) {\n if (str !== undefined) {\n var times = {\n morning: '7:00am',\n breakfast: '7:00am',\n noon: '12:00am',\n lunch: '12:00pm',\n afternoon: '2:00pm',\n evening: '6:00pm',\n dinner: '6:00pm',\n night: '11:00pm',\n midnight: '23:59pm'\n };\n var s = this.clone();\n str = str || '';\n str = str.toLowerCase();\n\n if (times.hasOwnProperty(str) === true) {\n s = s.time(times[str]);\n }\n\n return s;\n }\n\n var h = this.hour();\n\n if (h < 6) {\n return 'night';\n }\n\n if (h < 12) {\n //until noon\n return 'morning';\n }\n\n if (h < 17) {\n //until 5pm\n return 'afternoon';\n }\n\n if (h < 22) {\n //until 10pm\n return 'evening';\n }\n\n return 'night';\n },\n //parse a proper iso string\n iso: function iso(num) {\n if (num !== undefined) {\n return this.set(num);\n }\n\n return this.format('iso');\n }\n };\n var _01Time = methods$1;\n\n var methods$2 = {\n // # day in the month\n date: function date(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.date(s, num);\n return s;\n }\n\n return this.d.getDate();\n },\n //like 'wednesday' (hard!)\n day: function day(input) {\n if (input === undefined) {\n return this.d.getDay();\n }\n\n var original = this.clone();\n var want = input; // accept 'wednesday'\n\n if (typeof input === 'string') {\n input = input.toLowerCase();\n\n if (days.aliases.hasOwnProperty(input)) {\n want = days.aliases[input];\n } else {\n want = days[\"short\"]().indexOf(input);\n\n if (want === -1) {\n want = days[\"long\"]().indexOf(input);\n }\n }\n } //move approx\n\n\n var day = this.d.getDay();\n var diff = day - want;\n var s = this.subtract(diff, 'days'); //tighten it back up\n\n walk_1(s, {\n hour: original.hour(),\n minute: original.minute(),\n second: original.second()\n });\n return s;\n },\n //these are helpful name-wrappers\n dayName: function dayName(input) {\n if (input === undefined) {\n return days[\"long\"]()[this.day()];\n }\n\n var s = this.clone();\n s = s.day(input);\n return s;\n },\n //either name or number\n month: function month(input) {\n if (input !== undefined) {\n var s = this.clone();\n s.epoch = set.month(s, input);\n return s;\n }\n\n return this.d.getMonth();\n }\n };\n var _02Date = methods$2;\n\n var clearMinutes = function clearMinutes(s) {\n s = s.minute(0);\n s = s.second(0);\n s = s.millisecond(1);\n return s;\n };\n\n var methods$3 = {\n // day 0-366\n dayOfYear: function dayOfYear(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.dayOfYear(s, num);\n return s;\n } //days since newyears - jan 1st is 1, jan 2nd is 2...\n\n\n var sum = 0;\n var month = this.d.getMonth();\n var tmp; //count the num days in each month\n\n for (var i = 1; i <= month; i++) {\n tmp = new Date();\n tmp.setDate(1);\n tmp.setFullYear(this.d.getFullYear()); //the year matters, because leap-years\n\n tmp.setHours(1);\n tmp.setMinutes(1);\n tmp.setMonth(i);\n tmp.setHours(-2); //the last day of the month\n\n sum += tmp.getDate();\n }\n\n return sum + this.d.getDate();\n },\n //since the start of the year\n week: function week(num) {\n // week-setter\n if (num !== undefined) {\n var s = this.clone();\n s = s.month(0);\n s = s.date(1);\n s = s.day('monday');\n s = clearMinutes(s); //first week starts first Thurs in Jan\n // so mon dec 28th is 1st week\n // so mon dec 29th is not the week\n\n if (s.monthName() === 'december' && s.date() >= 28) {\n s = s.add(1, 'week');\n }\n\n num -= 1; //1-based\n\n s = s.add(num, 'weeks');\n return s;\n } //find-out which week it is\n\n\n var tmp = this.clone();\n tmp = tmp.month(0);\n tmp = tmp.date(1);\n tmp = clearMinutes(tmp);\n tmp = tmp.day('monday'); //don't go into last-year\n\n if (tmp.monthName() === 'december' && tmp.date() >= 28) {\n tmp = tmp.add(1, 'week');\n } // is first monday the 1st?\n\n\n var toAdd = 1;\n\n if (tmp.date() === 1) {\n toAdd = 0;\n }\n\n tmp = tmp.minus(1, 'second');\n var thisOne = this.epoch; //if the week technically hasn't started yet\n\n if (tmp.epoch > thisOne) {\n return 1;\n } //speed it up, if we can\n\n\n var i = 0;\n var skipWeeks = this.month() * 4;\n tmp.epoch += milliseconds.week * skipWeeks;\n i += skipWeeks;\n\n for (; i < 52; i++) {\n if (tmp.epoch > thisOne) {\n return i + toAdd;\n }\n\n tmp = tmp.add(1, 'week');\n }\n\n return 52;\n },\n //'january'\n monthName: function monthName(input) {\n if (input === undefined) {\n return months[\"long\"]()[this.month()];\n }\n\n var s = this.clone();\n s = s.month(input);\n return s;\n },\n //q1, q2, q3, q4\n quarter: function quarter(num) {\n if (num !== undefined) {\n if (typeof num === 'string') {\n num = num.replace(/^q/i, '');\n num = parseInt(num, 10);\n }\n\n if (quarters[num]) {\n var s = this.clone();\n var _month = quarters[num][0];\n s = s.month(_month);\n s = s.date(1);\n s = s.startOf('day');\n return s;\n }\n }\n\n var month = this.d.getMonth();\n\n for (var i = 1; i < quarters.length; i++) {\n if (month < quarters[i][0]) {\n return i - 1;\n }\n }\n\n return 4;\n },\n //spring, summer, winter, fall\n season: function season(input) {\n var hem = 'north';\n\n if (this.hemisphere() === 'South') {\n hem = 'south';\n }\n\n if (input !== undefined) {\n var s = this.clone();\n\n for (var i = 0; i < seasons[hem].length; i++) {\n if (input === seasons[hem][i][0]) {\n s = s.month(seasons[hem][i][1]);\n s = s.date(1);\n s = s.startOf('day');\n }\n }\n\n return s;\n }\n\n var month = this.d.getMonth();\n\n for (var _i = 0; _i < seasons[hem].length - 1; _i++) {\n if (month >= seasons[hem][_i][1] && month < seasons[hem][_i + 1][1]) {\n return seasons[hem][_i][0];\n }\n }\n\n return 'winter';\n },\n //the year number\n year: function year(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.year(s, num);\n return s;\n }\n\n return this.d.getFullYear();\n },\n //bc/ad years\n era: function era(str) {\n if (str !== undefined) {\n var s = this.clone();\n str = str.toLowerCase(); //TODO: there is no year-0AD i think. may have off-by-1 error here\n\n var year = s.d.getFullYear(); //make '1992' into 1992bc..\n\n if (str === 'bc' && year > 0) {\n s.epoch = set.year(s, year * -1);\n } //make '1992bc' into '1992'\n\n\n if (str === 'ad' && year < 0) {\n s.epoch = set.year(s, year * -1);\n }\n\n return s;\n }\n\n if (this.d.getFullYear() < 0) {\n return 'BC';\n }\n\n return 'AD';\n },\n // 2019 -> 2010\n decade: function decade(input) {\n if (input !== undefined) {\n input = String(input);\n input = input.replace(/([0-9])'?s$/, '$1'); //1950's\n\n input = input.replace(/([0-9])(th|rd|st|nd)/, '$1'); //fix ordinals\n\n if (!input) {\n console.warn('Spacetime: Invalid decade input');\n return this;\n } // assume 20th century?? for '70s'.\n\n\n if (input.length === 2 && /[0-9][0-9]/.test(input)) {\n input = '19' + input;\n }\n\n var year = Number(input);\n\n if (isNaN(year)) {\n return this;\n } // round it down to the decade\n\n\n year = Math.floor(year / 10) * 10;\n return this.year(year); //.startOf('decade')\n }\n\n return this.startOf('decade').year();\n },\n // 1950 -> 19+1\n century: function century(input) {\n if (input !== undefined) {\n if (typeof input === 'string') {\n input = input.replace(/([0-9])(th|rd|st|nd)/, '$1'); //fix ordinals\n\n input = input.replace(/([0-9]+) ?(b\\.?c\\.?|a\\.?d\\.?)/i, function (a, b, c) {\n if (c.match(/b\\.?c\\.?/i)) {\n b = '-' + b;\n }\n\n return b;\n });\n input = input.replace(/c$/, ''); //20thC\n }\n\n var year = Number(input);\n\n if (isNaN(input)) {\n console.warn('Spacetime: Invalid century input');\n return this;\n } // there is no century 0\n\n\n if (year === 0) {\n year = 1;\n }\n\n if (year >= 0) {\n year = (year - 1) * 100;\n } else {\n year = (year + 1) * 100;\n }\n\n return this.year(year);\n } // century getter\n\n\n var num = this.startOf('century').year();\n num = Math.floor(num / 100);\n\n if (num < 0) {\n return num - 1;\n }\n\n return num + 1;\n },\n // 2019 -> 2+1\n millenium: function millenium(input) {\n if (input !== undefined) {\n if (typeof input === 'string') {\n input = input.replace(/([0-9])(th|rd|st|nd)/, '$1'); //fix ordinals\n\n input = Number(input);\n\n if (isNaN(input)) {\n console.warn('Spacetime: Invalid millenium input');\n return this;\n }\n }\n\n if (input > 0) {\n input -= 1;\n }\n\n var year = input * 1000; // there is no year 0\n\n if (year === 0) {\n year = 1;\n }\n\n return this.year(year);\n } // get the current millenium\n\n\n var num = Math.floor(this.year() / 1000);\n\n if (num >= 0) {\n num += 1;\n }\n\n return num;\n }\n };\n var _03Year = methods$3;\n\n var methods$4 = Object.assign({}, _01Time, _02Date, _03Year); //aliases\n\n methods$4.milliseconds = methods$4.millisecond;\n methods$4.seconds = methods$4.second;\n methods$4.minutes = methods$4.minute;\n methods$4.hours = methods$4.hour;\n methods$4.hour24 = methods$4.hour;\n methods$4.h12 = methods$4.hour12;\n methods$4.h24 = methods$4.hour24;\n methods$4.days = methods$4.day;\n\n var addMethods = function addMethods(Space) {\n //hook the methods into prototype\n Object.keys(methods$4).forEach(function (k) {\n Space.prototype[k] = methods$4[k];\n });\n };\n\n var query = addMethods;\n\n var isLeapYear$2 = fns.isLeapYear;\n\n var getMonthLength = function getMonthLength(month, year) {\n if (month === 1 && isLeapYear$2(year)) {\n return 29;\n }\n\n return monthLengths_1[month];\n }; //month is the one thing we 'model/compute'\n //- because ms-shifting can be off by enough\n\n\n var rollMonth = function rollMonth(want, old) {\n //increment year\n if (want.month > 0) {\n var years = parseInt(want.month / 12, 10);\n want.year = old.year() + years;\n want.month = want.month % 12;\n } else if (want.month < 0) {\n //decrement year\n var _years = Math.floor(Math.abs(want.month) / 13, 10);\n\n _years = Math.abs(_years) + 1;\n want.year = old.year() - _years; //ignore extras\n\n want.month = want.month % 12;\n want.month = want.month + 12;\n\n if (want.month === 12) {\n want.month = 0;\n }\n }\n\n return want;\n }; // briefly support day=-2 (this does not need to be perfect.)\n\n\n var rollDaysDown = function rollDaysDown(want, old, sum) {\n want.year = old.year();\n want.month = old.month();\n var date = old.date();\n want.date = date - Math.abs(sum);\n\n while (want.date < 1) {\n want.month -= 1;\n\n if (want.month < 0) {\n want.month = 11;\n want.year -= 1;\n }\n\n var max = getMonthLength(want.month, want.year);\n want.date += max;\n }\n\n return want;\n }; // briefly support day=33 (this does not need to be perfect.)\n\n\n var rollDaysUp = function rollDaysUp(want, old, sum) {\n var year = old.year();\n var month = old.month();\n var max = getMonthLength(month, year);\n\n while (sum > max) {\n sum -= max;\n month += 1;\n\n if (month >= 12) {\n month -= 12;\n year += 1;\n }\n\n max = getMonthLength(month, year);\n }\n\n want.month = month;\n want.date = sum;\n return want;\n };\n\n var _model = {\n months: rollMonth,\n days: rollDaysUp,\n daysBack: rollDaysDown\n };\n\n // but briefly:\n // millisecond-math, and some post-processing covers most-things\n // we 'model' the calendar here only a little bit\n // and that usually works-out...\n\n var order$1 = ['millisecond', 'second', 'minute', 'hour', 'date', 'month'];\n var keep = {\n second: order$1.slice(0, 1),\n minute: order$1.slice(0, 2),\n quarterhour: order$1.slice(0, 2),\n hour: order$1.slice(0, 3),\n date: order$1.slice(0, 4),\n month: order$1.slice(0, 4),\n quarter: order$1.slice(0, 4),\n season: order$1.slice(0, 4),\n year: order$1,\n decade: order$1,\n century: order$1\n };\n keep.week = keep.hour;\n keep.season = keep.date;\n keep.quarter = keep.date; // Units need to be dst adjuested\n\n var dstAwareUnits = {\n year: true,\n quarter: true,\n season: true,\n month: true,\n week: true,\n day: true\n };\n var keepDate = {\n month: true,\n quarter: true,\n season: true,\n year: true\n };\n\n var addMethods$1 = function addMethods(SpaceTime) {\n SpaceTime.prototype.add = function (num, unit) {\n var s = this.clone();\n\n if (!unit || num === 0) {\n return s; //don't bother\n }\n\n var old = this.clone();\n unit = fns.normalize(unit);\n\n if (unit === 'millisecond') {\n s.epoch += num;\n return s;\n } // support 'fortnight' alias\n\n\n if (unit === 'fortnight') {\n num *= 2;\n unit = 'week';\n } //move forward by the estimated milliseconds (rough)\n\n\n if (milliseconds[unit]) {\n s.epoch += milliseconds[unit] * num;\n } else if (unit === 'week') {\n s.epoch += milliseconds.day * (num * 7);\n } else if (unit === 'quarter' || unit === 'season') {\n s.epoch += milliseconds.month * (num * 3);\n } else if (unit === 'quarterhour') {\n s.epoch += milliseconds.minute * 15 * num;\n } //now ensure our milliseconds/etc are in-line\n\n\n var want = {};\n\n if (keep[unit]) {\n keep[unit].forEach(function (u) {\n want[u] = old[u]();\n });\n }\n\n if (dstAwareUnits[unit]) {\n var diff = old.timezone().current.offset - s.timezone().current.offset;\n s.epoch += diff * 3600 * 1000;\n } //ensure month/year has ticked-over\n\n\n if (unit === 'month') {\n want.month = old.month() + num; //month is the one unit we 'model' directly\n\n want = _model.months(want, old);\n } //support coercing a week, too\n\n\n if (unit === 'week') {\n var sum = old.date() + num * 7;\n\n if (sum <= 28 && sum > 1) {\n want.date = sum;\n }\n } //support 25-hour day-changes on dst-changes\n else if (unit === 'date') {\n if (num < 0) {\n want = _model.daysBack(want, old, num);\n } else {\n //specify a naive date number, if it's easy to do...\n var _sum = old.date() + num; // ok, model this one too\n\n\n want = _model.days(want, old, _sum);\n } //manually punt it if we haven't moved at all..\n\n\n if (num !== 0 && old.isSame(s, 'day')) {\n want.date = old.date() + num;\n }\n } // ensure a quarter is 3 months over\n else if (unit === 'quarter') {\n want.month = old.month() + num * 3;\n want.year = old.year(); // handle rollover\n\n if (want.month < 0) {\n var years = Math.floor(want.month / 12);\n var remainder = want.month + Math.abs(years) * 12;\n want.month = remainder;\n want.year += years;\n } else if (want.month >= 12) {\n var _years = Math.floor(want.month / 12);\n\n want.month = want.month % 12;\n want.year += _years;\n }\n\n want.date = old.date();\n } //ensure year has changed (leap-years)\n else if (unit === 'year') {\n var wantYear = old.year() + num;\n var haveYear = s.year();\n\n if (haveYear < wantYear) {\n s.epoch += milliseconds.day;\n } else if (haveYear > wantYear) {\n s.epoch += milliseconds.day;\n }\n } //these are easier\n else if (unit === 'decade') {\n want.year = s.year() + 10;\n } else if (unit === 'century') {\n want.year = s.year() + 100;\n } //keep current date, unless the month doesn't have it.\n\n\n if (keepDate[unit]) {\n var max = monthLengths_1[want.month];\n want.date = old.date();\n\n if (want.date > max) {\n want.date = max;\n }\n }\n\n if (Object.keys(want).length > 1) {\n walk_1(s, want);\n }\n\n return s;\n }; //subtract is only add *-1\n\n\n SpaceTime.prototype.subtract = function (num, unit) {\n var s = this.clone();\n return s.add(num * -1, unit);\n }; //add aliases\n\n\n SpaceTime.prototype.minus = SpaceTime.prototype.subtract;\n SpaceTime.prototype.plus = SpaceTime.prototype.add;\n };\n\n var add = addMethods$1;\n\n //make a string, for easy comparison between dates\n var print = {\n millisecond: function millisecond(s) {\n return s.epoch;\n },\n second: function second(s) {\n return [s.year(), s.month(), s.date(), s.hour(), s.minute(), s.second()].join('-');\n },\n minute: function minute(s) {\n return [s.year(), s.month(), s.date(), s.hour(), s.minute()].join('-');\n },\n hour: function hour(s) {\n return [s.year(), s.month(), s.date(), s.hour()].join('-');\n },\n day: function day(s) {\n return [s.year(), s.month(), s.date()].join('-');\n },\n week: function week(s) {\n return [s.year(), s.week()].join('-');\n },\n month: function month(s) {\n return [s.year(), s.month()].join('-');\n },\n quarter: function quarter(s) {\n return [s.year(), s.quarter()].join('-');\n },\n year: function year(s) {\n return s.year();\n }\n };\n print.date = print.day;\n\n var addMethods$2 = function addMethods(SpaceTime) {\n SpaceTime.prototype.isSame = function (b, unit) {\n var tzAware = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var a = this;\n\n if (!unit) {\n return null;\n }\n\n if (typeof b === 'string' || typeof b === 'number') {\n b = new SpaceTime(b, this.timezone.name);\n } //support 'seconds' aswell as 'second'\n\n\n unit = unit.replace(/s$/, ''); // make them the same timezone for proper comparison\n\n if (tzAware === true && a.tz !== b.tz) {\n b = b.clone();\n b.tz = a.tz;\n }\n\n if (print[unit]) {\n return print[unit](a) === print[unit](b);\n }\n\n return null;\n };\n };\n\n var same = addMethods$2;\n\n var addMethods$3 = function addMethods(SpaceTime) {\n var methods = {\n isAfter: function isAfter(d) {\n d = fns.beADate(d, this);\n var epoch = fns.getEpoch(d);\n\n if (epoch === null) {\n return null;\n }\n\n return this.epoch > epoch;\n },\n isBefore: function isBefore(d) {\n d = fns.beADate(d, this);\n var epoch = fns.getEpoch(d);\n\n if (epoch === null) {\n return null;\n }\n\n return this.epoch < epoch;\n },\n isEqual: function isEqual(d) {\n d = fns.beADate(d, this);\n var epoch = fns.getEpoch(d);\n\n if (epoch === null) {\n return null;\n }\n\n return this.epoch === epoch;\n },\n isBetween: function isBetween(start, end) {\n var isInclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n start = fns.beADate(start, this);\n end = fns.beADate(end, this);\n var startEpoch = fns.getEpoch(start);\n\n if (startEpoch === null) {\n return null;\n }\n\n var endEpoch = fns.getEpoch(end);\n\n if (endEpoch === null) {\n return null;\n }\n\n if (isInclusive) {\n return this.isBetween(start, end) || this.isEqual(start) || this.isEqual(end);\n }\n\n return startEpoch < this.epoch && this.epoch < endEpoch;\n }\n }; //hook them into proto\n\n Object.keys(methods).forEach(function (k) {\n SpaceTime.prototype[k] = methods[k];\n });\n };\n\n var compare = addMethods$3;\n\n var addMethods$4 = function addMethods(SpaceTime) {\n var methods = {\n i18n: function i18n(data) {\n //change the day names\n if (fns.isObject(data.days)) {\n days.set(data.days);\n } //change the month names\n\n\n if (fns.isObject(data.months)) {\n months.set(data.months);\n } // change the the display style of the month / day names\n\n\n if (fns.isBoolean(data.useTitleCase)) {\n caseFormat.set(data.useTitleCase);\n }\n }\n }; //hook them into proto\n\n Object.keys(methods).forEach(function (k) {\n SpaceTime.prototype[k] = methods[k];\n });\n };\n\n var i18n = addMethods$4;\n\n var timezones = unpack; //fake timezone-support, for fakers (es5 class)\n\n var SpaceTime = function SpaceTime(input$1, tz) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n //the holy moment\n this.epoch = null; //the shift for the given timezone\n\n this.tz = find(tz, timezones); //whether to output warnings to console\n\n this.silent = options.silent || true; // favour british interpretation of 02/02/2018, etc\n\n this.british = options.dmy || options.british; //does the week start on sunday, or monday:\n\n this._weekStart = 1; //default to monday\n\n if (options.weekStart !== undefined) {\n this._weekStart = options.weekStart;\n } // the reference today date object, (for testing)\n\n\n this._today = {};\n\n if (options.today !== undefined) {\n this._today = options.today;\n } //add getter/setters\n\n\n Object.defineProperty(this, 'd', {\n //return a js date object\n get: function get() {\n var offset = quick(this); //every computer is somewhere- get this computer's built-in offset\n\n var bias = new Date(this.epoch).getTimezoneOffset() || 0; //movement\n\n var shift = bias + offset * 60; //in minutes\n\n shift = shift * 60 * 1000; //in ms\n //remove this computer's offset\n\n var epoch = this.epoch + shift;\n var d = new Date(epoch);\n return d;\n }\n }); //add this data on the object, to allow adding new timezones\n\n Object.defineProperty(this, 'timezones', {\n get: function get() {\n return timezones;\n },\n set: function set(obj) {\n timezones = obj;\n return obj;\n }\n }); //parse the various formats\n\n var tmp = input(this, input$1, tz);\n this.epoch = tmp.epoch;\n }; //(add instance methods to prototype)\n\n\n Object.keys(methods_1).forEach(function (k) {\n SpaceTime.prototype[k] = methods_1[k];\n }); // ¯\\_(ツ)_/¯\n\n SpaceTime.prototype.clone = function () {\n return new SpaceTime(this.epoch, this.tz, {\n silent: this.silent,\n weekStart: this._weekStart,\n today: this._today\n });\n }; //return native date object at the same epoch\n\n\n SpaceTime.prototype.toLocalDate = function () {\n return new Date(this.epoch);\n }; //append more methods\n\n\n query(SpaceTime);\n add(SpaceTime);\n same(SpaceTime);\n compare(SpaceTime);\n i18n(SpaceTime);\n var spacetime = SpaceTime;\n\n var whereIts = function whereIts(a, b) {\n var start = new spacetime(null);\n var end = new spacetime(null);\n start = start.time(a); //if b is undefined, use as 'within one hour'\n\n if (b) {\n end = end.time(b);\n } else {\n end = start.add(59, 'minutes');\n }\n\n var startHour = start.hour();\n var endHour = end.hour();\n var tzs = Object.keys(start.timezones).filter(function (tz) {\n if (tz.indexOf('/') === -1) {\n return false;\n }\n\n var m = new spacetime(null, tz);\n var hour = m.hour(); //do 'calendar-compare' not real-time-compare\n\n if (hour >= startHour && hour <= endHour) {\n //test minutes too, if applicable\n if (hour === startHour && m.minute() < start.minute()) {\n return false;\n }\n\n if (hour === endHour && m.minute() > end.minute()) {\n return false;\n }\n\n return true;\n }\n\n return false;\n });\n return tzs;\n };\n\n var whereIts_1 = whereIts;\n\n var _version = '6.12.5';\n\n var main$1 = function main(input, tz, options) {\n return new spacetime(input, tz, options);\n }; // set all properties of a given 'today' object\n\n\n var setToday = function setToday(s) {\n var today = s._today || {};\n Object.keys(today).forEach(function (k) {\n s = s[k](today[k]);\n });\n return s;\n }; //some helper functions on the main method\n\n\n main$1.now = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s;\n };\n\n main$1.today = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s.startOf('day');\n };\n\n main$1.tomorrow = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s.add(1, 'day').startOf('day');\n };\n\n main$1.yesterday = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s.subtract(1, 'day').startOf('day');\n };\n\n main$1.extend = function (obj) {\n Object.keys(obj).forEach(function (k) {\n spacetime.prototype[k] = obj[k];\n });\n return this;\n };\n\n main$1.timezones = function () {\n var s = new spacetime();\n return s.timezones;\n }; //find tz by time\n\n\n main$1.whereIts = whereIts_1;\n main$1.version = _version; //aliases:\n\n main$1.plugin = main$1.extend;\n var src = main$1;\n\n return src;\n\n})));\n","// some opinionated-but-common-sense timezone abbreviations\n// these timezone abbreviations are wholly made-up by me, Spencer Kelly, with no expertise in geography\n// generated humbly from https://github.com/spencermountain/spacetime-informal\nconst spacetime = require('spacetime')\n\nconst america = 'America/'\nconst asia = 'Asia/'\nconst europe = 'Europe/'\nconst africa = 'Africa/'\nconst aus = 'Australia/'\nconst pac = 'Pacific/'\n\nconst informal = {\n //europe\n 'british summer time': europe + 'London',\n bst: europe + 'London',\n 'british time': europe + 'London',\n 'britain time': europe + 'London',\n 'irish summer time': europe + 'Dublin',\n 'irish time': europe + 'Dublin',\n ireland: europe + 'Dublin',\n 'central european time': europe + 'Berlin',\n cet: europe + 'Berlin',\n 'central european summer time': europe + 'Berlin',\n cest: europe + 'Berlin',\n 'central europe': europe + 'Berlin',\n 'eastern european time': europe + 'Riga',\n eet: europe + 'Riga',\n 'eastern european summer time': europe + 'Riga',\n eest: europe + 'Riga',\n 'eastern europe time': europe + 'Riga',\n 'western european time': europe + 'Lisbon',\n // wet: europe+'Lisbon',\n 'western european summer time': europe + 'Lisbon',\n // west: europe+'Lisbon',\n 'western europe': europe + 'Lisbon',\n 'turkey standard time': europe + 'Istanbul',\n trt: europe + 'Istanbul',\n 'turkish time': europe + 'Istanbul',\n\n //africa\n etc: africa + 'Freetown',\n utc: africa + 'Freetown',\n 'greenwich standard time': africa + 'Freetown',\n gmt: africa + 'Freetown',\n 'east africa time': africa + 'Nairobi',\n // eat: africa+'Nairobi',\n 'east african time': africa + 'Nairobi',\n 'eastern africa time': africa + 'Nairobi',\n 'central africa time': africa + 'Khartoum',\n // cat: africa+'Khartoum',\n 'central african time': africa + 'Khartoum',\n 'south africa standard time': africa + 'Johannesburg',\n sast: africa + 'Johannesburg',\n 'southern africa': africa + 'Johannesburg',\n 'south african': africa + 'Johannesburg',\n 'west africa standard time': africa + 'Lagos',\n // wat: africa+'Lagos',\n 'western africa time': africa + 'Lagos',\n 'west african time': africa + 'Lagos',\n\n 'australian central standard time': aus + 'Adelaide',\n acst: aus + 'Adelaide',\n 'australian central daylight time': aus + 'Adelaide',\n acdt: aus + 'Adelaide',\n 'australia central': aus + 'Adelaide',\n 'australian eastern standard time': aus + 'Brisbane',\n aest: aus + 'Brisbane',\n 'australian eastern daylight time': aus + 'Brisbane',\n aedt: aus + 'Brisbane',\n 'australia east': aus + 'Brisbane',\n 'australian western standard time': aus + 'Perth',\n awst: aus + 'Perth',\n 'australian western daylight time': aus + 'Perth',\n awdt: aus + 'Perth',\n 'australia west': aus + 'Perth',\n 'australian central western standard time': aus + 'Eucla',\n acwst: aus + 'Eucla',\n 'australia central west': aus + 'Eucla',\n 'lord howe standard time': aus + 'Lord_Howe',\n lhst: aus + 'Lord_Howe',\n 'lord howe daylight time': aus + 'Lord_Howe',\n lhdt: aus + 'Lord_Howe',\n 'russian standard time': europe + 'Moscow',\n msk: europe + 'Moscow',\n russian: europe + 'Moscow',\n\n //america\n 'central standard time': america + 'Chicago',\n 'central time': america + 'Chicago',\n cst: america + 'Havana',\n 'central daylight time': america + 'Chicago',\n cdt: america + 'Havana',\n 'mountain standard time': america + 'Denver',\n 'mountain time': america + 'Denver',\n mst: america + 'Denver',\n 'mountain daylight time': america + 'Denver',\n mdt: america + 'Denver',\n 'atlantic standard time': america + 'Halifax',\n 'atlantic time': america + 'Halifax',\n ast: asia + 'Baghdad',\n 'atlantic daylight time': america + 'Halifax',\n adt: america + 'Halifax',\n 'eastern standard time': america + 'New_York',\n 'eastern time': america + 'New_York',\n est: america + 'New_York',\n 'eastern daylight time': america + 'New_York',\n edt: america + 'New_York',\n 'pacific time': america + 'Los_Angeles',\n 'pacific standard time': america + 'Los_Angeles',\n pst: america + 'Los_Angeles',\n 'pacific daylight time': america + 'Los_Angeles',\n pdt: america + 'Los_Angeles',\n 'alaskan standard time': america + 'Anchorage',\n 'alaskan time': america + 'Anchorage',\n ahst: america + 'Anchorage',\n 'alaskan daylight time': america + 'Anchorage',\n ahdt: america + 'Anchorage',\n 'hawaiian standard time': pac + 'Honolulu',\n 'hawaiian time': pac + 'Honolulu',\n hst: pac + 'Honolulu',\n 'aleutian time': pac + 'Honolulu',\n 'hawaii time': pac + 'Honolulu',\n 'newfoundland standard time': america + 'St_Johns',\n 'newfoundland time': america + 'St_Johns',\n nst: america + 'St_Johns',\n 'newfoundland daylight time': america + 'St_Johns',\n ndt: america + 'St_Johns',\n 'brazil time': america + 'Sao_Paulo',\n brt: america + 'Sao_Paulo',\n brasília: america + 'Sao_Paulo',\n brasilia: america + 'Sao_Paulo',\n 'brazilian time': america + 'Sao_Paulo',\n 'argentina time': america + 'Buenos_Aires',\n // art: a+'Buenos_Aires',\n 'argentinian time': america + 'Buenos_Aires',\n 'amazon time': america + 'Manaus',\n amt: america + 'Manaus',\n 'amazonian time': america + 'Manaus',\n 'easter island standard time': 'Chile/Easterisland',\n east: 'Chile/Easterisland',\n 'easter island summer time': 'Chile/Easterisland',\n easst: 'Chile/Easterisland',\n 'venezuelan standard time': america + 'Caracas',\n 'venezuelan time': america + 'Caracas',\n vet: america + 'Caracas',\n 'venezuela time': america + 'Caracas',\n 'paraguay time': america + 'Asuncion',\n pyt: america + 'Asuncion',\n 'paraguay summer time': america + 'Asuncion',\n pyst: america + 'Asuncion',\n 'cuba standard time': america + 'Havana',\n 'cuba time': america + 'Havana',\n 'cuba daylight time': america + 'Havana',\n 'cuban time': america + 'Havana',\n 'bolivia time': america + 'La_Paz',\n // bot: a+'La_Paz',\n 'bolivian time': america + 'La_Paz',\n 'colombia time': america + 'Bogota',\n cot: america + 'Bogota',\n 'colombian time': america + 'Bogota',\n 'acre time': america + 'Eirunepe',\n // act: a+'Eirunepe',\n 'peru time': america + 'Lima',\n // pet: a+'Lima',\n 'chile standard time': america + 'Punta_Arenas',\n 'chile time': america + 'Punta_Arenas',\n clst: america + 'Punta_Arenas',\n 'chile summer time': america + 'Punta_Arenas',\n cldt: america + 'Punta_Arenas',\n 'uruguay time': america + 'Montevideo',\n uyt: america + 'Montevideo',\n\n //asia\n ist: asia + 'Jerusalem',\n 'arabic standard time': asia + 'Baghdad',\n 'arabic time': asia + 'Baghdad',\n 'arab time': asia + 'Baghdad',\n 'iran standard time': asia + 'Tehran',\n 'iran time': asia + 'Tehran',\n irst: asia + 'Tehran',\n 'iran daylight time': asia + 'Tehran',\n irdt: asia + 'Tehran',\n iranian: asia + 'Tehran',\n 'pakistan standard time': asia + 'Karachi',\n 'pakistan time': asia + 'Karachi',\n pkt: asia + 'Karachi',\n 'india standard time': asia + 'Kolkata',\n 'indian time': asia + 'Kolkata',\n 'indochina time': asia + 'Bangkok',\n ict: asia + 'Bangkok',\n 'south east asia': asia + 'Bangkok',\n 'china standard time': asia + 'Shanghai',\n ct: asia + 'Shanghai',\n 'chinese time': asia + 'Shanghai',\n 'alma-ata time': asia + 'Almaty',\n almt: asia + 'Almaty',\n 'oral time': asia + 'Oral',\n 'orat time': asia + 'Oral',\n 'yakutsk time': asia + 'Yakutsk',\n yakt: asia + 'Yakutsk',\n 'gulf standard time': asia + 'Dubai',\n 'gulf time': asia + 'Dubai',\n gst: asia + 'Dubai',\n uae: asia + 'Dubai',\n 'hong kong time': asia + 'Hong_Kong',\n hkt: asia + 'Hong_Kong',\n 'western indonesian time': asia + 'Jakarta',\n wib: asia + 'Jakarta',\n 'indonesia time': asia + 'Jakarta',\n 'central indonesian time': asia + 'Makassar',\n wita: asia + 'Makassar',\n 'israel daylight time': asia + 'Jerusalem',\n idt: asia + 'Jerusalem',\n 'israel standard time': asia + 'Jerusalem',\n 'israel time': asia + 'Jerusalem',\n israeli: asia + 'Jerusalem',\n 'krasnoyarsk time': asia + 'Krasnoyarsk',\n krat: asia + 'Krasnoyarsk',\n 'malaysia time': asia + 'Kuala_Lumpur',\n myt: asia + 'Kuala_Lumpur',\n 'singapore time': asia + 'Singapore',\n sgt: asia + 'Singapore',\n 'korea standard time': asia + 'Seoul',\n 'korea time': asia + 'Seoul',\n kst: asia + 'Seoul',\n 'korean time': asia + 'Seoul',\n 'uzbekistan time': asia + 'Samarkand',\n uzt: asia + 'Samarkand',\n 'vladivostok time': asia + 'Vladivostok',\n vlat: asia + 'Vladivostok',\n\n //indian\n 'maldives time': 'Indian/Maldives',\n mvt: 'Indian/Maldives',\n 'mauritius time': 'Indian/Mauritius',\n mut: 'Indian/Mauritius',\n\n // pacific\n 'marshall islands time': pac + 'Kwajalein',\n mht: pac + 'Kwajalein',\n 'samoa standard time': pac + 'Midway',\n sst: pac + 'Midway',\n 'somoan time': pac + 'Midway',\n 'chamorro standard time': pac + 'Guam',\n chst: pac + 'Guam',\n 'papua new guinea time': pac + 'Bougainville',\n pgt: pac + 'Bougainville',\n}\n\n//add the official iana zonefile names\nlet iana = spacetime().timezones\nlet formal = Object.keys(iana).reduce((h, k) => {\n h[k] = k\n return h\n}, {})\nmodule.exports = Object.assign({}, informal, formal)\n","module.exports = [\n 'weekday',\n\n 'summer',\n 'winter',\n 'autumn',\n\n 'some day',\n 'one day',\n 'all day',\n 'some point',\n\n 'eod',\n 'eom',\n 'eoy',\n 'standard time',\n 'daylight time',\n 'tommorrow',\n]\n","module.exports = [\n 'centuries',\n 'century',\n 'day',\n 'days',\n 'decade',\n 'decades',\n 'hour',\n 'hours',\n 'hr',\n 'hrs',\n 'millisecond',\n 'milliseconds',\n 'minute',\n 'minutes',\n 'min',\n 'mins',\n 'month',\n 'months',\n 'seconds',\n 'sec',\n 'secs',\n 'week end',\n 'week ends',\n 'weekend',\n 'weekends',\n 'week',\n 'weeks',\n 'wk',\n 'wks',\n 'year',\n 'years',\n 'yr',\n 'yrs',\n 'quarter',\n // 'quarters',\n 'qtr',\n 'qtrs',\n 'season',\n 'seasons',\n]\n","module.exports = [\n 'all hallows eve',\n 'all saints day',\n 'all sts day',\n 'april fools',\n 'armistice day',\n 'australia day',\n 'bastille day',\n 'boxing day',\n 'canada day',\n 'christmas eve',\n 'christmas',\n 'cinco de mayo',\n 'day of the dead',\n 'dia de muertos',\n 'dieciseis de septiembre',\n 'emancipation day',\n 'grito de dolores',\n 'groundhog day',\n 'halloween',\n 'harvey milk day',\n 'inauguration day',\n 'independence day',\n 'independents day',\n 'juneteenth',\n 'labour day',\n 'national freedom day',\n 'national nurses day',\n 'new years eve',\n 'new years',\n 'purple heart day',\n 'rememberance day',\n 'rosa parks day',\n 'saint andrews day',\n 'saint patricks day',\n 'saint stephens day',\n 'saint valentines day',\n 'st andrews day',\n 'st patricks day',\n 'st stephens day',\n 'st valentines day ',\n 'valentines day',\n 'valentines',\n 'veterans day',\n 'victoria day',\n 'womens equality day',\n 'xmas',\n // Fixed religious and cultural holidays\n // Catholic + Christian\n 'epiphany',\n 'orthodox christmas day',\n 'orthodox new year',\n 'assumption of mary',\n 'all souls day',\n 'feast of the immaculate conception',\n 'feast of our lady of guadalupe',\n\n // Kwanzaa\n 'kwanzaa',\n // Pagan / metal 🤘\n 'imbolc',\n 'beltaine',\n 'lughnassadh',\n 'samhain',\n 'martin luther king day',\n 'mlk day',\n 'presidents day',\n 'mardi gras',\n 'tax day',\n 'commonwealth day',\n 'mothers day',\n 'memorial day',\n 'fathers day',\n 'columbus day',\n 'indigenous peoples day',\n 'canadian thanksgiving',\n 'election day',\n 'thanksgiving',\n 't-day',\n 'turkey day',\n 'black friday',\n 'cyber monday',\n // Astronomical religious and cultural holidays\n 'ash wednesday',\n 'palm sunday',\n 'maundy thursday',\n 'good friday',\n 'holy saturday',\n 'easter',\n 'easter sunday',\n 'easter monday',\n 'orthodox good friday',\n 'orthodox holy saturday',\n 'orthodox easter',\n 'orthodox easter monday',\n 'ascension day',\n 'pentecost',\n 'whitsunday',\n 'whit sunday',\n 'whit monday',\n 'trinity sunday',\n 'corpus christi',\n 'advent',\n // Jewish\n 'tu bishvat',\n 'tu bshevat',\n 'purim',\n 'passover',\n 'yom hashoah',\n 'lag baomer',\n 'shavuot',\n 'tisha bav',\n 'rosh hashana',\n 'yom kippur',\n 'sukkot',\n 'shmini atzeret',\n 'simchat torah',\n 'chanukah',\n 'hanukkah',\n // Muslim\n 'isra and miraj',\n 'lailat al-qadr',\n 'eid al-fitr',\n 'id al-Fitr',\n 'eid ul-Fitr',\n 'ramadan',\n 'eid al-adha',\n 'muharram',\n 'the prophets birthday',\n 'ostara',\n 'march equinox',\n 'vernal equinox',\n 'litha',\n 'june solistice',\n 'summer solistice',\n 'mabon',\n 'september equinox',\n 'fall equinox',\n 'autumnal equinox',\n 'yule',\n 'december solstice',\n 'winter solstice',\n // Additional important holidays\n 'chinese new year',\n 'diwali',\n]\n","module.exports = [\n 'noon',\n 'midnight',\n 'now',\n 'morning',\n 'tonight',\n 'evening',\n 'afternoon',\n 'night',\n 'breakfast time',\n 'lunchtime',\n 'dinnertime',\n 'sometime',\n 'midday',\n 'eod',\n 'oclock',\n 'oclock',\n 'all day',\n 'at night',\n]\n","const timezones = require('../_timezones')\nconst data = [\n [require('./dates'), '#Date'],\n [require('./durations'), '#Duration'],\n [require('./holidays'), '#Holiday'],\n [require('./times'), '#Time'],\n [Object.keys(timezones), '#Timezone'],\n]\nlet lex = {\n 'a couple': 'Value',\n thur: 'WeekDay',\n}\ndata.forEach((a) => {\n for (let i = 0; i < a[0].length; i++) {\n lex[a[0][i]] = a[1]\n }\n})\n\nmodule.exports = lex\n","const spacetime = require('spacetime')\n\nclass Unit {\n constructor(input, unit, context) {\n this.unit = unit || 'day'\n context = context || {}\n let today = {}\n if (context.today) {\n today = {\n date: context.today.date(),\n month: context.today.month(),\n year: context.today.year(),\n }\n }\n // set it to the beginning of the given unit\n let d = spacetime(input, context.timezone, { today: today })\n\n // set to beginning?\n // if (d.isValid() && keepTime !== true) {\n // d = d.startOf(this.unit)\n // }\n Object.defineProperty(this, 'd', {\n enumerable: false,\n writable: true,\n value: d,\n })\n Object.defineProperty(this, 'context', {\n enumerable: false,\n writable: true,\n value: context,\n })\n }\n // make a new one\n clone() {\n let d = new Unit(this.d, this.unit, this.context)\n return d\n }\n log() {\n console.log('--')\n this.d.log()\n console.log('\\n')\n return this\n }\n applyShift(obj = {}) {\n Object.keys(obj).forEach((unit) => {\n this.d = this.d.add(obj[unit], unit)\n })\n return this\n }\n applyTime(str) {\n if (str) {\n this.d = this.d.time(str)\n } else {\n this.d = this.d.startOf('day') //zero-out time\n }\n return this\n }\n applyWeekDay(day) {\n if (day) {\n let epoch = this.d.epoch\n this.d = this.d.day(day)\n if (this.d.epoch < epoch) {\n this.d = this.d.add(1, 'week')\n }\n }\n return this\n }\n applyRel(rel) {\n if (rel === 'next') {\n return this.next()\n }\n if (rel === 'last') {\n return this.last()\n }\n return this\n }\n applySection(section) {\n if (section === 'start') {\n return this.start()\n }\n if (section === 'end') {\n return this.end()\n }\n if (section === 'middle') {\n return this.middle()\n }\n return this\n }\n format(fmt) {\n return this.d.format(fmt)\n }\n start() {\n this.d = this.d.startOf(this.unit)\n if (this.context.dayStart) {\n this.d = this.d.time(this.context.dayStart)\n }\n return this\n }\n end() {\n this.d = this.d.endOf(this.unit)\n if (this.context.dayEnd) {\n this.d = this.d.time(this.context.dayEnd)\n }\n return this\n }\n middle() {\n let diff = this.d.diff(this.d.endOf(this.unit))\n let minutes = Math.round(diff.minutes / 2)\n this.d = this.d.add(minutes, 'minutes')\n return this\n }\n // the millescond before\n before() {\n this.d = this.d.minus(1, this.unit)\n this.d = this.d.endOf(this.unit)\n if (this.context.dayEnd) {\n this.d = this.d.time(this.context.dayEnd)\n }\n return this\n }\n // 'after 2019'\n after() {\n this.d = this.d.add(1, this.unit)\n this.d = this.d.startOf(this.unit)\n return this\n }\n // tricky: 'next june' 'next tuesday'\n next() {\n this.d = this.d.add(1, this.unit)\n this.d = this.d.startOf(this.unit)\n return this\n }\n // tricky: 'last june' 'last tuesday'\n last() {\n this.d = this.d.minus(1, this.unit)\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\nmodule.exports = Unit\n","const spacetime = require('spacetime')\nconst Unit = require('./Unit')\n\nclass Day extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'day'\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n}\n\n// like 'feb 2'\nclass CalendarDate extends Day {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'day'\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n return this\n }\n}\n\nclass WeekDay extends Day {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'week'\n // is the input just a weekday?\n if (typeof input === 'string') {\n this.d = spacetime(context.today, context.timezone)\n this.d = this.d.day(input)\n // assume a wednesday in the future\n if (this.d.isBefore(context.today)) {\n this.d = this.d.add(7, 'days')\n }\n } else {\n this.d = input\n }\n this.weekDay = this.d.dayName()\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n clone() {\n //overloaded method\n return new WeekDay(this.d, this.unit, this.context)\n }\n end() {\n //overloaded method\n this.d = this.d.endOf('day')\n if (this.context.dayEnd) {\n this.d = this.d.time(this.context.dayEnd)\n }\n return this\n }\n next() {\n this.d = this.d.add(7, 'days')\n this.d = this.d.day(this.weekDay)\n return this\n }\n last() {\n this.d = this.d.minus(7, 'days')\n this.d = this.d.day(this.weekDay)\n return this\n }\n}\n\n// like 'haloween'\nclass Holiday extends CalendarDate {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'day'\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n}\n\nmodule.exports = {\n Day: Day,\n WeekDay: WeekDay,\n CalendarDate: CalendarDate,\n Holiday: Holiday,\n}\n","const Unit = require('./Unit')\n\n// a specific month, like 'March'\nclass AnyMonth extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'month'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n}\n\n// a specific month, like 'March'\nclass Month extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'month'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n this.d = this.d.startOf('month')\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n this.d = this.d.startOf('month')\n return this\n }\n}\nclass AnyQuarter extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'quarter'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n last() {\n this.d = this.d.minus(1, 'quarter')\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\n\nclass Quarter extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'quarter'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\nclass Season extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'season'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\nclass Year extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'year'\n if (this.d.isValid()) {\n this.d = this.d.startOf('year')\n }\n }\n}\n\nmodule.exports = {\n AnyMonth: AnyMonth,\n Month: Month,\n Quarter: Quarter,\n AnyQuarter: AnyQuarter,\n Season: Season,\n Year: Year,\n}\n","const Unit = require('./Unit')\n\nclass Week extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'week'\n if (this.d.isValid()) {\n this.d = this.d.startOf('week')\n }\n }\n}\n\n//may need some work\nclass WeekEnd extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'week'\n if (this.d.isValid()) {\n this.d = this.d.day('saturday')\n this.d = this.d.startOf('day')\n }\n }\n start() {\n this.d = this.d.day('saturday').startOf('day')\n return this\n }\n // end() {\n // this.d = this.d.day('sunday').endOf('day')\n // return this\n // }\n next() {\n this.d = this.d.add(1, this.unit)\n this.d = this.d.startOf('weekend')\n return this\n }\n last() {\n this.d = this.d.minus(1, this.unit)\n this.d = this.d.startOf('weekend')\n return this\n }\n}\n\nmodule.exports = {\n Week: Week,\n WeekEnd: WeekEnd,\n}\n","const Unit = require('./Unit')\n\nclass Hour extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context, true)\n this.unit = 'hour'\n if (this.d.isValid()) {\n this.d = this.d.startOf('hour')\n }\n }\n}\nclass Minute extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context, true)\n this.unit = 'minute'\n if (this.d.isValid()) {\n this.d = this.d.startOf('minute')\n }\n }\n}\nclass Moment extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context, true)\n this.unit = 'millisecond'\n }\n}\n\nmodule.exports = {\n Hour: Hour,\n Minute: Minute,\n Moment: Moment,\n}\n","module.exports = Object.assign(\n { Unit: require('./Unit') },\n require('./_day'),\n require('./_year'),\n require('./_week'),\n require('./_time')\n)\n","const knownUnits = {\n second: true,\n minute: true,\n hour: true,\n day: true,\n week: true,\n weekend: true,\n month: true,\n season: true,\n quarter: true,\n year: true,\n}\n\nconst aliases = {\n wk: 'week',\n min: 'minute',\n sec: 'second',\n weekend: 'week', //for now...\n}\n\nconst parseUnit = function (m) {\n let unit = m.match('#Duration').text('normal')\n unit = unit.replace(/s$/, '')\n // support shorthands like 'min'\n if (aliases.hasOwnProperty(unit)) {\n unit = aliases[unit]\n }\n return unit\n}\n\n//turn '5 weeks before' to {weeks:5}\nconst parseShift = function (doc) {\n let result = {}\n let shift = doc.match('#DateShift+')\n if (shift.found === false) {\n return result\n }\n // '5 weeks'\n shift.match('#Cardinal #Duration').forEach((ts) => {\n let num = ts.match('#Cardinal').text('normal')\n num = parseFloat(num)\n if (num && typeof num === 'number') {\n let unit = parseUnit(ts)\n if (knownUnits[unit] === true) {\n result[unit] = num\n }\n }\n })\n //is it 2 weeks ago? → -2\n if (shift.has('(before|ago|hence|back)$') === true) {\n Object.keys(result).forEach((k) => (result[k] *= -1))\n }\n shift.remove('#Cardinal #Duration')\n // supoprt '1 day after tomorrow'\n let m = shift.match('[#Duration] [(after|before)]')\n if (m.found) {\n let unit = m.groups('unit').text('reduced')\n // unit = unit.replace(/s$/, '')\n let dir = m.groups('dir').text('reduced')\n if (dir === 'after') {\n result[unit] = 1\n } else if (dir === 'before') {\n result[unit] = -1\n }\n }\n // in half an hour\n m = shift.match('half (a|an) [#Duration]', 0)\n if (m.found) {\n let unit = parseUnit(m)\n result[unit] = 0.5\n }\n // finally, remove it from our text\n doc.remove('#DateShift')\n return result\n}\nmodule.exports = parseShift\n","/*\na 'counter' is a Unit determined after a point\n * first hour of x\n * 7th week in x\n * last year in x\n * \nunlike a shift, like \"2 weeks after x\"\n*/\nconst oneBased = {\n minute: true,\n}\nconst getCounter = function (doc) {\n // 7th week of\n let m = doc.match('[#Value] [#Duration+] (of|in)')\n if (m.found) {\n let obj = m.groups()\n let num = obj.num.text('reduced')\n let unit = obj.unit.text('reduced')\n let found = {\n unit: unit,\n num: Number(num) || 0,\n }\n // 0-based or 1-based units\n if (!oneBased[unit]) {\n found.num -= 1\n }\n doc = doc.remove(m)\n return found\n }\n // first week of\n m = doc.match('[(first|initial|last|final)] [#Duration+] (of|in)')\n if (m.found) {\n let obj = m.groups()\n let dir = obj.dir.text('reduced')\n let unit = obj.unit.text('reduced')\n if (dir === 'initial') {\n dir = 'first'\n }\n if (dir === 'final') {\n dir = 'last'\n }\n let found = {\n unit: unit,\n dir: dir,\n }\n doc = doc.remove(m)\n return found\n }\n\n return {}\n}\nmodule.exports = getCounter\n","const spacetime = require('spacetime')\n\nconst hardCoded = {\n daybreak: '7:00am', //ergh\n breakfast: '8:00am',\n morning: '9:00am',\n noon: '12:00pm',\n midday: '12:00pm',\n afternoon: '2:00pm',\n lunchtime: '12:00pm',\n evening: '6:00pm',\n dinnertime: '6:00pm',\n night: '8:00pm',\n eod: '10:00pm',\n midnight: '12:00am',\n}\n\nconst halfPast = function (m, s) {\n let hour = m.match('#Cardinal$').text('reduced')\n\n let term = m.match('(half|quarter|25|15|10|5)')\n let mins = term.text('reduced')\n if (term.has('half')) {\n mins = '30'\n }\n if (term.has('quarter')) {\n mins = '15'\n }\n let behind = m.has('to')\n // apply it\n s = s.hour(hour)\n s = s.startOf('hour')\n // assume 'half past 5' is 5pm\n if (hour < 6) {\n s = s.ampm('pm')\n }\n if (behind) {\n s = s.subtract(mins, 'minutes')\n } else {\n s = s.add(mins, 'minutes')\n }\n return s\n}\n\nconst parseTime = function (doc, context) {\n let time = doc.match('(at|by|for|before|this)? #Time+')\n if (time.found) {\n doc.remove(time)\n }\n // get the main part of the time\n time = time.not('^(at|by|for|before|this)')\n time = time.not('sharp')\n time = time.not('on the dot')\n let s = spacetime.now(context.timezone)\n let now = s.clone()\n\n // check for known-times (like 'today')\n let timeStr = time.text('reduced')\n if (hardCoded.hasOwnProperty(timeStr)) {\n return hardCoded[timeStr]\n }\n\n // '5 oclock'\n let m = time.match('^#Cardinal oclock (am|pm)?')\n if (m.found) {\n m = m.not('oclock')\n s = s.hour(m.text('reduced'))\n s = s.startOf('hour')\n if (s.isValid() && !s.isEqual(now)) {\n let ampm = m.match('(am|pm)').text('reduced')\n s = s.ampm(ampm)\n return s.time()\n }\n }\n\n // 'quarter to two'\n m = time.match('(half|quarter|25|15|10|5) (past|after|to) #Cardinal')\n if (m.found) {\n s = halfPast(m, s)\n if (s.isValid() && !s.isEqual(now)) {\n return s.time()\n }\n }\n // '4 in the evening'\n m = time.match('[