File tree 4 files changed +31
-4
lines changed
4 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 82
82
"чотириста" : 400 ,
83
83
"п'ятсот" : 500 ,
84
84
"пʼятсот" : 500 ,
85
+ "п'ятисот" : 500 ,
86
+ "пʼятисот" : 500 ,
87
+ "пятсот" : 500 ,
88
+ "пятисот" : 500 ,
85
89
"шістсот" : 600 ,
86
90
"сімсот" : 700 ,
87
91
"вісімсот" : 800 ,
92
+ "девятсот" : 900 ,
88
93
"дев'ятсот" : 900 ,
89
94
"девʼятсот" : 900
90
95
},
Original file line number Diff line number Diff line change @@ -305,6 +305,10 @@ def parse_number(input_string, language=None):
305
305
306
306
lang_data = LanguageData (language )
307
307
308
+ # Normalize the input string by removing apostrophes
309
+ input_string = input_string .replace ("'" , "" )
310
+ input_string = input_string .replace ("’" , "" )
311
+
308
312
tokens = _tokenize (input_string , language )
309
313
normalized_tokens = _normalize_tokens (tokens )
310
314
for index , token in enumerate (normalized_tokens ):
Original file line number Diff line number Diff line change 1
- [pytest ]
2
- flake8- max-line-length = 119
3
- flake8- ignore =
1
+ [flake8 ]
2
+ max-line-length = 119
3
+ ignore =
4
4
# This rule goes against the PEP 8 recommended style and it's incompatible
5
5
# with W504
6
6
W503
@@ -9,7 +9,6 @@ flake8-ignore =
9
9
# E501: Line too long
10
10
number-parser/number_parser/data/* E501
11
11
12
-
13
12
# Exclude files that are meant to provide top-level imports
14
13
# F401: Module imported but unused
15
14
number-parser/number_parser/__init__.py F401
Original file line number Diff line number Diff line change 107
107
("ундецільйон" , 1_000_000_000_000_000_000_000_000_000_000_000_000 ),
108
108
("дуодецільйон" , 1_000_000_000_000_000_000_000_000_000_000_000_000_000 ),
109
109
("тредецільйон" , 1_000_000_000_000_000_000_000_000_000_000_000_000_000_000 ),
110
+ # Test cases with apostrophe
111
+ ("п'ять" , 5 ),
112
+ ("п’ять" , 5 ),
113
+ ("п'ятдесят" , 50 ),
114
+ ("п’ятдесят" , 50 ),
115
+ ("п'ятисот" , 500 ),
116
+ ("п’ятисот" , 500 ),
117
+ ("п'ятнадцять" , 15 ),
118
+ ("п’ятнадцять" , 15 ),
119
+ ("п'ятдесят тисяч" , 50_000 ),
120
+ ("п’ятдесят тисяч" , 50_000 ),
121
+ ("дев'ять" , 9 ),
122
+ ("дев’ять" , 9 ),
123
+ ("дев'ятнадцять" , 19 ),
124
+ ("дев’ятнадцять" , 19 ),
125
+ ("дев'ятсот" , 900 ),
126
+ ("дев’ятсот" , 900 ),
127
+ ("дев'ятсот тисяч" , 900_000 ),
128
+ ("дев’ятсот тисяч" , 900_000 ),
110
129
],
111
130
)
112
131
def test_parse_number (expected , test_input ):
You can’t perform that action at this time.
0 commit comments