mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-02 13:12:50 +00:00
fix(verify_pdf): --ascii-dates needs digit boundaries around the year (#512)
_YEAR matched (19|20)\d{2} anywhere, so `2000` inside `120000` or `12000`
made a budget or throughput range typed with `--` read as an en-dashed
date range: "Grew budget DKK 120000-200000" and "12000-15000 events/s"
both failed /apply Step 5d, and the agent was sent to fix a date argument
that does not exist. The guide promises a numeric range with no year is
left alone.
Bound the year with (?<!\d) and (?!\d). "2016-2024" next to a longer
number is still caught. Two new cases; the numeric one fails on the
unbounded pattern.
This commit is contained in:
1 parent
27a9b4a91d
commit
52f84e0f82
3 files changed
+21
-1
No files matched your search
+3
-1
@@ -94,7 +94,9 @@ def normalize_text(text):
|
||||
# rest are the other Unicode dashes and the minus sign, which a parser that splits
|
||||
# a range only on U+002D treats the same way.
|
||||
NON_ASCII_DASHES = "\u2010\u2011\u2012\u2013\u2014\u2015\u2212"
|
||||
_YEAR = r"(?:19|20)\d{2}"
|
||||
# A year is four digits standing alone: without the digit boundaries, `2000`
|
||||
# inside `120000` or `12000` made a budget or throughput range read as a date.
|
||||
_YEAR = r"(?<!\d)(?:19|20)\d{2}(?!\d)"
|
||||
# Horizontal whitespace only between the year and the dash: `\s*` also matched
|
||||
# a newline, so a year ending one line joined a dash opening the next (a bullet,
|
||||
# a wrapped prose line) and an ASCII date was reported as U+2013.
|
||||
|
||||
Reference in new issue
Block a user