Provide Unicode to Jellyfish 0.5.0

The new version requires arguments are Unicode. We were providing ASCII byte
strings, produced by Unidecode. We now re-decode this back to Unicode before
passing to the Levenshtein function.
This commit is contained in:
Adrian Sampson 2015-04-23 15:25:47 -07:00
parent 99d19f85d1
commit 0e3f6cb09d
2 changed files with 5 additions and 2 deletions

View file

@ -203,8 +203,10 @@ def _string_dist_basic(str1, str2):
transliteration/lowering to ASCII characters. Normalized by string
length.
"""
str1 = unidecode(str1)
str2 = unidecode(str2)
assert isinstance(str1, unicode)
assert isinstance(str2, unicode)
str1 = unidecode(str1).decode('ascii')
str2 = unidecode(str2).decode('ascii')
str1 = re.sub(r'[^a-z0-9]', '', str1.lower())
str2 = re.sub(r'[^a-z0-9]', '', str2.lower())
if not str1 and not str2:

View file

@ -10,6 +10,7 @@ Fixes:
respects the ``write`` config option under ``import``. If this is disabled,
album art is no longer embedded on import in order to leave files
untouched---in effect, ``auto`` is implicitly disabled. :bug:`1427`
* Fix compatibility with `Jellyfish`_ version 0.5.0.
1.3.12 (April 18, 2015)