Alter the ordinal generation code for languages where it's not appropriate
- Dominant language
- Rust
- Stars
- 114
- Forks
- 85
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 42
Description
MathCat's ToOrdinal function, currently, does the following, if I understand it right:
- takes a number and splits it into hundreds, tens and units
- for tens, it'll multiply the number by 10, and check the array length to see if it still fits in the explicitly written ordinals list. If it does not, it'll string together the tens as they are, and the ordinallized units. This doesn't work in languages such as Italian, where the whole word is ordinalized. For example:
- 21 = "ventuno", ordinal = "ventunesimo".
- 31 = "trentuno", ordinal = "trentunesimo".
- 55 = "cinquantacinque", ordinal = "cinquantacinquesimo".
So we need to change this mechanism, otherwise we would have a horrendous Definitions.yaml file with 99 explicit ordinals just to prevent MathCAT from falling back to the string together mechanism, which gives us "venti primo" for 21 (like the English "Twenty first", "Venti secondo", "Venti terzo", and so on.
In Italian,for example, the code would need to do the following:
For numbers 1 to 10, use an explicit dictionary.
After that, take the cardinal number, remove one letter and place "esimo" at the end. This becomes "esima" in case of feminine ordinals.
If the number ends with an E, remove it. If the E is accented like in 23 ("ventitré"), double it (e.g. "ventitré // Ventitreesimo", trentatré // trentatreesimo").
This does not translate similarly to other romance languages: Spanish, for example, has a system closely resembling English, where ordinals are composed (19 = "decimo noveno").
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading MathCat's ToOrdinal function and the explicitly written ordinals in Definitions.yaml. Compare the current tens-and-units fallback with the Italian examples, then check how ordinal rules vary across languages such as Spanish. Done means Italian compound ordinals work without 99 explicit entries while languages using composed ordinals retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- localization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100