A Python library for converting words to numbers.
Project description
🔢 Word to Number Converter (Multisystem: American, Indian & Nepali)
A simple yet powerful Python package to convert number words into numeric form. Inspired by w2n by Akshay Nagpal, but extended to support Indian and Nepali numbering systems such as lakh, crore, arba, and decimals.
✨ Features
- ✅ Converts words like
five hundred twenty fiveinto525 - ✅ Supports American system:
million,billion,trillion - ✅ Supports Indian/Nepali system:
lakh,crore,arba - ✅ Handles decimal points:
point four five→0.45 - ✅ Easy to integrate into Python applications
📦 Installation
Install using pip:
pip install WordToNumber
OR
Just copy the WordToNumber.py file into your project from the Source Code.
🚀 Usage
from WordToNumber import word_to_num
# American system
print(word_to_num('two million five hundred thousand')) # 2500000
# Indian system
print(word_to_num('two crore fifty lakh')) # 25000000
# Extended Nepali system with arba
print(word_to_num('one arba two crore')) # 1020000000
# Decimal numbers
print(word_to_num('one hundred point five')) # 100.5
🧠 Supported Vocabulary
🔢 Basic Numbers:
zerotonineteentwenty,thirty, ...,ninety
🧱 Place Values:
American:
hundred,thousand,million,billion,trillion
Indian/Nepali:
hundred,thousandlakh,lac,lakhscrore,arba
Decimal:
point
🧪 Function Overview
word_to_num(number_sentence)
- Main function to convert a sentence into a number.
- Returns
intorfloat.
📄 Example Conversions
| Input | Output |
|---|---|
ten thousand |
10000 |
two crore fifty lakh |
25000000 |
one arba two crore |
1020000000 |
one hundred point five |
100.5 |
seventy five lakh twenty one |
7500021 |
twelve point zero six seven |
12.067 |
💡 Inspired By
akshaynagpal/w2n — A minimalistic library for word to number conversion in Python.
This project builds on top of that idea by supporting regional systems like Indian and Nepali with added robustness and flexibility.
🤝 Contributing
We welcome contributions! If you'd like to contribute to this Flutter Package Project, please check out our Contribution Guidelines.
🤗 Code of Conduct
Please review our Code of Conduct before participating in this app.
🪪 LICENSE
This project is licensed under the MIT License.
Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wordtonumber-1.0.2.tar.gz.
File metadata
- Download URL: wordtonumber-1.0.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbdccd299af9911c86416185989fe856f4f32425202bb5ad02c61525b2f7a2d5
|
|
| MD5 |
2b2bedbe38d74455246e2feda7f72f01
|
|
| BLAKE2b-256 |
d85e6accb2c4cc583ae2f840f2f892b479ba8942a9eef1ead1f6cef0563e207a
|
File details
Details for the file wordtonumber-1.0.2-py3-none-any.whl.
File metadata
- Download URL: wordtonumber-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4b9652e07117296d9fe8341d6516dd9bad36231acde13168ec4d3627fa50d3c
|
|
| MD5 |
b00d1303badefa9e257cdea8c4c5c18b
|
|
| BLAKE2b-256 |
0e14aee7181800deb220df205c96d98f1688f7c75831b2c10a7323c66c7cb005
|