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

[ADD] to ordinal number for Turkish #468

Merged
merged 11 commits into from
Aug 18, 2022
4 changes: 4 additions & 0 deletions num2words/lang_TR.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ def to_ordinal(self, value):

return wrd

def to_ordinal_num(self, value):
self.verify_ordinal(value)
return "%s%s" % (value, self.to_ordinal(value)[-4:])

def to_splitnum(self, val):
float_digits = str(int(val * 10 ** self.precision))
if not int(val) == 0:
Expand Down
6 changes: 5 additions & 1 deletion tests/test_tr.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ def test_tr(self):
{"test": 101101011010.02, "to": "cardinal",
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgüliki"},
{"test": 101101011010.2, "to": "cardinal",
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgülyirmi"}
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgülyirmi"},
{"test": 10, "to": "ordinal_num", "expected": u"10uncu"},
{"test": 1, "to": "ordinal_num", "expected": u"1inci"},
{"test": 3, "to": "ordinal_num", "expected": u"3üncü"},
{"test": 6, "to": "ordinal_num", "expected": u"6ıncı"}
]

for casedata in testcases:
Expand Down