From 7c5d6a600b4fb620881cd5c32b5947462d9cf6b3 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 18 Aug 2020 01:18:33 +0200 Subject: stub: command line --- fuzzycat/fatcat/main.py | 16 ++++++++++++++-- fuzzycat/fatcat/matching.py | 6 +++--- tests/test_matching.py | 3 +-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/fuzzycat/fatcat/main.py b/fuzzycat/fatcat/main.py index 9113d8f..805e69e 100644 --- a/fuzzycat/fatcat/main.py +++ b/fuzzycat/fatcat/main.py @@ -1,8 +1,20 @@ # coding: utf-8 - """ Command line entry point for ad-hoc testing. """ +from fatcat_openapi_client import ReleaseEntity, ReleaseExtIds +from fuzzycat.fatcat.matching import match_release_fuzzy +import argparse + + def main(): - print("fuzzycat fatcat matching") \ No newline at end of file + parser = argparse.ArgumentParser() + parser.add_argument("-R", "--release", help="match release", action="store_true") + parser.add_argument("-t", "--title", help="title") + + args = parser.parse_args() + + if args.release and args.title: + re = ReleaseEntity(title=args.title, ext_ids=ReleaseExtIds()) + print(match_release_fuzzy(re, es="https://search.fatcat.wiki")) diff --git a/fuzzycat/fatcat/matching.py b/fuzzycat/fatcat/matching.py index 3ce8269..ba0fef5 100644 --- a/fuzzycat/fatcat/matching.py +++ b/fuzzycat/fatcat/matching.py @@ -239,7 +239,7 @@ def verify_container_name(a: str, b: str) -> MatchStatus: status = verify_serial_name(a, b) if status != MatchStatus.AMBIGIOUS: return status - + # TODO: add additional verification, string match and common patterns. @@ -269,5 +269,5 @@ def verify_release_match(a: ReleaseEntity, b: ReleaseEntity) -> MatchStatus: return MatchStatus.DIFFERENT if cmp_result["hits"] < cmp_result["misses"]: return MatchStatus.AMBIGIOUS - - # TODO: do title verification, apply string cleanups, etc. \ No newline at end of file + + # TODO: do title verification, apply string cleanups, etc. diff --git a/tests/test_matching.py b/tests/test_matching.py index dcaa6bf..6ae393b 100644 --- a/tests/test_matching.py +++ b/tests/test_matching.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ Test cases for fuzzy matching. -""" \ No newline at end of file +""" -- cgit v1.2.3