mirror of
https://github.com/beetbox/beets.git
synced 2025-12-23 00:54:03 +01:00
fix divide-by-zero when !!! is involved
This commit is contained in:
parent
34e85171a5
commit
c00dce80e8
1 changed files with 2 additions and 2 deletions
|
|
@ -157,10 +157,10 @@ def _string_dist_basic(str1, str2):
|
|||
"""Basic edit distance between two strings, ignoring
|
||||
non-alphanumeric characters and case. Normalized by string length.
|
||||
"""
|
||||
if not str1 and not str2:
|
||||
return 0.0
|
||||
str1 = re.sub(r'[^a-z0-9]', '', str1.lower())
|
||||
str2 = re.sub(r'[^a-z0-9]', '', str2.lower())
|
||||
if not str1 and not str2:
|
||||
return 0.0
|
||||
return _levenshtein(str1, str2) / float(max(len(str1), len(str2)))
|
||||
|
||||
def string_dist(str1, str2):
|
||||
|
|
|
|||
Loading…
Reference in a new issue