Compare commits
No commits in common. "29cbd77e35e13a5e68835d2bc8833331d82a2217" and "5cc3a428f37f0107f8e708fa823b0607bf62d966" have entirely different histories.
29cbd77e35
...
5cc3a428f3
|
@ -1,11 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs').promises;
|
const fs = require('fs').promises;
|
||||||
|
|
||||||
/*
|
|
||||||
const inflect = require('inflect');
|
const inflect = require('inflect');
|
||||||
const tensify = require('tensify');
|
const tensify = require('tensify');
|
||||||
|
|
||||||
|
const dictionary = require('./dictionary.json');
|
||||||
|
|
||||||
function getTenses(word) {
|
function getTenses(word) {
|
||||||
try {
|
try {
|
||||||
const { past, past_participle: participle } = tensify(word);
|
const { past, past_participle: participle } = tensify(word);
|
||||||
|
@ -15,26 +15,21 @@ function getTenses(word) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
const dictionary = require('./dictionary.json');
|
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
/*
|
|
||||||
const formsDictionary = Object.fromEntries(Object.entries(dictionary).flatMap(([word, definition]) => {
|
const formsDictionary = Object.fromEntries(Object.entries(dictionary).flatMap(([word, definition]) => {
|
||||||
const plural = inflect.pluralize(word);
|
const plural = inflect.pluralize(word);
|
||||||
const { past, participle } = getTenses(word);
|
const { past, participle } = getTenses(word);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
[word, definition],
|
[word, definition],
|
||||||
...(plural && !dictionary[plural] ? [[plural, definition]] : []),
|
...(plural && !dictionary[plural] ? [[plural, `Plural of ${word}`]] : []),
|
||||||
...(past && !dictionary[past] ? [[past, definition]] : []),
|
...(past && !dictionary[past] ? [[past, `Past tense of ${word}`]] : []),
|
||||||
...(participle && !dictionary[participle] ? [[past, definition]] : []),
|
...(participle && !dictionary[participle] ? [[past, `Past participle of ${word}`]] : []),
|
||||||
];
|
];
|
||||||
}));
|
}));
|
||||||
*/
|
|
||||||
|
|
||||||
const validWords = Object.entries(dictionary).filter(([word]) => /^[a-zA-Z]+$/.test(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();
|
||||||
|
|
30194
assets/dictionary.json
30194
assets/dictionary.json
File diff suppressed because one or more lines are too long
|
@ -10,9 +10,9 @@ async function init() {
|
||||||
const normalizedWord = word.normalize('NFD').replace(/\p{Diacritic}/ug, '').toLowerCase().trim();
|
const normalizedWord = word.normalize('NFD').replace(/\p{Diacritic}/ug, '').toLowerCase().trim();
|
||||||
const definition = dictionary[normalizedWord];
|
const definition = dictionary[normalizedWord];
|
||||||
const singular = normalizedWord.replace(/s$/, '');
|
const singular = normalizedWord.replace(/s$/, '');
|
||||||
const singularDefinition = dictionary[singular];
|
const singularDefinition = dictionary[singular] ? `Plural of ${singular}: ${dictionary[singular]}` : null;
|
||||||
|
|
||||||
return [normalizedWord, definition || singularDefinition || null];
|
return [normalizedWord, definition || singularDefinition];
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const string = JSON.stringify(definitions, null, 4);
|
const string = JSON.stringify(definitions, null, 4);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.29.5",
|
"version": "1.29.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.29.5",
|
"version": "1.29.4",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^8.3.0",
|
"better-sqlite3": "^8.3.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.29.5",
|
"version": "1.29.4",
|
||||||
"description": "Game host for SChat 2-powered chat sites",
|
"description": "Game host for SChat 2-powered chat sites",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue