Skip to main content

Package to convert numbers to words with support of multiple indian languages.

Project description

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(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)
  • 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!

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

indic_num2words-1.3.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

indic_num2words-1.3.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file indic_num2words-1.3.0.tar.gz.

File metadata

  • Download URL: indic_num2words-1.3.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for indic_num2words-1.3.0.tar.gz
Algorithm Hash digest
SHA256 ee38e2e94eb39caa824505a60251b5b6b47750ad95edb87e6e682f5ba421b448
MD5 74e7f0f3846e08184067e7127bd0f9e8
BLAKE2b-256 2ae22b467bdc10f9fd8ef872827a5c287c45932423a989d17194ad4a340ed651

See more details on using hashes here.

File details

Details for the file indic_num2words-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for indic_num2words-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdb5f81f409bb5fd46256e0af62a13d45fd9b9f83f4f166537c52225bc0d33be
MD5 63ec38c6e2575f6484db6e3c2d0283f0
BLAKE2b-256 242f6633fab9b268025ba56627b26b70ff3bd09ea3eba7672b7159a3a229a29f

See more details on using hashes here.

Supported by

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