Gist Overview: Create a comprehensive list of English words.
On MacOS: Copy /usr/share/dict/words as words.txt
Free: https://www.gutenberg.org/ebooks/3201
The SINGLES.txt list here is comprehensive: https://www.gutenberg.org/files/3201/files/
(async () => {
const fs = require('fs');
const readline = require('readline');
const words_source = 'Moby Word Lists by Grady Ward-SINGLE.txt';
const file_stream = fs.createReadStream(words_source);
const readline_interface = readline.createInterface({ input: file_stream, crlfDelay: Infinity });
const dictionary_path = 'words.txt';
if (fs.existsSync(dictionary_path)) fs.unlinkSync(dictionary_path);
for await (const word of readline_interface) {
const valid_length = word.length > 2; // remove 2-letter words
const valid_case = /^[a-z]/.test(word); // remove proper names, places, and anything with non-word characters
const is_valid = [valid_length,valid_case].every(rule => !!rule);
if(!is_valid) continue;
fs.appendFileSync(dictionary_path, `${word}\n`);
console.log(word)
}
console.log('Finished...')
})();