Browse Source

Made pep8 compliant

cache_money
Raphael Roberts 7 years ago
parent
commit
d5c11a8318
  1. 17
      main.py

17
main.py

@ -2,7 +2,9 @@
import re
import itertools
from spellchecker import SpellChecker
SPELL= SpellChecker()
SPELL = SpellChecker()
def canidates(letters, min=2, max=5):
pos = []
for length in range(min, max+1):
@ -12,9 +14,11 @@ def canidates(letters, min=2, max=5):
pos.append(word)
return SPELL.known(pos)
def filter_pos(pos, regex):
pat = re.compile(regex + '$')
return list(filter(pat.match,pos))
return list(filter(pat.match, pos))
while True:
letters = input('Enter letters: ')
@ -22,12 +26,13 @@ while True:
break
pos = canidates(letters)
inp = None
while inp not in (":quit:",":new:"):
while inp not in (":quit:", ":new:"):
if inp is not None:
for word in filter_pos(pos, inp):
print('>>>',word)
print('Letters: ',','.join(letters))
prompt = "Enter pattern, ':new:' for new letters,\nor ':quit:' to exit: "
print('>>>', word)
print('Letters: ', ','.join(letters))
prompt = """Enter pattern, ':new:' for new letters,
or ':quit:' to exit: """
inp = input(prompt)
if inp == ":quit:":
break
Loading…
Cancel
Save