RBNF rule semantics for a ruleset when there is no negative number rule

Philippe Verdy verdy_p at wanadoo.fr
Fri Dec 2 19:39:16 CST 2016


Additionally some languages have other variants for their use of ordinals,
notably for titling chapters, or for naming kings/queens/emperors, popes:
the ordinal form may be used only for the first element, but not the
following ones.

This is most frequent case in French:
- "chapitre premier", "article premier"... (ordinal form) instead of
"chapitre un" (cardinal form, correct but less frequent), but then
"chapitre deux" (cardinal form), instead of "chapitre deuxième" (ordinal
form correct but rarely used)
- "François Premier" (ordinal form) and never "François Un", but then
"François Deux" (cardinal form) and never "François Deuxième"...

These special case ordinals are not handled in CLDR. The special cases for
date elements however are in CLDR with other date formatting items for each
language and calendar.


2016-12-03 2:31 GMT+01:00 Philippe Verdy <verdy_p at wanadoo.fr>:

> You're right there's no fallback for “spellout_ordinal_neuter” defined in
> Croatian, for such borderline case (negative or null or non-integer
> values), (this would be needed there, because the “spellout_ordinal_neuter”
> form does not exist in all languages (just consider the "neuter"
> grammatical criteria).
>
> It should be noted that what we call "ordinal" is the adjective form
> (possibly substantified and used as a noun without necessarily adding a
> pronoun such as "one" in English "The first is..."~"The first one is...")
> But numeral date elements are also considered ordinals ; they are usually
> counted inclusively from their base in most calendars, in forward or
> backward time ; but there exists derived calendars (in scientific contexts
> or in internal computations) using them as cardinal values (using a zero
> base and negative values, instead of counting backward in time).
>
> This concerns the year, month (or moon), day, week number, sometimes the
> weekday (for some languages not assigning them distinctive names, or in ISO
> 8601 format using only "W1".."W7" with such embedded ordinals), and other
> counting based on religous fests (not forgetting the Roman Republican
> calendar doing it too for counting dates backward inclusively relative to
> the current or next calende, ide or none). These ordinals do not use the
> adjective form but the same (numeral or spelled) form as cardinals.
>
>
> 2016-12-02 20:32 GMT+01:00 Kip Cole <kipcole9 at gmail.com>:
>
>> Phillipe, thank you, overall that makes sense.  I’m far from being
>> comfortable with the CLDR inheritance rules, but it seems that the
>> ldml2json conversion merges most (all?) of the inheritance chain leaving
>> only the locale called “root” as a potential parent for all locales.  Is
>> that a correct understanding?
>>
>> If I look in root.json rbnf I see for the rule group OrdinalRules:
>>
>>       "OrdinalRules": {
>>         "%digits-ordinal": {
>>           "-x": "−>>;",
>>           "0": "=#,##0=.;"
>>         }
>>       },
>>
>> which unsurprisingly doesn’t have a rule set called
>> “spellout_ordinal_neuter”.  Therefore I’m not sure if:
>>
>> 1.  “hr” can be said to inherit from “root” (this being the json data)
>> 2.  what rule set would “spellout_ordinal_neuter” be considered to
>> inherit from?
>>
>> I recognise that ordinal negative numbers might not be a normative case,
>> it’s an example for my learning as much as anything.
>>
>>
>> On 3 Dec 2016, at 3:51 AM, Philippe Verdy <verdy_p at wanadoo.fr> wrote:
>>
>> Additionally the "ordinal number" are very strange if you lok for them
>> with negative values. I think we are in a very fuzzy use case: ordinals
>> have only been really tested for integers higher than 0, exclusing negative
>> numbers, zero, and fractional parts.
>>
>> 2016-12-02 17:48 GMT+01:00 Philippe Verdy <verdy_p at wanadoo.fr>:
>>
>>> But in fact this negative rule is inherited from the default locale,
>>> which will insert the negative sign. You should then find a matching
>>> negative-number rule in the inherited locales.
>>>
>>> 2016-12-02 17:47 GMT+01:00 Philippe Verdy <verdy_p at wanadoo.fr>:
>>>
>>>> Note that there should be a negative-number rule there to format the
>>>> sign and separately the absolute value 50.
>>>>
>>>> 2016-12-02 17:45 GMT+01:00 Philippe Verdy <verdy_p at wanadoo.fr>:
>>>>
>>>>> rule for "4" matches the "Binary-search the rule list for the rule
>>>>> with the highest base value less than or equal to the number.", in fact all
>>>>> rules for "0", "3" and "4" have a base value less than or equal to the
>>>>> number 50. The binary search will point you just above rule for "4", which
>>>>> is the highest base value to use.
>>>>>
>>>>> 2016-12-02 10:52 GMT+01:00 Kip Cole <kipcole9 at gmail.com>:
>>>>>
>>>>>> I am writing some software using the CLDR.  I am stuck on working out
>>>>>> the right semantics for formatting a number using RBNF and there is no
>>>>>> matching rule within a specified ruleset.
>>>>>>
>>>>>> For example (I’m writing this in Elixir but I think the intent is
>>>>>> clear) formatting the negative integer -50 in the locale “hr”:
>>>>>>
>>>>>>          iex> Cldr.Rbnf.Spellout.spellout_ordinal_neuter(-50, "hr”)
>>>>>>
>>>>>> returns an error because in the locale “hr”, the ruleset for
>>>>>> spellout-ordinal-neuter has the following rules (in 30.0.2, using the json
>>>>>> github content):
>>>>>>
>>>>>>         "%spellout-ordinal-neuter": {
>>>>>>           "0": "=%%spellout-ordinal-base=o;",
>>>>>>           "3": "=%%spellout-ordinal-base=e;",
>>>>>>           "4": "=%%spellout-ordinal-base=o;"
>>>>>>         }
>>>>>>
>>>>>> So that by my understanding, a negative number can’t be formatted in
>>>>>> this ruleset for this locale.  The nearest understanding I can get is from
>>>>>> http://www.icu-project.org/apiref/icu4c/classRuleBasedNumber
>>>>>> Format.html which says:
>>>>>>
>>>>>>         • If the number is negative, use the negative-number rule.
>>>>>>         • If the number has a fractional part and is greater than 1,
>>>>>> use the improper fraction rule.
>>>>>>         • If the number has a fractional part and is between 0 and 1,
>>>>>> use the proper fraction rule.
>>>>>>         • Binary-search the rule list for the rule with the highest
>>>>>> base value less than or equal to the number. If that rule has two
>>>>>> substitutions, its base value is not an even multiple of its divisor, and
>>>>>> the number is an even multiple of the rule's divisor, use the rule that
>>>>>> precedes it in the rule list. Otherwise, use the rule itself.
>>>>>>
>>>>>> Given a negative integer in this context then:
>>>>>>
>>>>>> 1. There is no negative number rule
>>>>>> 2. There is no rule that satisfies "Binary-search the rule list for
>>>>>> the rule with the highest base value less than or equal to the number.”
>>>>>>
>>>>>> Are then any additional semantics intended to cover this case or is
>>>>>> an error the appropriate response?
>>>>>>
>>>>>> Many thanks.
>>>>>> _______________________________________________
>>>>>> CLDR-Users mailing list
>>>>>> CLDR-Users at unicode.org
>>>>>> http://unicode.org/mailman/listinfo/cldr-users
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://unicode.org/pipermail/cldr-users/attachments/20161203/3d23ef0c/attachment.html>


More information about the CLDR-Users mailing list