mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Let's make sure people can't run levenshtein (an O(n**3) algorithm) on large inputs. I gave it to lambdaman almost 10 minutes ago and it's still not finished.
This commit is contained in:
parent
2259e9d8b6
commit
ad0ffd2752
@ -290,6 +290,10 @@ class Fun(callbacks.Privmsg):
|
||||
between <string1> and <string2>)
|
||||
"""
|
||||
(s1, s2) = privmsgs.getArgs(args, required=2)
|
||||
if len(s1) > 512 or len(s2) > 512:
|
||||
irc.error('Levenshtein distance is a complicated algorithm, try '
|
||||
'it with some smaller inputs.')
|
||||
else:
|
||||
irc.reply(str(utils.distance(s1, s2)))
|
||||
|
||||
def soundex(self, irc, msg, args):
|
||||
|
Loading…
Reference in New Issue
Block a user