You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we input stuff like only 'thousand', 'million', 'billion' it gives a list index error.Strangely does not happen for just 'hundred'.
One sample error -
i=w2n.word_to_num('billion')
Traceback (most recent call last):
File "", line 1, in
File "/home/anaconda3/lib/python3.6/site-packages/word2number/w2n.py", line 178, in word_to_num
billion_multiplier = number_formation(clean_numbers[0:billion_index])
File "/home/anaconda3/lib/python3.6/site-packages/word2number/w2n.py", line 104, in number_formation
return numbers[0]
IndexError: list index out of range
The text was updated successfully, but these errors were encountered:
@Apaar
Thanks for pointing this out. I will look into this ASAP.
Meanwhile, you're also welcome to fix the error and submit a Pull Request. If it passes all the tests, it will be merged most probably.
The issue as stated is solved, but there are some related issues still existing. Writing something like "million and one" will throw an index error:
w2n.word_to_num("thousand and one")
Traceback (most recent call last):
File "", line 1, in
w2n.word_to_num("thousand and one")
File "c:\users\leah\appdata\local\programs\python\python37\lib\site-packages\word2number\w2n.py", line 197, in word_to_num
thousand_multiplier = number_formation(clean_numbers[0:thousand_index])
File "c:\users\leah\appdata\local\programs\python\python37\lib\site-packages\word2number\w2n.py", line 104, in number_formation
return numbers[0]
IndexError: list index out of range
And for some reason "hundred and three" gets read as 300.
For the moment, I've fixed this in my personal code by checking for hundred/thousand/million/billion at the start of a string and putting "one " in front before the conversion. If that's an acceptable solution, I could incorporate this fix in the package itself.
When we input stuff like only 'thousand', 'million', 'billion' it gives a list index error.Strangely does not happen for just 'hundred'.
One sample error -
The text was updated successfully, but these errors were encountered: