doppio / word2num

A Python package for converting numbers expressed in natural language to numerical values.
MIT License
9 stars 1 forks source link

Complex number sequences are not supported #3

Open doppio opened 1 year ago

doppio commented 1 year ago

As discussed in #2, this package could support complex number sequences:

Currently, the values get added together ("1976" -> 19 + 70 + 6 = 95). Simple digit sequences are already supported ("one five three" → 153), but sequences of numbers that are not simple digits do not get parsed correctly.

Pull requests on this issue are welcome. 🙂

angeldeejay commented 10 months ago

I had a workaround to fix this @doppio. Let me review it in a couple of weeks. I'm full of work right now.

The simplest way you can fix this, is using a recursive function. I'm using this library with NLP results of my own models. In those transcriptions, I've found number spelling (e.g nineteen seventy six) and I've fixed there, but I didn't notice you need this feature too