NumWord
NumWord is a Python package that converts numbers written in words to their numeric representation and vice versa.
Features
- Convert words to numbers (supports decimals and large values).
- Convert numbers to words.
- Language support:
- English (
en) - Hindi (
hi) - French (
fr)
- English (
- Convert numbers to humanized formats:
1500000→1.5M1.5M→15L/15 लाख
- Convert currencies from one to another (using live exchange rates).
Installation
pip install -r requirements.txt
Usage
🔢 Convert word to number
from NumWord import WordToNumber
word_to_num_converter = WordToNumber()
# English
print(word_to_num_converter.convert("one hundred twenty three point four five six"))
# Output: 123.456
# Hindi
print(word_to_num_converter.convert("एक सौ तेईस दशमलव चार पांच छह", lang='hi'))
# Output: 123.456
# French
print(word_to_num_converter.convert("cent vingt-trois virgule quatre cinq six", lang="fr"))
# Output: 123.456
🗣️ Convert number to word
from NumWord import NumberToWord
num_to_word_converter = NumberToWord()
# English
print(num_to_word_converter.convert(123.456))
# Output: one hundred twenty-three point four five six
# Hindi
print(num_to_word_converter.convert(123.456, lang='hi'))
# Output: एक सौ तेईस दशमलव चार पांच छह
# French
print(num_to_word_converter.convert(123.456, lang='fr'))
# Output: cent vingt-trois virgule quatre cinq six
📏 Convert to/from humanized number formats
from NumWord import HumanizeNumber
humanize_number = HumanizeNumber()
# Convert to humanized format in English
print(humanize_number.convert(1500000, lang='en'))
# Output: 1.5M
# Convert to Hindi format
print(humanize_number.convert("1.5M", lang="en", to_lang="hi"))
# Output: 15 लाख
# Convert to shorthand Indian format
print(humanize_number.convert("1.5M", lang="en", to_lang="en-hi"))
# Output: 15L
💱 Currency conversion
from NumWord import Currency
currency = Currency()
# Convert USD to EUR
print(currency.convert(100, "USD", "EUR", with_symbol=False))
# Output: 88.37 EUR
# Convert EUR to INR with currency symbol
print(currency.convert(50, "EUR", "INR", with_symbol=True))
# Output: ₹ 4781.83
# Note: Currency exchange rates update once per day
🧪 Running Tests
python -m unittest discover tests
📄 License
This project is licensed under the MIT License – see the LICENSE file for details.
Metadata
Release files for NumWord 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| numword-0.0.6.tar.gz | 14.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| numword-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.0 kB
Release files / numword-0.0.6.tar.gz
| Download URL | numword-0.0.6.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
590f471b230fc26ddedaa6b7d33c75b284025841a24f54f19ae59de5a4fe76e8
|
|
BLAKE2b-256 checksum How to use checksums |
b396e37af5d513d806a817ea7aee5e08b7ad23067b4b79748bd162131b32f926
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2025.
Transparency logRelease files / numword-0.0.6-py3-none-any.whl
| Download URL | numword-0.0.6-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a580dbf20b91578b5c6b381141024544d8149885115eb2ccd6a1eca9f60ff929
|
|
BLAKE2b-256 checksum How to use checksums |
887bdf5a597482d04802c7a97fa1ad58099ecb3f02322d45626f1f45c287e1f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2025.
Transparency log