Skip to main content

Convert number words eg. three hundred and forty two to numbers (342) for indian currency standards.

Project description

This is a Python module to convert number words (eg. twenty one) to numeric digits (21) modified to support indian currency standards as well as Western stadards. It can also replace numbers written in between the sentence while keeping rest of the stuff as it is.

Installation

Please ensure that you have updated pip to the latest version before installing indian_word2number.

You can install the module using Python Package Index using the below command.

pip install indian-word2number

Usage

First you have to import the module using the below code.

from indian_word2number import indian_w2n as w2n

Then you can use the word_to_num method to convert a number-word to numeric digits, as shown below.

>>> print(w2n.word_to_num("twenty lakh three thousand nineteen Rupees and zero paisa only"))
2003019

>>> print(w2n.word_to_num('two point three'))
2.3

>>> print(w2n.word_to_num('112'))
112

>>> print(w2n.word_to_num('point one'))
0.1

>>> print(w2n.word_to_num('one hundred thirty-five'))
135

>>> print(w2n.word_to_num("there was a group of ten friends who went to the restaurant for a party, ordered thirty two dishes including ten drinks and bill came out as ten thousand five hundred and thirty paisa"))
there was a group of 10 friends who went to the restaurant for a party, ordered 32 dishes including 10 drinks and bill came out as 10500.3

Bugs/Errors

Please ensure that you have updated pip to the latest version before installing word2number.

Contributors

Credits

This repo is a forked of w2n <https://github.com/akshaynagpal/w2n> library and the same has been used as a base to extend it further to support indian currency standards.

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

indian_word2number-1.2.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file indian_word2number-1.2.tar.gz.

File metadata

  • Download URL: indian_word2number-1.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for indian_word2number-1.2.tar.gz
Algorithm Hash digest
SHA256 29f7d30fb6e2e4a75d8c15c965b43df6f113548add395a0ea0807d2ddd680322
MD5 2e5b6e0a8df4a4459819fdb50b84a25a
BLAKE2b-256 627d56a991d1aef6ded389fef00be743f505f9149b114f6ac83f46bb0e2094a9

See more details on using hashes here.

Supported by

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