Skip to main content

To convert numbers in word form to digits

Project description

WordToDigits Package

Author: Abhishek Rawat

This package is used to convert the numbers present in word form in an input passage to the traditional numeric (digits) form. The word representation of numbers could be anywhere in the passage. It works from zero to nine hundred and ninety nine million nine hundred and ninety nine thousand and nine hundred and ninety nine. It also takes care of the decimal part, if present.

An example on how to use the package is shown below:-

import wordtodigits

text1 = 'A car accelerates for five point two one seconds for a distance of one hundred and ten meters.'
print(wordtodigits.convert(text1))
#A car accelerates for 5.21 seconds for a distance of 110 meters.

text2 = 'three thousand and fifty three point five is the final score'
print(wordtodigits.convert(text2))
#3053.5 is the final score

If you find any bugs, or have any suggestions for improvement, contact me at abhishek18.official@gmail.com

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

wordtodigits-1.0.2.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

wordtodigits-1.0.2-py3-none-any.whl (3.8 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