Is there a way to convert number words to Integers?

前端 未结 16 2392
北恋
北恋 2020-11-22 06:14

I need to convert one into 1, two into 2 and so on.

Is there a way to do this with a library or a class or anythi

16条回答
  •  野的像风
    2020-11-22 06:49

    Make use of the python package : WordToDigits

    pip install wordtodigits

    It can find numbers present in word form in a sentence and then convert them to the proper numeric format. Also takes care of the decimal part, if present. The word representation of numbers could be anywhere in the passage.

    https://pypi.org/project/wordtodigits/

提交回复
热议问题