A range that opens at the anchor answers the anchor: "until easter", "before christmas", "hasta mañana"

Aperta
#659 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Read _instant in ovos_date_parser/__init__.py and the holiday handling in ovos_date_parser/holidays.py, then review the linked locale tests in ovos-date-parser#638. Reproduce one failing case using the provided extract_datetime call and compare its output with the test assertion. The issue leaves the intended interpretation of ranges that begin at the anchor as a design decision; agree on that behavior before changing the adapter, then remove the strict xfail marks when the tests pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

🤖 Auto-generated by Claude Opus 5.5 (claude-opus-5-5) via Claude Code — NOT human-reviewed. Verify before acting.

Observed

extract_datetime answers a range that opens at the anchor with its start, so "until easter", "before christmas" and "hasta mañana" give the anchor itself. chronologia reads each one as the range from now to the date, which is correct for a span. The adapter _instant picks the start of every span that is not a band or an exact time, and the holiday layer no longer replaces the answer.

ovos-date-parser routes every locale chronologia reads to chronologia (OpenVoiceOS/ovos-date-parser#638). Each row below is a test there that carries xfail(strict=True) with a link to this issue. When the row is fixed, the test passes, strict mode reports XPASS, and the mark comes off.

Expected

Each family below names the expected reading with its ruling or source. The test assertion column holds the value the test pins.

Reproduce

On chronologia 0.32.8a1 (PyPI), at the head of that pull request:

from datetime import datetime
from ovos_date_parser import extract_datetime

extract_datetime(TEXT, LANG, anchorDate=datetime.fromisoformat(ANCHOR))

The legacy column is the same call with the locale taken out of CHRONOLOGIA_LOCALES.

Verified by machine: every legacy and chronologia value was computed by running the call above. Not verified by a person: the expected values, which a model wrote.

Where

_instant in ovos_date_parser/__init__.py, and the holiday layer in ovos_date_parser/holidays.py. The legacy reader answered the date that the range reaches, with the preposition left over.

Rows

until-range-start: 8 tests

"until " and "before " answer the start of the range, the anchor. The tests pin the legacy answer: the date named, with the preposition left over. Which instant answers a range that opens at the anchor is a design question for the adapter, not a chronologia defect.

lang text anchor legacy reader chronologia 0.32.8a1 test assertion
es-ES hasta mañana 2026-10-17T12:00:00+01:00 2026-10-18 00:00:00 'hasta' 2026-10-17 12:00:00 '' AssertionError: datetime.datetime(2026, 10, 17, 12, 0) != datetime.datetime(2026, 10, 18, 0, 0)
en-US until easter 2026-09-25T12:00:00 2027-03-28 00:00:00 'until' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat..., 0), 'until') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
en-US before christmas 2026-09-25T12:00:00 2026-12-25 00:00:00 'before' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0), 'before') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
fr-FR avant noël 2026-09-25T12:00:00 2026-12-25 00:00:00 'avant' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat..., 0), 'avant') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
es-ES hasta navidad 2026-09-25T12:00:00 2026-12-25 00:00:00 'hasta' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat..., 0), 'hasta') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
de-DE bis Weihnachten 2026-09-25T12:00:00 2026-12-25 00:00:00 'bis' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0, 0), 'bis') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
nl-NL tot kerst 2026-09-25T12:00:00 2026-12-25 00:00:00 'tot' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0, 0), 'tot') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
pt-PT até ao natal 2026-09-25T12:00:00 2026-12-25 00:00:00 'até ao' 2026-09-25 12:00:00 '' AssertionError: assert (datetime.dat...5, 12, 0), '') == (datetime.dat... 0), 'até ao') At index 0 diff: datetime.datetime(2026, 9, 25, 12, 0) != datetime.
ovos-date-parser tests
  • test/test_dates_es_siguiente_weekday.py::TestMananaIsTomorrowOrTheMorning::test_until_tomorrow
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[de-DE-bis Weihnachten-expected7-bis]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[en-US-before christmas-expected1-before]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[en-US-until easter-expected0-until]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[es-ES-hasta navidad-expected5-hasta]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[fr-FR-avant no\xebl-expected3-avant]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[nl-NL-tot kerst-expected9-tot]
  • test/test_holidays_chronologia.py::test_a_preposition_alone_is_no_offset[pt-PT-at\xe9 ao natal-expected10-at\xe9 ao]

Rows from the parser-issues ledger recheck

🤖 Auto-generated by Claude Opus 5.5 (claude-opus-5-5) via Claude Code — NOT human-reviewed. Verify before acting.

These rows still read wrong on chronologia 0.35.2a1 and ovos-date-parser 0.41.0a1 from PyPI. The sections above do not list them. Each row belongs to the family named in its heading.

Reproduce with python -I in a clean venv:

from datetime import datetime
from ovos_date_parser import extract_datetime

print(extract_datetime(TEXT, LANG, anchorDate=datetime.fromisoformat(ANCHOR)))
until-range-instant: 2 rows
Lang Text Anchor Got Expected
de von montag bis 2026-03-11 10:00 2026-03-11 10:00, rem 'von' the day after "bis" (2026-03-16 Monday for "von montag bis", 2026-03-13, 2026-12-25)
de bis freitag 2026-03-11 10:00 2026-03-11 10:00, rem '' the day after "bis" (2026-03-16 Monday for "von montag bis", 2026-03-13, 2026-12-25)

Verified by command output: the Got column. Not verified by a person: the Expected column, which comes from the ledger verdicts (a ruling, arithmetic on the anchor, or a hand reading).

Lingua principale
Python
Stelle
0
Fork
8
Merge medio
13h 26m
PR unite (30g)
77

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenVoiceOS/ovos-date-parser

Tutte le issue di OpenVoiceOS/ovos-date-parser

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.