Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DE] Fix the tens from 20 to 90 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion tests/test_de.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,45 @@

def test_german():
engine = RbnfEngine.for_language("de")
assert engine.format_number(1).text == "eins"
assert engine.format_number(2).text == "zwei"
assert engine.format_number(3).text == "drei"
assert engine.format_number(4).text == "vier"
assert engine.format_number(5).text == "fünf"
assert engine.format_number(6).text == "sechs"
assert engine.format_number(7).text == "sieben"
assert engine.format_number(8).text == "acht"
assert engine.format_number(9).text == "neun"
assert engine.format_number(10).text == "zehn"
assert engine.format_number(11).text == "elf"
assert engine.format_number(12).text == "zwölf"
assert engine.format_number(13).text == "dreizehn"
assert engine.format_number(32).text == "zweiunddreißig"
assert engine.format_number(14).text == "vierzehn"
assert engine.format_number(15).text == "fünfzehn"
assert engine.format_number(16).text == "sechzehn"
assert engine.format_number(17).text == "siebzehn"
assert engine.format_number(18).text == "achtzehn"
assert engine.format_number(19).text == "neunzehn"
assert engine.format_number(20).text == "zwanzig"
assert engine.format_number(21).text == "einundzwanzig"
assert engine.format_number(22).text == "zweiundzwanzig"
assert engine.format_number(23).text == "dreiundzwanzig"
assert engine.format_number(24).text == "vierundzwanzig"
assert engine.format_number(25).text == "fünfundzwanzig"
assert engine.format_number(26).text == "sechsundzwanzig"
assert engine.format_number(27).text == "siebenundzwanzig"
assert engine.format_number(28).text == "achtundzwanzig"
assert engine.format_number(29).text == "neunundzwanzig"
assert engine.format_number(30).text == "dreißig"
assert engine.format_number(100).text == "einhundert"
assert engine.format_number(101).text == "einhunderteins"
assert engine.format_number(120).text == "einhundertzwanzig"
assert engine.format_number(121).text == "einhunderteinundzwanzig"
assert engine.format_number(200).text == "zweihundert"
assert engine.format_number(1000).text == "eintausend"
assert engine.format_number(1001).text == "eintausendeins"
assert engine.format_number(1100).text == "eintausendeinhundert"
assert engine.format_number(1234).text == "eintausendzweihundertvierunddreißig"

# All genders, cases
assert set(engine.format_number(1).text_by_ruleset.values()) == {
Expand Down
24 changes: 16 additions & 8 deletions unicode_rbnf/rbnf/de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ For terms of use, see http://www.unicode.org/copyright.html
<rbnfrule value="16">sechzehn;</rbnfrule>
<rbnfrule value="17">siebzehn;</rbnfrule>
<rbnfrule value="18">→→zehn;</rbnfrule>
<rbnfrule value="20">[→%spellout-cardinal-masculine→­und­]zwanzig;</rbnfrule>
<rbnfrule value="30">[→%spellout-cardinal-masculine→­und­]dreißig;</rbnfrule>
<rbnfrule value="40">[→%spellout-cardinal-masculine→­und­]vierzig;</rbnfrule>
<rbnfrule value="50">[→%spellout-cardinal-masculine→­und­]fünfzig;</rbnfrule>
<rbnfrule value="60">[→%spellout-cardinal-masculine→­und­]sechzig;</rbnfrule>
<rbnfrule value="70">[→%spellout-cardinal-masculine→­und­]siebzig;</rbnfrule>
<rbnfrule value="80">[→%spellout-cardinal-masculine→­und­]achtzig;</rbnfrule>
<rbnfrule value="90">[→%spellout-cardinal-masculine→­und­]neunzig;</rbnfrule>
<rbnfrule value="20">zwanzig;</rbnfrule>
<rbnfrule value="21">[→%spellout-cardinal-masculine→­und­]zwanzig;</rbnfrule>
<rbnfrule value="30">dreißig;</rbnfrule>
<rbnfrule value="31">[→%spellout-cardinal-masculine→­und­]dreißig;</rbnfrule>
<rbnfrule value="40">vierzig;</rbnfrule>
<rbnfrule value="41">[→%spellout-cardinal-masculine→­und­]vierzig;</rbnfrule>
<rbnfrule value="50">fünfzig;</rbnfrule>
<rbnfrule value="51">[→%spellout-cardinal-masculine→­und­]fünfzig;</rbnfrule>
<rbnfrule value="60">sechzig;</rbnfrule>
<rbnfrule value="61">[→%spellout-cardinal-masculine→­und­]sechzig;</rbnfrule>
<rbnfrule value="70">siebzig;</rbnfrule>
<rbnfrule value="71">[→%spellout-cardinal-masculine→­und­]siebzig;</rbnfrule>
<rbnfrule value="80">achtzig;</rbnfrule>
<rbnfrule value="81">[→%spellout-cardinal-masculine→­und­]achtzig;</rbnfrule>
<rbnfrule value="90">neunzig;</rbnfrule>
<rbnfrule value="91">[→%spellout-cardinal-masculine→­und­]neunzig;</rbnfrule>
<rbnfrule value="100">←%spellout-cardinal-masculine←­hundert[­→→];</rbnfrule>
<rbnfrule value="1000">←%spellout-cardinal-masculine←­tausend[­→→];</rbnfrule>
<rbnfrule value="1000000">eine Million[ →→];</rbnfrule>
Expand Down