ShailChoksi / text2digits

Converts text such as "twenty three" to number/digit "23" in any sentence
MIT License
66 stars 22 forks source link

Extra space is added #15

Closed fersarr closed 4 years ago

fersarr commented 4 years ago

Hi, thanks for this package, it's very useful! Just wanted to report this weird behaviour:

I know negative numbers are not yet supported but it shouldn't move the spaces around or add extra ones:

>>> t2d.convert('hey this is a number -7')
'hey this is a number- 7'

I would expected the text to end up unmodified:

>>> t2d.convert('hey this is a number -7')
'hey this is a number -7'

The same happens with:

>>> t2d.convert('-7')
'- 7'
ShailChoksi commented 4 years ago

This should be fixed in version 0.0.6. Can you test and confirm?

>>> t2d.convert("hey this is a number -7")
'hey this is a number -7'
>>> t2d.convert("-7")
'-7'
>>> t2d.convert("- sevent")
'- sevent'
>>> t2d.convert("- seven")
'- 7'
>>> t2d.convert("-seven")
'-7'
fersarr commented 4 years ago

you are right! thanks :)