diff options
-rw-r--r-- | fuzzycat/utils.py | 7 | ||||
-rw-r--r-- | fuzzycat/verify.py | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/fuzzycat/utils.py b/fuzzycat/utils.py index e4d7bdc..7f08fa3 100644 --- a/fuzzycat/utils.py +++ b/fuzzycat/utils.py @@ -10,10 +10,15 @@ printable_no_punct = string.digits + string.ascii_letters + string.whitespace # More correct: https://www.johndcook.com/blog/2016/02/04/regular-expression-to-match-a-chemical-element/ CHEM_FORMULA = re.compile(r"([A-Z]{1,2}[0-9]{1,2})+") +def parse_page_string(s): + """ + Parse typical page strings, e.g. 150-180. + """ + raise NotImplementedError() def dict_key_exists(doc, path): """ - Return true, if a value at a given path exists. XXX: probably in glom, too. + Return true, if key at a given path exists. XXX: probably already in glom. """ try: _ = glom(doc, path) diff --git a/fuzzycat/verify.py b/fuzzycat/verify.py index d73dbdc..bd8e69b 100644 --- a/fuzzycat/verify.py +++ b/fuzzycat/verify.py @@ -579,6 +579,7 @@ def verify(a: Dict, b: Dict, min_title_length=5) -> Tuple[str, str]: try: a_pages = glom(a, "pages") b_pages = glom(b, "pages") + # XXX: Pages might be of the form "261-5", meaning: 261-265. page_pattern = re.compile("([0-9]{1,})-([0-9]{1,})") a_match = page_pattern.match(a_pages) b_match = page_pattern.match(b_pages) |