diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2020-12-04 18:15:01 +0100 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2020-12-04 18:15:01 +0100 |
commit | fd4ebf09519ce511f02ad71d8aed7a57a7a03199 (patch) | |
tree | b2a18764ebf02b3c1587c4f49253e57f6be10cab /fuzzycat | |
parent | 1b0309499ee59384eba074709a3440019141a31e (diff) | |
download | fuzzycat-fd4ebf09519ce511f02ad71d8aed7a57a7a03199.tar.gz fuzzycat-fd4ebf09519ce511f02ad71d8aed7a57a7a03199.zip |
publications over N year apart are most likely different
N=40 hardcoded for now, but should be probably a parameter.
Diffstat (limited to 'fuzzycat')
-rw-r--r-- | fuzzycat/verify.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fuzzycat/verify.py b/fuzzycat/verify.py index 0457e92..a223e48 100644 --- a/fuzzycat/verify.py +++ b/fuzzycat/verify.py @@ -138,6 +138,9 @@ class GroupVerifier: def compare(a, b): """ Compare two entities, return match status and reason. + + TODO: We might want a bunch of kwargs for things like year gap threshold + and the like. """ try: if glom(a, "ext_ids.doi") == glom(b, "ext_ids.doi"): @@ -215,7 +218,6 @@ def compare(a, b): if re.match(r"appendix ?[^ ]*$", a_title_lower): return (Status.AMBIGUOUS, Miss.APPENDIX) - try: # TODO: figshare versions, "xxx.v1" FIGSHARE_PREFIX = "10.6084/" @@ -314,6 +316,14 @@ def compare(a, b): a_slug_title = slugify_string(a.get("title", "")).replace("\n", " ") b_slug_title = slugify_string(b.get("title", "")).replace("\n", " ") + # https://fatcat.wiki/release/psykbwxylndtdaand2ymtkgzqu + # https://fatcat.wiki/release/xizkwvsodzajnn4u7lgeldqoum + if a_slug_title == b_slug_title: + a_year = a.get("release_year") + b_year = b.get("release_year") + if a_year and b_year and abs(a_year - b_year) > 40: + return (Status.DIFFERENT, Miss.YEAR) + if a_slug_title == b_slug_title: # via: https://fatcat.wiki/release/ij3yuoh6lrh3tkrv5o7gfk6yyi # https://fatcat.wiki/release/tur236mqljdfdnlzbbnks2sily @@ -446,7 +456,6 @@ def compare(a, b): except PathAccessError: pass - return (Status.AMBIGUOUS, OK.DUMMY) |