From fd6c910bd98ddec0a5b7d1b73f872fb7fec55241 Mon Sep 17 00:00:00 2001 From: wassname Date: Wed, 25 Dec 2019 08:08:28 +0800 Subject: [PATCH] similarity fix and comment --- story/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/story/utils.py b/story/utils.py index 5a59fb1..087d435 100644 --- a/story/utils.py +++ b/story/utils.py @@ -24,10 +24,11 @@ def console_print(text, width=75): #TODO: get rid if pyjarowinker dependency +# (AOP) You could use a simpler method, but this has been reported by RebootTech as a much more accurate way to compare strings. It also helps clean up the history. So it will hurt ability to check for looping def get_similarity(a, b): + if len(a)==0 or len(b)==0: return 1 return distance.get_jaro_distance( - a, b, winkler=True, scaling = 0.1 - ) + a, b, winkler=True, scaling = 0.1) def get_num_options(num):