/* compromise v11.11.0 github.com/nlp-compromise/compromise MIT */ !function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).nlp=t()}(function(){return function i(o,s,u){function l(e,t){if(!s[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(c)return c(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var a=s[e]={exports:{}};o[e][0].call(a.exports,function(t){return l(o[e][1][t]||t)},a,a.exports,i,o,s,u)}return s[e].exports}for(var c="function"==typeof require&&require,t=0;t (http://spencermounta.in)",name:"compromise",description:"natural language processing in the browser",version:"11.11.0",main:"./builds/compromise.js",types:"./compromise.d.ts",repository:{type:"git",url:"git://github.com/nlp-compromise/compromise.git"},scripts:{test:'tape "./test/unit/**/*.test.js" | tap-dancer',"test:spec":'tape "./test/unit/**/*.test.js" | tap-spec',testb:'TESTENV=prod tape "./test/unit/**/*.test.js" | tap-dancer',buildTest:"TESTENV=prod node ./scripts/test.js","test:types":"tsc --project test/types",browserTest:"node ./scripts/browserTest.js",benchmark:"node ./scripts/benchmark.js",build:"node ./scripts/build/index.js",pack:"node ./scripts/pack.js",prepublishOnly:"node ./scripts/prepublish",postpublish:"node ./scripts/postpublish",demo:"node ./scripts/demo.js",watch:"amble ./scratch.js",filesize:"node ./scripts/lib/filesize.js",coverage:"node ./scripts/postpublish/coverage.js",lint:"node ./scripts/prepublish/linter.js"},files:["builds/","docs/","compromise.d.ts"],dependencies:{"efrt-unpack":"2.0.3"},devDependencies:{amble:"0.0.6","babel-preset-env":"^1.7.0",babelify:"7.3.0",babili:"0.1.4",browserify:"13.0.1",chalk:"2.4.1","compromise-plugin":"0.0.8",derequire:"2.0.6",eslint:"4.19.1",nyc:"11.8.0",shelljs:"0.8.2","tap-dancer":"0.0.3",tape:"4.9.0","uglify-js":"3.3.26"},license:"MIT"}},{}],3:[function(t,e,a){"use strict";var r="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},i=t("./tags"),o={reset:"",red:"",green:"",yellow:"",blue:"",magenta:"",cyan:"",black:""};void 0===e&&Object.keys(o).forEach(function(t){o[t]=""}),a.ensureString=function(t){return"string"==typeof t?t:"number"==typeof t?String(t):""},a.ensureObject=function(t){return"object"!==(void 0===t?"undefined":r(t))?{}:null===t||t instanceof Array?{}:t},a.titleCase=function(t){return t.charAt(0).toUpperCase()+t.substr(1)},a.copy=function(e){var r={};return e=a.ensureObject(e),Object.keys(e).forEach(function(t){r[t]=e[t]}),r},a.extend=function(t,e){t=a.copy(t);for(var r=Object.keys(e),n=0;n "+e,n+=a.leftPad(r||"",15),console.log("%c"+n," color: #a2c99c")},untag:function(t,e,r){var n=t.normal||"["+t.silent_term+"]";n=a.leftPad("'"+n+"'",12),n+=" ~* "+e,n+=" "+(r||""),console.log("%c"+n," color: #b66a6a")}}},{"../fns":3}],6:[function(t,e,r){"use strict";var n=t("./client"),a=t("./server"),i=!1;e.exports={enable:function(t){void 0===t&&(t=!0),i=t},tag:function(t,e,r){!0!==i&&"tagger"!==i||("undefined"!=typeof window?n.tag(t,e,r):a.tag(t,e,r))},unTag:function(t,e,r){!0!==i&&"tagger"!==i||("undefined"!=typeof window?n.untag(t,e,r):a.untag(t,e,r))}}},{"./client":5,"./server":7}],7:[function(t,e,r){"use strict";var a=t("../fns");e.exports={tag:function(t,e,r){var n=t.normal||"["+t.silent_term+"]";n=a.yellow(n),n=a.leftPad("'"+n+"'",20),n+=" -> "+a.printTag(e),n=a.leftPad(n,54),console.log(" "+n+"("+a.cyan(r||"")+")")},untag:function(t,e,r){var n="-"+t.normal+"-";n=a.red(n),n=a.leftPad(n,20),n+=" ~* "+a.red(e),n=a.leftPad(n,54),console.log(" "+n+"("+a.red(r||"")+")")}}},{"../fns":3}],8:[function(t,e,r){"use strict";e.exports={fns:t("./fns"),Terms:t("./terms")}},{"./fns":3,"./terms":165}],9:[function(t,e,r){"use strict";var n=t("../../text");e.exports=n.makeSubset({stripPeriods:function(){return this.list.forEach(function(t){t.terms.forEach(function(t){var e=t._text.split(".");2e.count?-1:t.count===e.count&&(t.size>e.size||t.key.length>e.key.length)?-1:1}),t},n={data:function(){return this.list.map(function(t){return{normal:t.out("normal"),count:t.count,size:t.size}})},unigrams:function(){return this.list=this.list.filter(function(t){return 1===t.size}),this},bigrams:function(){return this.list=this.list.filter(function(t){return 2===t.size}),this},trigrams:function(){return this.list=this.list.filter(function(t){return 3===t.size}),this},sort:function(){return u(this)}};e.exports=o.makeSubset(n,function(t,e){var r=[];"number"==typeof e&&(e={n:e});for(var n=(e=e||{}).max||4,a=1;a<=n;a++)r.push(a);e.size&&(r=[e.size]);var i=s(t,{size:r});return t=new o(i),t=u(t),void 0!==e.n&&(t=t.get(e.n)),t})},{"../../text":192,"./getGrams":33}],36:[function(t,e,r){"use strict";var n=t("./index"),i=t("./getGrams"),o=function(t,e,r){n.call(this,t,e,r)};o.prototype=Object.create(n.prototype),o.find=function(t,e,r){var n={size:[1,2,3,4],edge:"start"};r&&(n.size=[r]);var a=i(t,n);return(t=new o(a)).sort(),"number"==typeof e&&(t=t.get(e)),t},e.exports=o},{"./getGrams":33,"./index":35}],37:[function(t,e,r){"use strict";e.exports=function(t){if(!t.tags.Noun)return!1;if(t.tags.Plural)return!0;for(var e=["Pronoun","Place","Value","Person","Month","WeekDay","RelativeDay","Holiday"],r=0;r=n[r][1]&&(t-=n[r][1],e.push(n[r][0]));return a[t]&&e.push(a[t]),e};e.exports=function(o){if(1e21=t[0]){var e=Math.floor(n/t[0]);n-=e*t[0],e&&a.push({unit:t[1],count:e})}}),a),i=0;ie}),this},lessThan:function(e){return e=a(e),this.list=this.list.filter(function(t){return null!==e&&t.number()n[a].length)return i[n[a]];return null}},{"./suffix_rules":88}],88:[function(t,e,r){"use strict";for(var n={Gerund:["ing"],Actor:["erer"],Infinitive:["ate","ize","tion","rify","then","ress","ify","age","nce","ect","ise","ine","ish","ace","ash","ure","tch","end","ack","and","ute","ade","ock","ite","ase","ose","use","ive","int","nge","lay","est","ain","ant","ent","eed","er","le","own","unk","ung","en"],PastTense:["ed","lt","nt","pt","ew","ld"],PresentTense:["rks","cks","nks","ngs","mps","tes","zes","ers","les","acks","ends","ands","ocks","lays","eads","lls","els","ils","ows","nds","ays","ams","ars","ops","ffs","als","urs","lds","ews","ips","es","ts","ns","s"]},a={},i=Object.keys(n),o=i.length,s=0;s":">","&":"&",'"':""","'":"'"," ":" "};return t.replace(/[<>&"' ]/g,function(t){return e[t]})};e.exports=function(t){var e=Object.keys(t.tags).filter(function(t){return"Term"!==t});e=(e=e.map(function(t){return"nl-"+t})).join(" ");var r=function(t){for(var e="(?:[^\"'>]|\"[^\"]*\"|'[^']*')*",r=new RegExp("<(?:!--(?:(?:-*[^->])*--+|-?)|script\\b"+e+">[\\s\\S]*?[\\s\\S]*?","gi"),n=void 0;(t=(n=t).replace(r,""))!==n;);return t.replace(/'+(r=a(r))+"";return a(t.whitespace.before)+n+a(t.whitespace.after)}},{}],155:[function(t,e,r){"use strict";var a=t("../../paths").fns;e.exports=function(t){var e=Object.keys(t.tags).map(function(t){return a.printTag(t)}).join(", "),r=t.text;r="'"+a.yellow(r||"-")+"'";var n="";t.silent_term&&(n="["+t.silent_term+"]"),r=a.leftPad(r,20),r+=a.leftPad(n,8),console.log(" "+r+" - "+e)}},{"../../paths":161}],156:[function(t,e,r){"use strict";var n=/([a-z ])([,:;.!?]+)$/i;e.exports=function(e){var r={getPunctuation:function(){var t=this.text.match(n);return t?t[2]:null},setPunctuation:function(t){return this.killPunctuation(),this.text+=t,","===t&&(this.tags.Comma=!0),this},hasComma:function(){return","===this.getPunctuation()},killPunctuation:function(){return this.text=this._text.replace(n,"$1"),delete this.tags.Comma,delete this.tags.ClauseEnd,this}};return Object.keys(r).forEach(function(t){e.prototype[t]=r[t]}),e}},{}],157:[function(t,e,r){"use strict";e.exports=function t(e,r){var n=e.world.tags;if(void 0===n[r])return!0;for(var a=n[r].notA||[],i=0;i "+t.list.reduce(function(t,e){return t+"\n "+e.terms.reduce(function(t,e){return t+"\n "+e.out("html")},"")+"\n "},"")+"\n"},terms:function(t){var e=[];return t.list.forEach(function(t){t.terms.forEach(function(t){e.push({text:t.text,normal:t.normal,tags:Object.keys(t.tags)})})}),e},debug:function(t){return console.log("===="),t.list.forEach(function(t){console.log(" --"),t.debug()}),t},topk:function(t){return n(t)},custom:function(t,e){return t.list.map(function(t){return t.out(e)})}};s.plaintext=s.text,s.normalized=s.normal,s.colors=s.color,s.tags=s.terms,s.offset=s.offsets,s.idexes=s.index,s.frequency=s.topk,s.freq=s.topk,s.arr=s.array,e.exports=function(t){return t.prototype.out=function(t){if("string"==typeof t){if(s[t])return s[t](this)}else if(!0===o.isObject(t))return s.custom(this,t);return s.text(this)},t.prototype.debug=function(){return s.debug(this)},t}},{"../paths":201,"./indexes":198,"./offset":199,"./topk":200}],198:[function(t,e,r){"use strict";e.exports=function(t){var n=[],a={};t.terms().list.forEach(function(t){a[t.terms[0].uid]=!0});var i=0;return t.all().list.forEach(function(t,r){t.terms.forEach(function(t,e){void 0!==a[t.uid]&&n.push({text:t.text,normal:t.normal,term:i,sentence:r,sentenceTerm:e}),i+=1})}),n}},{}],199:[function(t,e,r){"use strict";e.exports=function(t){var s=t.all();return t.list.map(function(t){for(var e=[],r=0;re.count?-1:1}),t&&(n=n.splice(0,t)),n}},{}],201:[function(t,e,r){"use strict";e.exports=t("../paths")},{"../paths":205}],202:[function(t,e,r){"use strict";var n=t("./methods");e.exports=function(e){var t={sort:function(t){return(t=(t=t||"alphabetical").toLowerCase())&&"alpha"!==t&&"alphabetical"!==t?"chron"===t||"chronological"===t?n.chron(this,e):"length"===t?n.lengthFn(this,e):"freq"===t||"frequency"===t?n.freq(this,e):"wordcount"===t?n.wordCount(this,e):this:n.alpha(this,e)},reverse:function(){return this.list=this.list.reverse(),this},unique:function(){var r={};return this.list=this.list.filter(function(t){var e=t.out("root");return!r.hasOwnProperty(e)&&(r[e]=!0)}),this}};return e.addMethods(e,t),e}},{"./methods":203}],203:[function(t,e,r){"use strict";var n=function(t){return(t=t.sort(function(t,e){return t.index>e.index?1:t.index===e.index?0:-1})).map(function(t){return t.ts})};r.alpha=function(t){return t.list.sort(function(t,e){if(t===e)return 0;if(t.terms[0]&&e.terms[0]){if(t.terms[0].root>e.terms[0].root)return 1;if(t.terms[0].roote.out("root")?1:-1}),t},r.chron=function(t){var e=t.list.map(function(t){return{ts:t,index:t.termIndex()}});return t.list=n(e),t},r.lengthFn=function(t){var e=t.list.map(function(t){return{ts:t,index:t.chars()}});return t.list=n(e).reverse(),t},r.wordCount=function(t){var e=t.list.map(function(t){return{ts:t,index:t.length}});return t.list=n(e),t},r.freq=function(t){var r={};t.list.forEach(function(t){var e=t.out("root");r[e]=r[e]||0,r[e]+=1});var e=t.list.map(function(t){var e=r[t.out("root")]||0;return{ts:t,index:-1*e}});return t.list=n(e),t}},{}],204:[function(t,e,r){"use strict";e.exports=function(t){return t.addMethods(t,{splitAfter:function(e,r){var n=[];return this.list.forEach(function(t){t.splitAfter(e,r).forEach(function(t){n.push(t)})}),this.list=n,this},splitBefore:function(e,r){var n=[];return this.list.forEach(function(t){t.splitBefore(e,r).forEach(function(t){n.push(t)})}),this.list=n,this},splitOn:function(e,r){var n=[];return this.list.forEach(function(t){t.splitOn(e,r).forEach(function(t){n.push(t)})}),this.list=n,this}}),t}},{}],205:[function(t,e,r){arguments[4][201][0].apply(r,arguments)},{"../paths":8,dup:201}],206:[function(t,e,r){"use strict";var a=t("../subset/sentences/isQuestion");e.exports=function(n){var e={clauses:function(t){var e=this.splitAfter("#ClauseEnd");return"number"==typeof t&&(e=e.get(t)),e},hashTags:function(t){var e=this.match("#HashTag").terms();return"number"==typeof t&&(e=e.get(t)),e},organizations:function(t){var e=this.splitAfter("#Comma");return e=e.match("#Organization+"),"number"==typeof t&&(e=e.get(t)),e},phoneNumbers:function(t){var e=this.splitAfter("#Comma");return e=e.match("#PhoneNumber+"),"number"==typeof t&&(e=e.get(t)),e},places:function(t){var e=this.splitAfter("#Comma");return e=e.match("#Place+"),"number"==typeof t&&(e=e.get(t)),e},quotations:function(t){var e=this.match("#Quotation+"),i=[];return e.list.forEach(function(r){var n=0,a=null;r.terms.forEach(function(t,e){!0===t.tags.StartQuotation&&(0===n&&(a=e),n+=1),0