aboutsummaryrefslogtreecommitdiff
path: root/ponysay.py
diff options
context:
space:
mode:
Diffstat (limited to 'ponysay.py')
-rwxr-xr-xponysay.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ponysay.py b/ponysay.py
index 44ff009..502b85f 100755
--- a/ponysay.py
+++ b/ponysay.py
@@ -319,7 +319,7 @@ class Ponysay():
if not alt:
autocorrect = SpelloCorrecter(ponydirs, '.pony')
(alternatives, dist) = autocorrect.correct(pony)
- if len(alternatives) > 0:
+ if (len(alternatives) > 0) and (dist <= 5): # TODO the limit `dist` should be configureable
return self.__getponypath(alternatives, True)
sys.stderr.write('I have never heard of anypony named %s\n' % (pony));
exit(1)
@@ -672,8 +672,8 @@ class Ponysay():
if balloon not in balloons:
if not alt:
autocorrect = SpelloCorrecter(balloondirs, '.think' if isthink else '.say')
- alternatives = autocorrect.correct(balloon)[0]
- if len(alternatives) > 0:
+ (alternatives, dist) = autocorrect.correct(balloon)
+ if (len(alternatives) > 0) and (dist <= 5): # TODO the limit `dist` should be configureable
return self.__getponypath(alternatives, True)
sys.stderr.write('That balloon style %s does not exist\n' % (balloon));
exit(1)