commit
7883b42dfa
|
@ -7,13 +7,14 @@ from .porter import Stemmer
|
|||
def _normalize(s):
|
||||
return unicodedata.normalize('NFKD', s)
|
||||
|
||||
def _check_type(s):
|
||||
|
||||
def _check_type(s):
|
||||
if IS_PY3 and not isinstance(s, str):
|
||||
raise TypeError('expected str or unicode, got %s' % type(s).__name__)
|
||||
elif not IS_PY3 and not isinstance(s, unicode):
|
||||
raise TypeError('expected unicode, got %s' % type(s).__name__)
|
||||
|
||||
|
||||
def levenshtein_distance(s1, s2):
|
||||
_check_type(s1)
|
||||
_check_type(s2)
|
||||
|
@ -311,7 +312,7 @@ def nysiis(s):
|
|||
|
||||
def match_rating_codex(s):
|
||||
_check_type(s)
|
||||
|
||||
|
||||
s = s.upper()
|
||||
codex = []
|
||||
|
||||
|
|
|
@ -112,7 +112,6 @@ if platform.python_implementation() == 'CPython':
|
|||
# this segfaulted on 0.1.2
|
||||
assert [[jf.match_rating_comparison(h1, h2) for h1 in sha1s] for h2 in sha1s]
|
||||
|
||||
|
||||
def test_damerau_levenshtein_unicode_segfault():
|
||||
# unfortunate difference in behavior between Py & C versions
|
||||
from jellyfish.cjellyfish import damerau_levenshtein_distance as c_dl
|
||||
|
|
Loading…
Reference in New Issue