Last active
October 20, 2017 15:41
-
-
Save Ghost---Shadow/34bb294c82ba06f829e6ab8a8c394d0e to your computer and use it in GitHub Desktop.
Filters all english words which are valid addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www-01.sil.org/linguistics/wordlists/english/wordlist/wordsEn.txt | |
with open("./wordsEn.txt") as word_file: | |
english_words = set(word.strip().lower() for word in word_file) | |
matches = [] | |
WORD_LEN = 4 | |
for word in english_words: | |
if len(word) == WORD_LEN: | |
acceptable = True | |
for i in range(WORD_LEN): | |
if not(ord(word[i]) in range(ord('a'),ord('g')) or \ | |
ord(word[i]) == ord('o')): | |
acceptable = False | |
break | |
if acceptable: | |
matches.append(word) | |
for word in matches: | |
print(word.replace('o','0')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment