Skip to content

Alter the ordinal generation code for languages where it's not appropriate #765

Description

@Tnonis90

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").

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionRequires discussion to decide next stepsrulesPertains to RulestranslationLanguage translation of math/code

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions