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

Kip Cole kipcole9 at gmail.com
Fri Dec 2 13:32:27 CST 2016


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 <mailto: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 <mailto: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 <mailto: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 <mailto: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/classRuleBasedNumberFormat.html <http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.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 <mailto:CLDR-Users at unicode.org>
> http://unicode.org/mailman/listinfo/cldr-users <http://unicode.org/mailman/listinfo/cldr-users>
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://unicode.org/pipermail/cldr-users/attachments/20161203/14922476/attachment-0001.html>


More information about the CLDR-Users mailing list