nice_relative_time raises KeyError 'now' for equal instants in 18 languages
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 63/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- json, python
- Área
- localization
Línea de trabajo
Start by running the reproduce command to confirm the KeyError: 'now', then read the seconds < 1 branch of nice_relative_time_generic in ovos_date_parser/common.py and _translate_word beside it, plus the matching branch of nice_relative_time_eu in dates_eu.py. Look at how en/pt/fr entries in res/<code>/date_words.json define "now" and mirror that shape in the 18 listed language files, pairing each with a cited Wiktionary sense as the issue does for de, es and ca. Done means equal instants return the language's "now" word instead of raising, and the related date parser tests still pass. The open question is scope: decide with maintainers whether the code should also catch KeyError as a fallback alongside the data fix.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🤖 Auto-generated by Claude Sonnet 5.5 (claude-sonnet-5-5) via Claude Code — NOT human-reviewed. Verify before acting. The KeyError and the language list were reproduced by running the code on current dev; the "now" words come from the Wiktionary entries named below.
Observed
nice_relative_time raises KeyError: 'now' when the two instants are equal, in 18 languages: ast, az, ca, cs, da, de, es, eu, fa, gl, hu, it, nl, pl, ru, sl, sv, uk.
from datetime import datetime
from ovos_date_parser import nice_relative_time
t = datetime(2024, 1, 5, 15, 30)
nice_relative_time(t, t, "de") # KeyError: 'now'
nice_relative_time(t, t, "en") # "now"
nice_relative_time(t, t, "pt") # "agora"
The res/<code>/date_words.json file of each of these languages has no "now" key.
Expected
An equal instant gives the language's word for "now", as en ("now"), pt ("agora") and fr ("maintenant") do. The code in ovos_date_parser/common.py (nice_relative_time_generic, and nice_relative_time_eu in dates_eu.py) already handles a missing language: it catches NotImplementedError and falls back to a spoken zero of seconds. A missing key raises KeyError instead, so the call crashes where it should answer.
Words for de, es and ca, from Wiktionary: de "jetzt" (de.wiktionary.org/wiki/jetzt, sense [1] "nun, in diesem Moment, zum Zeitpunkt des Sprechens"), es "ahora" (es.wiktionary.org/wiki/ahora, translation en "now"), ca "ara" (ca.wiktionary.org/wiki/ara, translation en "now"). The other 15 languages need a cited word each.
Reproduce
python -c "from datetime import datetime as D; from ovos_date_parser import nice_relative_time as n; t=D(2024,1,5,15,30); print(n(t,t,'de'))"
Ran on dev at c95b418 with chronologia 0.43.0a2: KeyError: 'now' for each of the 18 languages above; en, pt and fr return their word.
Where
ovos_date_parser/common.py, nice_relative_time_generic (the seconds < 1 branch, _translate_word("now", lang)) and _translate_word, which indexes words[keyword]. The same branch in dates_eu.py. The data fix is a "now" key in each of the 18 res/<code>/date_words.json files.
- Lenguaje dominante
- Python
- Estrellas
- 0
- Forks
- 8
- Merge medio
- 13 h 26 min
- PR fusionados (30 d)
- 77
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenVoiceOS/ovos-date-parser
-
Dificultad 3/5 Medio día Aptitud para principiantes 45/100
OpenVoiceOS/ovos-date-parser#702 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
OpenVoiceOS/ovos-date-parser#659 ·
Los mantenedores suelen responder en 1 día
-
Dependency DashboardAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
OpenVoiceOS/ovos-date-parser#104 ·
Los mantenedores suelen responder en 1 día
-
Inconsistent parameter naming across language handlersQuizá libre de nuevo @JarbasAl la tomó hace 745 días y no hay ningún pull request abierto. Abierto
OpenVoiceOS/ovos-date-parser#66 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Uncomment and fix Persian time parsing test casesQuizá libre de nuevo @JarbasAl la tomó hace 750 días y no hay ningún pull request abierto. Abierto
OpenVoiceOS/ovos-date-parser#54 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de OpenVoiceOS/ovos-date-parser
Issues similares
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
gke-labs/kube-agents#7441 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
issue: a reply cut off by a dropped model connection loses its text when the chat is reloadedAbiertobug confirmed issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
open-webui/open-webui#35142 · 1 comentario ·
Los mantenedores suelen responder en 1 día