Added plurals and tenses to source, Mash and Letters dictionaries.

This commit is contained in:
ThePendulum 2022-10-21 20:19:42 +02:00
parent 186c8baf3e
commit d88a64e925
4 changed files with 2191456 additions and 1 deletions

View File

@ -1,11 +1,35 @@
'use strict'; 'use strict';
const fs = require('fs').promises; const fs = require('fs').promises;
const inflect = require('inflect');
const tensify = require('tensify');
const dictionary = require('./dictionary.json'); const dictionary = require('./dictionary.json');
function getTenses(word) {
try {
const { past, past_participle: participle } = tensify(word);
return { past, participle };
} catch (error) {
return {};
}
}
async function init() { async function init() {
const validWords = Object.entries(dictionary).filter(([word]) => /^[a-zA-Z]+$/.test(word)); const formsDictionary = Object.fromEntries(Object.entries(dictionary).flatMap(([word, definition]) => {
const plural = inflect.pluralize(word);
const { past, participle } = getTenses(word);
return [
[word, definition],
...(plural && !dictionary[plural] ? [[plural, `Plural of ${word}`]] : []),
...(past && !dictionary[past] ? [[past, `Past tense of ${word}`]] : []),
...(participle && !dictionary[participle] ? [[past, `Past participle of ${word}`]] : []),
];
}));
const validWords = Object.entries(formsDictionary).filter(([word]) => /^[a-zA-Z]+$/.test(word));
const sortedWords = validWords.reduce((acc, [rawWord, fullDefinition]) => { const sortedWords = validWords.reduce((acc, [rawWord, fullDefinition]) => {
const word = rawWord.toLowerCase(); const word = rawWord.toLowerCase();

2191321
mash-words.json Normal file

File diff suppressed because it is too large Load Diff

108
package-lock.json generated
View File

@ -13,12 +13,14 @@
"bottleneck": "^2.19.5", "bottleneck": "^2.19.5",
"config": "^3.3.6", "config": "^3.3.6",
"html-entities": "^2.3.2", "html-entities": "^2.3.2",
"inflect": "^0.5.0",
"irc": "^0.5.2", "irc": "^0.5.2",
"irc-colors": "^1.5.0", "irc-colors": "^1.5.0",
"irc-upd": "^0.11.0", "irc-upd": "^0.11.0",
"jsdom": "^18.1.0", "jsdom": "^18.1.0",
"linkify-it": "^3.0.3", "linkify-it": "^3.0.3",
"simple-node-logger": "^21.8.12", "simple-node-logger": "^21.8.12",
"tensify": "^0.0.4",
"ws": "^8.2.3", "ws": "^8.2.3",
"yargs": "^17.2.1" "yargs": "^17.2.1"
}, },
@ -700,6 +702,17 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/apparatus": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/apparatus/-/apparatus-0.0.10.tgz",
"integrity": "sha512-KLy/ugo33KZA7nugtQ7O0E1c8kQ52N3IvD/XgIh4w/Nr28ypfkwDfA67F1ev4N1m5D+BOk1+b2dEJDfpj/VvZg==",
"dependencies": {
"sylvester": ">= 0.0.8"
},
"engines": {
"node": ">=0.2.6"
}
},
"node_modules/argparse": { "node_modules/argparse": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@ -2041,6 +2054,14 @@
"node": ">=0.8.19" "node": ">=0.8.19"
} }
}, },
"node_modules/inflect": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/inflect/-/inflect-0.5.0.tgz",
"integrity": "sha512-Wci3Towe5T2hOK98O6eFPHNZLClSITFgngOF+YkWgeO0r7t268oVm9Hb1ogcGDaa++EhIf/DxGLbeUbGpQ7H1g==",
"engines": {
"node": ">=10.19.0"
}
},
"node_modules/inflight": { "node_modules/inflight": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -2639,6 +2660,19 @@
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
"optional": true "optional": true
}, },
"node_modules/natural": {
"version": "0.1.29",
"resolved": "https://registry.npmjs.org/natural/-/natural-0.1.29.tgz",
"integrity": "sha512-l/lXX1uYFvPDp7MnAvPOf9Fz/7s+C2e8GECeyG1vXyMFq5KHoMRoaVgZbPuMfB0I0zHkG/jBCk+je7feSdYkpw==",
"dependencies": {
"apparatus": ">= 0.0.6",
"sylvester": ">= 0.0.12",
"underscore": ">=1.3.1"
},
"engines": {
"node": ">=0.4.10"
}
},
"node_modules/natural-compare": { "node_modules/natural-compare": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@ -3287,11 +3321,24 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/sylvester": {
"version": "0.0.21",
"resolved": "https://registry.npmjs.org/sylvester/-/sylvester-0.0.21.tgz",
"integrity": "sha512-yUT0ukFkFEt4nb+NY+n2ag51aS/u9UHXoZw+A4jgD77/jzZsBoSDHuqysrVCBC4CYR4TYvUJq54ONpXgDBH8tA==",
"engines": {
"node": ">=0.2.6"
}
},
"node_modules/symbol-tree": { "node_modules/symbol-tree": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
}, },
"node_modules/symbols": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/symbols/-/symbols-0.0.6.tgz",
"integrity": "sha512-0ZKKf3NMufUsozLyCegt0A6BGdRCqoy5LSFufZtJFjsvEQoHAEqAXJH5b3yBda0zNlR4AuXQ7PIF1Lma5Z3Dng=="
},
"node_modules/table": { "node_modules/table": {
"version": "5.4.6", "version": "5.4.6",
"resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
@ -3357,6 +3404,15 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/tensify": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/tensify/-/tensify-0.0.4.tgz",
"integrity": "sha512-GTMb+HdnwdlvWyVrguhHW5iTUFIRYeUpCT7+3qozRx6wf+IzG5k7HrZ4gBD4dA6Tazn0LxGNt4OpBUmbFSLiOg==",
"dependencies": {
"natural": "~0.1.25",
"symbols": "0.0.6"
}
},
"node_modules/text-table": { "node_modules/text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -3540,6 +3596,11 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/underscore": {
"version": "1.13.6",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz",
"integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
},
"node_modules/universalify": { "node_modules/universalify": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
@ -4305,6 +4366,14 @@
"color-convert": "^2.0.1" "color-convert": "^2.0.1"
} }
}, },
"apparatus": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/apparatus/-/apparatus-0.0.10.tgz",
"integrity": "sha512-KLy/ugo33KZA7nugtQ7O0E1c8kQ52N3IvD/XgIh4w/Nr28ypfkwDfA67F1ev4N1m5D+BOk1+b2dEJDfpj/VvZg==",
"requires": {
"sylvester": ">= 0.0.8"
}
},
"argparse": { "argparse": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@ -5350,6 +5419,11 @@
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
"dev": true "dev": true
}, },
"inflect": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/inflect/-/inflect-0.5.0.tgz",
"integrity": "sha512-Wci3Towe5T2hOK98O6eFPHNZLClSITFgngOF+YkWgeO0r7t268oVm9Hb1ogcGDaa++EhIf/DxGLbeUbGpQ7H1g=="
},
"inflight": { "inflight": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -5793,6 +5867,16 @@
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
"optional": true "optional": true
}, },
"natural": {
"version": "0.1.29",
"resolved": "https://registry.npmjs.org/natural/-/natural-0.1.29.tgz",
"integrity": "sha512-l/lXX1uYFvPDp7MnAvPOf9Fz/7s+C2e8GECeyG1vXyMFq5KHoMRoaVgZbPuMfB0I0zHkG/jBCk+je7feSdYkpw==",
"requires": {
"apparatus": ">= 0.0.6",
"sylvester": ">= 0.0.12",
"underscore": ">=1.3.1"
}
},
"natural-compare": { "natural-compare": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@ -6292,11 +6376,21 @@
"has-flag": "^4.0.0" "has-flag": "^4.0.0"
} }
}, },
"sylvester": {
"version": "0.0.21",
"resolved": "https://registry.npmjs.org/sylvester/-/sylvester-0.0.21.tgz",
"integrity": "sha512-yUT0ukFkFEt4nb+NY+n2ag51aS/u9UHXoZw+A4jgD77/jzZsBoSDHuqysrVCBC4CYR4TYvUJq54ONpXgDBH8tA=="
},
"symbol-tree": { "symbol-tree": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
}, },
"symbols": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/symbols/-/symbols-0.0.6.tgz",
"integrity": "sha512-0ZKKf3NMufUsozLyCegt0A6BGdRCqoy5LSFufZtJFjsvEQoHAEqAXJH5b3yBda0zNlR4AuXQ7PIF1Lma5Z3Dng=="
},
"table": { "table": {
"version": "5.4.6", "version": "5.4.6",
"resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
@ -6349,6 +6443,15 @@
} }
} }
}, },
"tensify": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/tensify/-/tensify-0.0.4.tgz",
"integrity": "sha512-GTMb+HdnwdlvWyVrguhHW5iTUFIRYeUpCT7+3qozRx6wf+IzG5k7HrZ4gBD4dA6Tazn0LxGNt4OpBUmbFSLiOg==",
"requires": {
"natural": "~0.1.25",
"symbols": "0.0.6"
}
},
"text-table": { "text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -6512,6 +6615,11 @@
"which-boxed-primitive": "^1.0.2" "which-boxed-primitive": "^1.0.2"
} }
}, },
"underscore": {
"version": "1.13.6",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz",
"integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
},
"universalify": { "universalify": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",

View File

@ -22,12 +22,14 @@
"bottleneck": "^2.19.5", "bottleneck": "^2.19.5",
"config": "^3.3.6", "config": "^3.3.6",
"html-entities": "^2.3.2", "html-entities": "^2.3.2",
"inflect": "^0.5.0",
"irc": "^0.5.2", "irc": "^0.5.2",
"irc-colors": "^1.5.0", "irc-colors": "^1.5.0",
"irc-upd": "^0.11.0", "irc-upd": "^0.11.0",
"jsdom": "^18.1.0", "jsdom": "^18.1.0",
"linkify-it": "^3.0.3", "linkify-it": "^3.0.3",
"simple-node-logger": "^21.8.12", "simple-node-logger": "^21.8.12",
"tensify": "^0.0.4",
"ws": "^8.2.3", "ws": "^8.2.3",
"yargs": "^17.2.1" "yargs": "^17.2.1"
}, },