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.

Files for text2digits-careless25, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size text2digits_careless25-0.0.2-py3-none-any.whl (7.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size text2digits-careless25-0.0.2.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page