-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account for different forms of currency name (#33)
- Loading branch information
Showing
4 changed files
with
66 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
from ukrainian_tts.formatter import preprocess_text | ||
import pytest | ||
|
||
|
||
def test_formatter(): | ||
examples = [ | ||
("Quality of life update", "кваліті оф ліфе юпдате"), | ||
("Він украв 20000000 $", "він украв двадцять мільйонів долар"), | ||
( | ||
"111 000 000 000 доларів державного боргу.", | ||
"сто одинадцять мільярдів доларів державного боргу.", | ||
), | ||
( | ||
"11100000001 доларів державного боргу.", | ||
"одинадцять мільярдів сто мільйонів один доларів державного боргу.", | ||
), | ||
("це 19-річне вино.", "це дев'ятнадцять-річне вино."), | ||
("10-30-40-50-5-9-5", "десять-тридцять-сорок-п'ятдесят-п'ять-дев'ять-п'ять"), | ||
] | ||
for item in examples: | ||
assert preprocess_text(item[0]) == item[1] | ||
@pytest.mark.parametrize('text,expected', [ | ||
("Quality of life update", "кваліті оф ліфе юпдате"), | ||
("Він украв 20000000 $", "він украв двадцять мільйонів доларів"), | ||
("Він украв 20000000", "він украв двадцять мільйонів"), | ||
("Він украв 1 $", "він украв один долар"), | ||
("Він украв 2 $", "він украв два долари"), | ||
("Він украв 2 ₴", "він украв дві гривні"), | ||
( | ||
"111 000 000 000 доларів державного боргу.", | ||
"сто одинадцять мільярдів доларів державного боргу.", | ||
), | ||
( | ||
"11100000001 доларів державного боргу.", | ||
"одинадцять мільярдів сто мільйонів один доларів державного боргу.", | ||
), | ||
# this is wrong case, should be "це дев'ятнадцяти-річне вино." | ||
# Implementing this, require to have proper parsing of words into the token stream | ||
# which reqiure reworking of current approach. | ||
("це 19-річне вино.", "це дев'ятнадцять-річне вино."), | ||
("10-30-40-50-5-9-5", "десять-тридцять-сорок-п'ятдесят-п'ять-дев'ять-п'ять"), | ||
]) | ||
def test_formatter(text, expected): | ||
assert preprocess_text(text) == expected |
This file contains 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