aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-08-18 01:18:33 +0200
committerMartin Czygan <martin.czygan@gmail.com>2020-08-18 01:18:33 +0200
commit7c5d6a600b4fb620881cd5c32b5947462d9cf6b3 (patch)
treed366dec67f5af2a201330449e24d528509287b3c
parent84277d2ea066c35361a2778081677d4a9ba43833 (diff)
downloadfuzzycat-7c5d6a600b4fb620881cd5c32b5947462d9cf6b3.tar.gz
fuzzycat-7c5d6a600b4fb620881cd5c32b5947462d9cf6b3.zip
stub: command line
-rw-r--r--fuzzycat/fatcat/main.py16
-rw-r--r--fuzzycat/fatcat/matching.py6
-rw-r--r--tests/test_matching.py3
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
+"""