Skip to main content

|travis_pic| |codecov_pic|

============== Word to Number (en)

This is a Python module to convert number words (eg. twenty one) to numeric digits (21). It works for positive numbers upto the range of 999,999,999,999 (i.e. billions).

++++++++++++ Installation ++++++++++++ Please ensure that you have updated pip to the latest version before installing word2number_en.

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

.. code-block:: python

pip install word2number_en

Make sure you install all requirements given in requirements.txt

.. code-block:: python

pip install -r requirements.txt

+++++ Usage +++++ First you have to import the module using the below code. .. code-block:: python

from word2number_en import w2n

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

.. code-block:: python

>>> print w2n.word_to_num("two million three thousand nine hundred and eighty four")
2003984

>>> 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('million million'))
Error: Redundant number! Please enter a valid number word (eg. two million twenty three thousand and forty nine)
None

>>> print(w2n.word_to_num('blah'))
Error: No valid number words found! Please enter a valid number word (eg. two million twenty three thousand and forty nine)
None

+++++++++++ Bugs/Errors +++++++++++

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

If you find any bugs/errors in the usage of above code, please raise an issue through Github <http://github.com/neuri-ai/w2n_en>_. If you don't know how to use Github or raise an issue through it, I suggest that you should learn it. Else, send an email to akshay2626@gmail.com with a clear example that can reproduce the issue.

++++++++++++ Contributors ++++++++++++

  • Ben Batorsky (bpben <https://github.com/bpben>__)
  • Alex (ledovsky <https://github.com/ledovsky>__)
  • Tal Yarkoni (tyarkoni <https://github.com/tyarkoni>__)
  • ButteredGroove (ButteredGroove <https://github.com/ButteredGroove>__)
  • TurqW (TurqW <https://github.com/TurqW>__)

.. |travis_pic| image:: https://travis-ci.org/akshaynagpal/w2n.svg?branch=master :target: https://travis-ci.org/akshaynagpal/w2n

.. |codecov_pic| image:: https://codecov.io/gh/akshaynagpal/w2n/branch/master/graph/badge.svg :target: https://codecov.io/gh/akshaynagpal/w2n

Download files

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

Source Distribution

word2number_en-1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

word2number_en-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file word2number_en-1.0.0.tar.gz.

File metadata

  • Download URL: word2number_en-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for word2number_en-1.0.0.tar.gz
Algorithm Hash digest
SHA256 91b88b632d6f50220c03f6a70cdbd2b60aeca90ec8fbbb37bede86db321c29a0
MD5 57ec8db0ae0b4b97346056e08035eac0
BLAKE2b-256 646e67d3b483ebcff923be1f5ea094952e6e31216ff99573691bb8c8ed5bc887

See more details on using hashes here.

File details

Details for the file word2number_en-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: word2number_en-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for word2number_en-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26d4673fc573710047aa6f151088f12a9c79fffb61f0bfdd3035cf3b63391bc9
MD5 869167792eaa8783b959a8de6fe2f68b
BLAKE2b-256 8f86fa3845db5e191c13d9ee1ed5b501771da7754edb79b70b10e8be2ca2f7a1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

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