Added word blacklist for lowercase names. Improved definition curation.

This commit is contained in:
ThePendulum
2024-07-04 22:55:54 +02:00
parent f46d5f008b
commit 234bbb2bbc
5 changed files with 24 additions and 13 deletions
+6 -10
View File
@@ -3,18 +3,14 @@
const fs = require('fs').promises;
const words = require('./words.json');
const dictionary = require('./dictionary_old.json');
const wordsBlacklist = require('./words_blacklist.json');
const dictionary = require('./dictionary.json');
// mainly lowercase names
const blacklist = new Set(wordsBlacklist);
async function init() {
const notNameWords = words.filter((word) => word.charAt(0) === word.charAt(0).toLowerCase()); // don't include names for places, products, people, etc.
/*
words.forEach((word) => {
if (word.charAt(0) === word.charAt(0).toUpperCase()) {
console.log(word);
}
});
*/
const notNameWords = words.filter((word) => word.charAt(0) === word.charAt(0).toLowerCase() && !blacklist.has(word)); // don't include names for places, products, people, etc.
const definitions = Object.fromEntries(notNameWords.map((word) => {
const normalizedWord = word.normalize('NFD').replace(/\p{Diacritic}/ug, '').toLowerCase().trim();