Skip to main content

A small library to convert text numbers to digits in a string

Project description

Usage

Python 3 only!

from t2d import Text2Digits
Text2Digits().convert("I was born in nineteen ninety two and am twenty six years old!")

Output:

"i was born in 1992 and am 26 years old!"

I find this useful if using Alexa/Lex to convert audio to text and have to convert the text to digits.

Improvements/Issues

  • Still need to add support for decimal numbers
  • Need to add support for negative numbers

Acknowledgements

I have heavily used code from the SO answers from here: https://stackoverflow.com/questions/493174/is-there-a-way-to-convert-number-words-to-integers and improved upon them

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text2digits-careless25-0.0.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

text2digits_careless25-0.0.2-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page