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
This could be easily be hardcoded into a dictionary if there's a limited amount of numbers you'd like to parse.
For slightly more complex cases, you'll probably want to generate this dictionary automatically, based on the relatively simple numbers grammar. Something along the lines of this (of course, generalized...)
for i in range(10):
myDict[30 + i] = "thirty-" + singleDigitsDict[i]
If you need something more extensive, then it looks like you'll need natural language processing tools. This article might be a good starting point.