Repository navigation
2.5.0: speak decimals as fractions, fix crashes - #14
Merged
Merged
Conversation
When a decimal rule sends the fractional part to another ruleset, that ruleset is keyed by denominator, as in ICU: 1.5 in Russian is "одна целая пять десятых", not digit by digit. This fixes decimals in Russian, Polish, Kazakh and Kyrgyz, including Polish's spoken leading zeros (<%rs<<). The parser also kept a plural form inside [...] apart from its optional group, and put text after a plural form before it. Also fix crashes on 1e-7 (scientific notation) and -inf, and remove doubled and trailing spaces from output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes for the 2.5.0 release. Version is bumped and
CHANGELOG.mdupdated.Decimals as fractions (ru, pl, kk, ky)
When an
x.xrule sends the fractional part to a different ruleset (→%%fractions-feminine→), ICU treats that ruleset as a fraction ruleset: its rules are keyed by denominator, and the digits after the point are the numerator. The engine spoke them digit by digit through those rules instead, which garbled every decimal in these languages.1.50.51.2514.8914.051.5Also needed for this:
<%ruleset<<(Polish) speaks the numerator's leading zeros[...]now stays with its optional group, so it's dropped along with the substitution (ru0.5has no "целых")x.xrule, the plural agrees with the integer part ("одна целая")A fraction the ruleset can't express (a
<0<digit pattern, more places than its largest denominator) falls back to digit by digit, as before.Smaller fixes
1e-7crashed in every language (str()gives1E-7, which has no.to split on)-infcrashed in every language withOverflowError; English now gives "minus infinity"format_numberoutput (Arabic ordinals: 21 "الحادي والعشرون"; Arabic and Hebrew decimals had a trailing space)Testing
mainKnown data quirk, left as is: ru
spellout-cardinal-masculinegives "одна целый" because CLDR'sru.xmlsaysone{целый}. ICU gives the same.🤖 Generated with Claude Code