You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
search_dates() silently drops a French date when STRICT_PARSING=True and multiple languages are passedΒ #1326
"""
Bug: search_dates() silently drops a French date when STRICT_PARSING=True and multiple languages are passed,
if the string ends with a bare uppercase token that is a valid ISO 639-1 language code (e.g. "FR").
importdateparserimportdateparser.searchprint("dateparser version:", dateparser.__version__)
TEXT="Date de facture 23 juillet 2020 Condition Redevable livraison FR"# Works β single language, no ambiguity for the language detectorr1=dateparser.search.search_dates(TEXT, languages=["fr"], settings={"STRICT_PARSING": True})
# Fails β same string, same settings, but 7 languages passedr2=dateparser.search.search_dates(TEXT, languages=["en", "fr", "es", "pt", "de", "it", "ar"], settings={"STRICT_PARSING": True})
print(f"languages=['fr'], STRICT_PARSING=True β {r1}") # Expected: [('23 juillet 2020', datetime(...))]print(f"languages=[7 langs], STRICT_PARSING=True β {r2}") # Bug: Noneassertr1isnotNone, "Baseline broken"assertr2isnotNone, f"BUG: date not found when multiple languages passed β got {r2}"
Note that it works well when we remove FR in this input TEXT
It works also if we replace FR with EN or US or Frn
Activity