ToOrdinal builds compound ordinals with cardinal tens, as in English
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
- 73/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust, yaml
- Área
- backend-api-design
Línea de trabajo
Read hundreds_to_words in src/xpath_functions.rs and the definitions in Rules/Languages/es/definitions.yaml. Check how ToOrdinal selects words for compound numbers, then add the OrdinalCompound behavior described in the issue while preserving the default English output. Done when Spanish compound ordinals use ordinal words for each part and the existing English behavior remains unchanged; the issue does not name a test file.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
ToOrdinal builds 21–99 as cardinal + ordinal, which is right for English ("twenty first") but not for Spanish, where every part is an ordinal:
| n | Spanish today | expected |
|---|---|---|
| 21 | veinte primero | vigésimo primero |
| 45 | cuarenta quinto | cuadragésimo quinto |
| 99 | noventa noveno | nonagésimo noveno |
The cardinal words come from NumbersTens and NumbersHundreds in hundreds_to_words (src/xpath_functions.rs); the Spanish ordinal lists themselves are fine now (fixed in the es-ordinals PR).
Proposed patch: a new definition, OrdinalCompound: ["ordinal"], that a language can set so hundreds_to_words uses the ordinal lists for every part. Languages that don't set it keep today's behavior, so English doesn't change.
- let mut hundreds = definitions.get_vec("NumbersHundreds")?[number[0]].clone();
+ // in some languages (e.g., Spanish) every part of a compound ordinal is an ordinal ("vigésimo primero"),
+ // not a cardinal followed by an ordinal ("twenty first")
+ let all_ordinal = definitions.get_vec("OrdinalCompound")
+ .is_some_and(|v| v.first().is_some_and(|s| s == "ordinal"));
+ let mut hundreds = if all_ordinal {
+ words[0][number[0]].clone()
+ } else {
+ definitions.get_vec("NumbersHundreds")?[number[0]].clone()
+ };
@@
- return Some(hundreds + &definitions.get_vec("NumbersTens")?[number[1]] + " " + &words[2][number[2]]);
+ let tens = if all_ordinal {
+ words[1][number[1]].clone()
+ } else {
+ definitions.get_vec("NumbersTens")?[number[1]].clone()
+ };
+ return Some(hundreds + &tens + " " + &words[2][number[2]]);
and in Rules/Languages/es/definitions.yaml:
- OrdinalCompound: ["ordinal"]
Spanish doesn't call ToOrdinal for this today: the es-ordinals PR #999 uses two small maps of its own, because of this problem. With the fix, that rule could use ToOrdinal and drop them (the feminine "primera" and the apocope "primer" are built in the rule from the masculine word).
- Lenguaje dominante
- Rust
- Estrellas
- 131
- Forks
- 97
- Merge medio
- 21 h 45 min
- PR fusionados (30 d)
- 95
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 daisy/MathCAT
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
Todos los issues de daisy/MathCAT
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ElectronicWave/Elemental#252 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dekobon/big-code-analysis#1887 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
area:mcp effort:low P5 source:agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
jlcodes99/cockpit-tools#3103 ·
Los mantenedores suelen responder en 2 días