allo-media/text2num

German: Numbers are falsely being added up

Closed this issue · 0 comments

qp450 commented

Thank you for this package, it's very useful!

I am using it for German and would like to report a bug: When inputting "vier fünfhundert", I expect "4 500", but get "504".
This seems to be happening whenever there is a number from 1-99 followed by a hundred with a multiplier (einhundert-neunhundert), for example "dreizehn siebenhundert" -> "713" or "achtundachtzig sechshundert" -> "688" (expected would be "13 700" and "88 600"). I have identified that this behavior stems from the parse() function in the WordStreamValueParserGerman() class. The three parts (for example "vier", "fünf", "hundert") are added to a list, then "fünf" and "hundert" are resolved to "500", but then "vier" is still in the list and gets added to "500".

My python version is 3.10.12.

Would it be possible to fix this or do you have an idea where exactly or why this bug occurs?
Thank you very much!