Skip to content

Commit 0be512c

Browse files
authored
Merge pull request #17 from LargeKnome/revert-16-spelling
patch still has bug
2 parents 915f9c1 + 2cb1714 commit 0be512c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

project/spelling/misspell.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,15 @@ def misspell(word, errors=1):
198198
else:
199199
possible = consonants.replace_middle[grapheme.phoneme]
200200

201-
possible = {k: v for k, v in possible.items() if k != grapheme.letters}
202-
203-
if len(possible.keys()) == 0:
204-
final_word += grapheme.letters
205-
else:
201+
possible = {
202+
k: v for k, v in possible.items() if k != grapheme.letters
203+
}
204+
try:
206205
final_word += random_consonant(possible)
207206

207+
except TypeError:
208+
break
209+
208210
current_consonant += 1
209211

210212
return final_word

0 commit comments

Comments
 (0)