python3-unicode-rbnf

Rule-based number formatting using Unicode CLDR data

Description

Provides a pure Python implementation of rule-based number formatting (RBNF) using the Unicode Common Locale Data Repository (CLDR). This library allows for the spelling out of numbers for a wide range of locales, supporting various rulesets depending on the locale.

The library supports literal text, quotient and remainder substitution, optional substitution, rule substitution, and special rules for negative numbers, improper fractions, NaN, and infinity.

Example usage:

 >>> from unicode_rbnf import RbnfEngine
 >>> engine = RbnfEngine.for_language("en")
 >>> engine.format_number(1234)
 'one thousand two hundred thirty-four'

 >>> from unicode_rbnf import RbnfEngine, RulesetName
 >>> engine = RbnfEngine.for_language("en")
 >>> engine.format_number(1999, RulesetName.YEAR)
 'nineteen ninety-nine'
 >>> engine.format_number(11, RulesetName.ORDINAL)
 'eleventh'

This package is particularly useful for applications requiring accurate and locale-aware number spelling, such as text-to-speech systems, financial applications, and other linguistic tools.

Upload more screenshots

Please help extend the collection of screenshots. Just make a screenshot and upload it here. You don't need to register or anything.

Upload a screenshot

Hint: upload an image here from your clipboard with Ctrl-V


Homepage

https://github.com/rhasspy/unicode-rbnf


Install this software package

If the package is available for the distribution you are currently using on your computer then install the software by clicking on…

Install python3-unicode-rbnf