dwyl / english-words

:memo: A text file containing 479k English words for all your dictionary/word-based projects e.g: auto-completion / autosuggestion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

read_english_dictionary.py not working

micksulley opened this issue · comments

I have copied read_english_dictionary.py and words_alpha.txt. When I run the code it just returns 'false'
If I add print(english_words) it prints what looks like the file contents, but not a recognisable list of English words
Am I missing something here?
Mick

commented

Hi @micksulley, 👋
thanks for opening this issue to report your pain with read_english_dictionary.py ... 😢

As it stands the file is considered "sample code":

def load_words():
with open('words_alpha.txt') as word_file:
valid_words = set(word_file.read().split())
return valid_words
if __name__ == '__main__':
english_words = load_words()
# demo print
print('fate' in english_words)

Not really something we are actively using in any of our projects.
Perhaps we should write a test and run it on GitHub Actions CI to verify that it works. 💭