Skip to content

Instantly share code, notes, and snippets.

@Ghost---Shadow
Last active October 20, 2017 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ghost---Shadow/34bb294c82ba06f829e6ab8a8c394d0e to your computer and use it in GitHub Desktop.
Save Ghost---Shadow/34bb294c82ba06f829e6ab8a8c394d0e to your computer and use it in GitHub Desktop.
Filters all english words which are valid addresses
# 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