Files
wordle/dictionary.py
T

79 lines
1.3 KiB
Python

#!/usr/bin/python
WORDLE_LENGTH = 5
_invalid_words = set(
[
"amala",
"arara",
"araru",
"araua",
"arawa",
"balak",
"batak",
"bayal",
"beala",
"beata",
"beele",
"boily",
"bolty",
"bruke",
"carlo",
"caroa",
"carot",
"carum",
"divet",
"doray",
"erept",
"fikie",
"genae",
"ghole",
"gotra",
"hirse",
"hyrse",
"katat",
"korah",
"macco",
"mitra",
"muang",
"nurry",
"odell",
"odell",
"petro",
"pindy",
"quito",
"retan",
"roter",
"sisel",
"skeel",
"staia",
"stail",
"sussy",
"tebet",
"telae",
"theet",
"undig",
"uninn",
"unkin",
"vedet",
"whalm",
"whaly",
]
)
_wordle_dictionary = set()
def words():
if not _wordle_dictionary:
with open("words_alpha.txt") as word_file:
all_words = word_file.read().split()
_wordle_dictionary.update(
filter(
lambda w: len(w) == WORDLE_LENGTH and w not in _invalid_words, all_words
)
)
return _wordle_dictionary