Skip to main content

indic-num2words - Convert Numbers to Words for Indian Languages

The indic-num2words module converts numerical digits like 36 into words like छत्तीस in various Indian languages.

Installation

To install the latest stable release from PyPI:

pip install indic-num2words

Usage

The module provides a single function for converting numbers to words:

from num_to_words import num_to_word

# Examples:
print(num_to_word(36, lang='hi'))  # Output: छत्तीस
print(num_to_word('४५', lang='hi'))  # Output: पैंतालीस
print(num_to_word("35,43,57,730", lang='hi'))  # Output: पैंतीसकरोड़ तैंतालीसलाख सत्तावनहज़ार सातसौ तीस
print(num_to_word(795, lang='kn', separator='-'))  # Output: ಏಳುನೂರ-ತೊಂಬತ್ತೈದು
print(num_to_word(445951, lang='ne')) # Output: चार लाख, पैंतालीस हजार, नौ सय, एकाउन्न
print(num_to_word(545589, lang='en', separator=', ', combiner='-'))  # Output: five-lakh, forty-five-thousand, five-hundred, eighty-nine

Function Parameters

  • num (int, str): The number to be converted. This can be an integer, string of digits, or a formatted number string.
  • lang (str): The language code for the desired output language. Supported languages are listed below.
  • separator (str, optional): A string to use as a separator between number groups. Default is a space.
  • combiner (str, optional): A string to combine words in complex numbers. Default is a space.

Supported Languages

The module currently supports conversion to the following languages:

  • en (English-India)
  • hi (Hindi)
  • ne (Nepali)
  • gu (Gujarati)
  • mr (Marathi)
  • bn (Bengali)
  • te (Telugu)
  • ta (Tamil)
  • kn (Kannada)
  • or (Oriya)
  • pa (Punjabi)
  • ml (Malayalam)

Use Cases

  1. Speech Recognition Pre-processing: Convert numbers to words to improve speech recognition accuracy.
  2. Language Modeling Data Pre-processing: Prepare text data for training language models by converting numerical data to words.

What's Next

We are planning to add support for the following languages:

  • Urdu
  • Assamese

If you'd like to contribute or request support for another language, check utils/constants.py to see how you can add support. It's designed to be straightforward.

Contributing

We welcome contributions! If you'd like to help out, feel free to submit pull requests or raise issues on our GitHub repository.


Feel free to reach out if you have any questions or need further assistance. Happy coding!

Metadata

Release files for indic-num2words 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for indic-num2words 1.3.2
File Size Uploaded Provenance
indic_num2words-1.3.2.tar.gz 18.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for indic-num2words 1.3.2
File Interpreter ABI Platform
indic_num2words-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.4 kB

Release files / indic_num2words-1.3.2.tar.gz

Download URL indic_num2words-1.3.2.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
94ede2b3ad87b3e723c7fed00cad93a14473a612de10ff7c6084b1f2ef8ba822
BLAKE2b-256 checksum
How to use checksums
52550dba7b6ec24a312fd99a899c21fec4ddf6635834d68a7d6049b38dcb1ba6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / indic_num2words-1.3.2-py3-none-any.whl

Download URL indic_num2words-1.3.2-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11d02c1ef3299dab1119f814e45b79b1c051b2fc3b3e4456de539c1a78b1fe5c
BLAKE2b-256 checksum
How to use checksums
bac68e4b31a7e6c65b984a2215b89abd3dfa75808c25812710c8110a4c2ae0ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for indic-num2words 1.3.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page