diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-11-05 17:19:07 +0100 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-11-16 18:58:42 +0100 |
commit | 0c84af603894049dd8edd95da18d8990ab0516d1 (patch) | |
tree | 08fb4ad2b3a498e2edac73972f97e427e0194759 /fuzzycat/sandcrawler.py | |
parent | 282f315c6ba3643c8c614220ab2f7e1d55de3658 (diff) | |
download | fuzzycat-0c84af603894049dd8edd95da18d8990ab0516d1.tar.gz fuzzycat-0c84af603894049dd8edd95da18d8990ab0516d1.zip |
turn "match_release_fuzzy" into a class
Goal of this refactoring was to make the matching process a bit more
configurable by using a class and a cascade of queries.
For a limited test set: `FuzzyReleaseMatcher.match` is works the same as
`match_release_fuzzy`.
Diffstat (limited to 'fuzzycat/sandcrawler.py')
-rw-r--r-- | fuzzycat/sandcrawler.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fuzzycat/sandcrawler.py b/fuzzycat/sandcrawler.py index 958756a..63b85e6 100644 --- a/fuzzycat/sandcrawler.py +++ b/fuzzycat/sandcrawler.py @@ -1,6 +1,7 @@ -import regex import unicodedata +import regex + # from http://zderadicka.eu/removing-diacritics-marks-from-strings/ SANDCRAWLER_CHAR_MAP = { '\N{Latin capital letter AE}': 'AE', @@ -63,6 +64,7 @@ SANDCRAWLER_REMOVE_CHAR_REGEX = regex.compile( r"[\s\p{Punctuation}\p{M}\p{InCombiningDiacriticalMarks}\u2000-\u206F\u2E00-\u2E7F’·“”‘’“”«»「」¿–±§_`°ʖ©®¤=<>|+$^~≈√∫≤≥÷ƒ∆¬£¢∞¥◊€]" ) + def sandcrawler_slugify(raw: str) -> str: """ Python re-implementation of sandcrawler Scala code for string comparison @@ -155,4 +157,3 @@ def test_sandcrawler_slugify() -> None: print(unicodedata.name(c)) print(in_str) assert sandcrawler_slugify(in_str) == out_str - |