Update __init__.py

update similarity_distance weights
This commit is contained in:
huyingxi 2017-12-30 23:22:35 +08:00 committed by GitHub
parent de23685fd7
commit 54a978e63e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,8 +219,8 @@ def _similarity_distance(s1, s2):
# https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.linalg.norm.html
g = 1 / (np.linalg.norm(a - b) + 1)
u = _levenshtein_distance(s1, s2)
r = g * 1.4 + u * 0.2
r = min((r * 10 + 0.1), 1.0)
r = g * 1.8 + u * 0.4
r = min((r * 18), 1.0)
return float("%.3f" % r)