unicode-rbnf 2.1.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unicode_rbnf-2.1.0/unicode_rbnf.egg-info → unicode_rbnf-2.2.0}/PKG-INFO +8 -6
- unicode_rbnf-2.2.0/pyproject.toml +41 -0
- unicode_rbnf-2.2.0/tests/test_de.py +56 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_es.py +1 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/__init__.py +4 -3
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/decimal_format.py +1 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/engine.py +9 -3
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0/unicode_rbnf.egg-info}/PKG-INFO +8 -6
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf.egg-info/SOURCES.txt +2 -3
- unicode_rbnf-2.2.0/unicode_rbnf.egg-info/zip-safe +1 -0
- unicode_rbnf-2.1.0/MANIFEST.in +0 -2
- unicode_rbnf-2.1.0/setup.py +0 -46
- unicode_rbnf-2.1.0/tests/test_de.py +0 -18
- unicode_rbnf-2.1.0/unicode_rbnf/VERSION +0 -1
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/LICENSE.md +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/README.md +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/setup.cfg +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_decimal_format.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_en.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_engine.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_fi.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_fr.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_load_all.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/tests/test_ro.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/__main__.py +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/py.typed +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/af.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ak.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/am.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ar.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/az.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/be.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/bg.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/bs.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ca.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ccp.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/chr.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/cs.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/cy.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/da.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/de.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/de_CH.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ee.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/el.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/en.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/en_IN.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/eo.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/es.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/et.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fa.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fa_AF.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ff.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fi.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fil.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fo.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fr.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fr_BE.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/fr_CH.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ga.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/he.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/hi.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/hr.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/hu.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/hy.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/id.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/is.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/it.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ja.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ka.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/kk.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/kl.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/km.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ko.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ky.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/lb.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/lo.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/lrc.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/lt.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/lv.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/mk.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ms.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/mt.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/my.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ne.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/nl.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/nn.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/no.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/pl.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/pt.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/pt_PT.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/qu.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ro.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ru.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/se.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/sk.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/sl.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/sq.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/sr.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/sr_Latn.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/su.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/sv.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/sw.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/ta.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/th.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/tr.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/uk.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/vec.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/vi.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/yue.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/yue_Hans.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/zh.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf/rbnf/zh_Hant.xml +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf.egg-info/dependency_links.txt +0 -0
- {unicode_rbnf-2.1.0 → unicode_rbnf-2.2.0}/unicode_rbnf.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 2.
|
|
2
|
+
Name: unicode-rbnf
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Rule-based number formatting using Unicode CLDR data
|
|
5
|
-
|
|
6
|
-
Author: Michael Hansen
|
|
7
|
-
Author-email: mike@rhasspy.org
|
|
5
|
+
Author-email: Michael Hansen <mike@rhasspy.org>
|
|
8
6
|
License: MIT
|
|
9
|
-
|
|
7
|
+
Project-URL: Source Code, https://github.com/rhasspy/unicode-rbnf
|
|
8
|
+
Keywords: rbnf,unicode,number,format
|
|
9
|
+
Platform: any
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Topic :: Text Processing :: Linguistic
|
|
@@ -16,6 +16,8 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.8.0
|
|
19
21
|
Description-Content-Type: text/markdown
|
|
20
22
|
License-File: LICENSE.md
|
|
21
23
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=62.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "unicode-rbnf"
|
|
7
|
+
version = "2.2.0"
|
|
8
|
+
license = {text = "MIT"}
|
|
9
|
+
description = "Rule-based number formatting using Unicode CLDR data"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Michael Hansen", email = "mike@rhasspy.org"}
|
|
13
|
+
]
|
|
14
|
+
keywords = ["rbnf", "unicode", "number", "format"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Topic :: Text Processing :: Linguistic",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
]
|
|
27
|
+
requires-python = ">=3.8.0"
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
"Source Code" = "https://github.com/rhasspy/unicode-rbnf"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
platforms = ["any"]
|
|
34
|
+
zip-safe = true
|
|
35
|
+
include-package-data = true
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
include = ["unicode_rbnf"]
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.package-data]
|
|
41
|
+
unicode_rbnf = ["rbnf/*.xml"]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from unicode_rbnf import RbnfEngine
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_german():
|
|
5
|
+
engine = RbnfEngine.for_language("de")
|
|
6
|
+
assert engine.format_number(1).text == "eins"
|
|
7
|
+
assert engine.format_number(2).text == "zwei"
|
|
8
|
+
assert engine.format_number(3).text == "drei"
|
|
9
|
+
assert engine.format_number(4).text == "vier"
|
|
10
|
+
assert engine.format_number(5).text == "fünf"
|
|
11
|
+
assert engine.format_number(6).text == "sechs"
|
|
12
|
+
assert engine.format_number(7).text == "sieben"
|
|
13
|
+
assert engine.format_number(8).text == "acht"
|
|
14
|
+
assert engine.format_number(9).text == "neun"
|
|
15
|
+
assert engine.format_number(10).text == "zehn"
|
|
16
|
+
assert engine.format_number(11).text == "elf"
|
|
17
|
+
assert engine.format_number(12).text == "zwölf"
|
|
18
|
+
assert engine.format_number(13).text == "dreizehn"
|
|
19
|
+
assert engine.format_number(14).text == "vierzehn"
|
|
20
|
+
assert engine.format_number(15).text == "fünfzehn"
|
|
21
|
+
assert engine.format_number(16).text == "sechzehn"
|
|
22
|
+
assert engine.format_number(17).text == "siebzehn"
|
|
23
|
+
assert engine.format_number(18).text == "achtzehn"
|
|
24
|
+
assert engine.format_number(19).text == "neunzehn"
|
|
25
|
+
assert engine.format_number(20).text == "zwanzig"
|
|
26
|
+
assert engine.format_number(21).text == "einundzwanzig"
|
|
27
|
+
assert engine.format_number(22).text == "zweiundzwanzig"
|
|
28
|
+
assert engine.format_number(23).text == "dreiundzwanzig"
|
|
29
|
+
assert engine.format_number(24).text == "vierundzwanzig"
|
|
30
|
+
assert engine.format_number(25).text == "fünfundzwanzig"
|
|
31
|
+
assert engine.format_number(26).text == "sechsundzwanzig"
|
|
32
|
+
assert engine.format_number(27).text == "siebenundzwanzig"
|
|
33
|
+
assert engine.format_number(28).text == "achtundzwanzig"
|
|
34
|
+
assert engine.format_number(29).text == "neunundzwanzig"
|
|
35
|
+
assert engine.format_number(30).text == "dreißig"
|
|
36
|
+
assert engine.format_number(32).text == "zweiunddreißig"
|
|
37
|
+
assert engine.format_number(100).text == "einhundert"
|
|
38
|
+
assert engine.format_number(101).text == "einhunderteins"
|
|
39
|
+
assert engine.format_number(120).text == "einhundertzwanzig"
|
|
40
|
+
assert engine.format_number(121).text == "einhunderteinundzwanzig"
|
|
41
|
+
assert engine.format_number(200).text == "zweihundert"
|
|
42
|
+
assert engine.format_number(1000).text == "eintausend"
|
|
43
|
+
assert engine.format_number(1001).text == "eintausendeins"
|
|
44
|
+
assert engine.format_number(1100).text == "eintausendeinhundert"
|
|
45
|
+
assert engine.format_number(1234).text == "eintausendzweihundertvierunddreißig"
|
|
46
|
+
|
|
47
|
+
# All genders, cases
|
|
48
|
+
assert set(engine.format_number(1).text_by_ruleset.values()) == {
|
|
49
|
+
"ein",
|
|
50
|
+
"eins",
|
|
51
|
+
"eine",
|
|
52
|
+
"eines",
|
|
53
|
+
"einer",
|
|
54
|
+
"einem",
|
|
55
|
+
"einen",
|
|
56
|
+
}
|
|
@@ -6,6 +6,7 @@ def test_german():
|
|
|
6
6
|
assert engine.format_number(5).text == "cinco"
|
|
7
7
|
assert engine.format_number(2).text == "dos"
|
|
8
8
|
assert engine.format_number(5.2).text == "cinco coma dos"
|
|
9
|
+
assert engine.format_number(21).text == "veintiuno"
|
|
9
10
|
|
|
10
11
|
# All genders
|
|
11
12
|
assert set(engine.format_number(1).text_by_ruleset.values()) == {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"""Rule-based number formatting using Unicode CLDR data."""
|
|
2
|
+
|
|
3
|
+
import importlib.metadata
|
|
2
4
|
|
|
3
5
|
from .engine import FormatOptions, FormatPurpose, FormatResult, RbnfEngine
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
__version__ = importlib.metadata.version("unicode_rbnf")
|
|
6
8
|
|
|
7
|
-
__version__ = (_DIR / "VERSION").read_text(encoding="utf-8").strip()
|
|
8
9
|
|
|
9
10
|
__all__ = [
|
|
10
11
|
"__version__",
|
|
@@ -599,8 +599,12 @@ class RbnfEngine:
|
|
|
599
599
|
if part.text:
|
|
600
600
|
yield part.text
|
|
601
601
|
elif isinstance(part, SubRulePart):
|
|
602
|
-
|
|
603
|
-
|
|
602
|
+
sub_part: SubRulePart = part
|
|
603
|
+
|
|
604
|
+
if part.type == SubType.QUOTIENT:
|
|
605
|
+
if (q == 0) and (
|
|
606
|
+
sub_part.is_optional or (part.ruleset_name is None)
|
|
607
|
+
):
|
|
604
608
|
# Rulesets can use quotients of zero
|
|
605
609
|
continue
|
|
606
610
|
|
|
@@ -614,7 +618,9 @@ class RbnfEngine:
|
|
|
614
618
|
if part.text_after:
|
|
615
619
|
yield part.text_after
|
|
616
620
|
elif part.type == SubType.REMAINDER:
|
|
617
|
-
if (r == 0) and (
|
|
621
|
+
if (r == 0) and (
|
|
622
|
+
sub_part.is_optional or (part.ruleset_name is None)
|
|
623
|
+
):
|
|
618
624
|
# Rulesets can use remainders of zero
|
|
619
625
|
continue
|
|
620
626
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 2.
|
|
2
|
+
Name: unicode-rbnf
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Rule-based number formatting using Unicode CLDR data
|
|
5
|
-
|
|
6
|
-
Author: Michael Hansen
|
|
7
|
-
Author-email: mike@rhasspy.org
|
|
5
|
+
Author-email: Michael Hansen <mike@rhasspy.org>
|
|
8
6
|
License: MIT
|
|
9
|
-
|
|
7
|
+
Project-URL: Source Code, https://github.com/rhasspy/unicode-rbnf
|
|
8
|
+
Keywords: rbnf,unicode,number,format
|
|
9
|
+
Platform: any
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Topic :: Text Processing :: Linguistic
|
|
@@ -16,6 +16,8 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.8.0
|
|
19
21
|
Description-Content-Type: text/markdown
|
|
20
22
|
License-File: LICENSE.md
|
|
21
23
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
LICENSE.md
|
|
2
|
-
MANIFEST.in
|
|
3
2
|
README.md
|
|
3
|
+
pyproject.toml
|
|
4
4
|
setup.cfg
|
|
5
|
-
setup.py
|
|
6
5
|
tests/test_de.py
|
|
7
6
|
tests/test_decimal_format.py
|
|
8
7
|
tests/test_en.py
|
|
@@ -12,7 +11,6 @@ tests/test_fi.py
|
|
|
12
11
|
tests/test_fr.py
|
|
13
12
|
tests/test_load_all.py
|
|
14
13
|
tests/test_ro.py
|
|
15
|
-
unicode_rbnf/VERSION
|
|
16
14
|
unicode_rbnf/__init__.py
|
|
17
15
|
unicode_rbnf/__main__.py
|
|
18
16
|
unicode_rbnf/decimal_format.py
|
|
@@ -22,6 +20,7 @@ unicode_rbnf.egg-info/PKG-INFO
|
|
|
22
20
|
unicode_rbnf.egg-info/SOURCES.txt
|
|
23
21
|
unicode_rbnf.egg-info/dependency_links.txt
|
|
24
22
|
unicode_rbnf.egg-info/top_level.txt
|
|
23
|
+
unicode_rbnf.egg-info/zip-safe
|
|
25
24
|
unicode_rbnf/rbnf/af.xml
|
|
26
25
|
unicode_rbnf/rbnf/ak.xml
|
|
27
26
|
unicode_rbnf/rbnf/am.xml
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
unicode_rbnf-2.1.0/MANIFEST.in
DELETED
unicode_rbnf-2.1.0/setup.py
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
import setuptools
|
|
5
|
-
from setuptools import setup
|
|
6
|
-
|
|
7
|
-
module_name = "unicode_rbnf"
|
|
8
|
-
this_dir = Path(__file__).parent
|
|
9
|
-
module_dir = this_dir / module_name
|
|
10
|
-
data_files = list((module_dir / "rbnf").glob("*.xml"))
|
|
11
|
-
|
|
12
|
-
version_path = module_dir / "VERSION"
|
|
13
|
-
data_files.append(version_path)
|
|
14
|
-
version = version_path.read_text(encoding="utf-8").strip()
|
|
15
|
-
|
|
16
|
-
long_description = (this_dir / "README.md").read_text()
|
|
17
|
-
|
|
18
|
-
# -----------------------------------------------------------------------------
|
|
19
|
-
|
|
20
|
-
setup(
|
|
21
|
-
name=module_name,
|
|
22
|
-
version=version,
|
|
23
|
-
description="Rule-based number formatting using Unicode CLDR data",
|
|
24
|
-
long_description=long_description,
|
|
25
|
-
long_description_content_type="text/markdown",
|
|
26
|
-
url="http://github.com/rhasspy/unicode-rbnf",
|
|
27
|
-
author="Michael Hansen",
|
|
28
|
-
author_email="mike@rhasspy.org",
|
|
29
|
-
license="MIT",
|
|
30
|
-
packages=setuptools.find_packages(),
|
|
31
|
-
package_data={
|
|
32
|
-
module_name: [str(p.relative_to(module_dir)) for p in data_files] + ["py.typed"]
|
|
33
|
-
},
|
|
34
|
-
classifiers=[
|
|
35
|
-
"Development Status :: 3 - Alpha",
|
|
36
|
-
"Intended Audience :: Developers",
|
|
37
|
-
"Topic :: Text Processing :: Linguistic",
|
|
38
|
-
"License :: OSI Approved :: MIT License",
|
|
39
|
-
"Programming Language :: Python :: 3.8",
|
|
40
|
-
"Programming Language :: Python :: 3.9",
|
|
41
|
-
"Programming Language :: Python :: 3.10",
|
|
42
|
-
"Programming Language :: Python :: 3.11",
|
|
43
|
-
"Programming Language :: Python :: 3.12",
|
|
44
|
-
],
|
|
45
|
-
keywords="rbnf unicode number format",
|
|
46
|
-
)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from unicode_rbnf import RbnfEngine
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_german():
|
|
5
|
-
engine = RbnfEngine.for_language("de")
|
|
6
|
-
assert engine.format_number(13).text == "dreizehn"
|
|
7
|
-
assert engine.format_number(32).text == "zweiunddreißig"
|
|
8
|
-
|
|
9
|
-
# All genders, cases
|
|
10
|
-
assert set(engine.format_number(1).text_by_ruleset.values()) == {
|
|
11
|
-
"ein",
|
|
12
|
-
"eins",
|
|
13
|
-
"eine",
|
|
14
|
-
"eines",
|
|
15
|
-
"einer",
|
|
16
|
-
"einem",
|
|
17
|
-
"einen",
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.1.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|