compromise
Version:
natural language processing in the browser
286 lines (271 loc) • 4.4 kB
JavaScript
;
const misc = {
'here': 'Noun',
'better': 'Comparative',
'earlier': 'Superlative',
'make sure': 'Verb',
'keep tabs': 'Verb',
'has': 'Verb',
'sounds': 'PresentTense',
//special case for took/taken
'taken': 'PastTense',
'msg': 'Verb', //slang
'a few': 'Value', //different than 'few people'
'years old': 'Unit', //special case
'not': 'Negative',
'never': 'Negative',
'no': 'Negative',
'no doubt': 'Noun',
'not only': 'Adverb',
'how\'s': 'QuestionWord' //not conjunction
};
const compact = {
Adjective: [
'so called', //?
'on board',
'vice versa',
'en route',
'upside down',
'up front',
'in front',
'in situ',
'in vitro',
'ad hoc',
'de facto',
'ad infinitum',
'for keeps',
'a priori',
'off guard',
'spot on',
'ipso facto',
'fed up',
'brand new',
'old fashioned',
'bona fide',
'well off',
'far off',
'straight forward',
'hard up',
'sui generis',
'en suite',
'avant garde',
'sans serif',
'gung ho',
'super duper'
],
Place: [
'new england',
'new hampshire',
'new jersey',
'new mexico',
'united states',
'united kingdom',
'great britain',
'great lakes',
'pacific ocean',
'atlantic ocean',
'indian ocean',
'arctic ocean',
'antarctic ocean',
'everglades',
],
//conjunctions
'Conjunction': [
'yet',
'therefore',
'or',
'while',
'nor',
'whether',
'though',
'because',
'cuz',
'but',
'for',
'and',
'however',
'before',
'although',
'how',
'plus',
'versus',
'otherwise',
// 'not'
],
Time: [
//date
'noon',
'midnight',
'now',
'morning',
'evening',
'afternoon',
'night',
'breakfast time',
'lunchtime',
'dinnertime',
'ago',
'sometime',
'eod',
'oclock',
],
Date: [
//end of day, end of month
'eom',
'standard time',
'daylight time',
],
'Condition': [
'if',
'unless',
'notwithstanding'
],
'PastTense': [
'said',
'had',
'been',
'began',
'came',
'did',
'meant',
'went'
],
'Verb': [
'given',
'known',
'shown',
'seen',
'born'
],
'Gerund': [
'going',
'being',
'according',
'resulting',
'developing',
'staining'
],
'Copula': [
'is',
'are',
'was',
'were',
'am'
],
//determiners
'Determiner': require('./determiners'),
//prepositions
'Preposition': require('./prepositions'),
//modal verbs
'Modal': [
'can',
'may',
'could',
'might',
'will',
'ought to',
'would',
'must',
'shall',
'should',
'ought',
'shant',
'lets', //arguable
],
//Possessive pronouns
'Possessive': [
'mine',
'something',
'none',
'anything',
'anyone',
'theirs',
'himself',
'ours',
'his',
'my',
'their',
'yours',
'your',
'our',
'its',
'herself',
'hers',
'themselves',
'myself',
'her', //this one is check ambiguous
],
//personal pronouns (nouns)
'Pronoun': [
'it',
'they',
'i',
'them',
'you',
'she',
'me',
'he',
'him',
'ourselves',
'us',
'we',
'thou',
'il',
'elle',
'yourself',
'\'em',
'he\'s',
'she\'s'
],
//questions are awkward pos. are clarified in question_pass
'QuestionWord': [
'where',
'why',
'when',
'who',
'whom',
'whose',
'what',
'which'
],
//some manual adverbs (the rest are generated)
'Adverb': require('./adverbs'),
//interjections, expressions
'Expression': require('./expressions'),
//family-terms are people
Person: [
'father',
'mother',
'mom',
'dad',
'mommy',
'daddy',
'sister',
'brother',
'aunt',
'uncle',
'grandfather',
'grandmother',
'cousin',
'stepfather',
'stepmother',
'boy',
'girl',
'man',
'woman',
'guy',
'dude',
'bro',
'gentleman',
'someone'
]
};
//unpack the compact terms into the misc lexicon..
const keys = Object.keys(compact);
for (let i = 0; i < keys.length; i++) {
const arr = compact[keys[i]];
for (let i2 = 0; i2 < arr.length; i2++) {
misc[arr[i2]] = keys[i];
}
}
module.exports = misc;