From 0c84af603894049dd8edd95da18d8990ab0516d1 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Fri, 5 Nov 2021 17:19:07 +0100 Subject: 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`. --- fuzzycat/verify.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'fuzzycat/verify.py') diff --git a/fuzzycat/verify.py b/fuzzycat/verify.py index 9eb808b..f570511 100644 --- a/fuzzycat/verify.py +++ b/fuzzycat/verify.py @@ -233,10 +233,9 @@ def verify(a: Dict, b: Dict, min_title_length=5) -> Tuple[str, str]: if has_doi_prefix(a_doi, "10.3403") and has_doi_prefix(b_doi, "10.3403"): if a_doi + "u" == b_doi or b_doi + "u" == a_doi: return Verify(Status.STRONG, Reason.CUSTOM_BSI_UNDATED) - if a_title == b_title and ((dict_has_key(a, "extra.subtitle") - and not dict_has_key(b, "extra.subtitle")) or - (dict_has_key(b, "extra.subtitle") - and not dict_has_key(a, "extra.subtitle"))): + if a_title == b_title and ( + (dict_has_key(a, "extra.subtitle") and not dict_has_key(b, "extra.subtitle")) or + (dict_has_key(b, "extra.subtitle") and not dict_has_key(a, "extra.subtitle"))): return Verify(Status.STRONG, Reason.CUSTOM_BSI_SUBDOC) except PathAccessError: pass -- cgit v1.2.3