Indic Num To Words

1.1.0 · active · verified Wed Apr 15

Indic-numtowords is a Python module developed by AI4Bharat that converts numbers into their word representations for various Indian languages and English (India). It supports languages such as Hindi, Nepali, Gujarati, Marathi, Bengali, Telugu, Tamil, Kannada, Oriya, Punjabi, and Malayalam. The library is currently at version 1.1.0, with an irregular release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `num2words` function and use it to convert numbers into words for various supported languages. It also shows the usage of `lang`, `variations`, and `split` parameters.

from indic_numtowords import num2words

# Convert a number to words in Hindi
hindi_words = num2words(36, lang='hi')
print(f"36 in Hindi: {hindi_words}")

# Convert a number to words in English (India)
english_words = num2words(150, lang='en')
print(f"150 in English: {english_words}")

# Convert with variations (if available for language and number)
# Note: The 'variations' parameter might not yield different results for all numbers/languages.
hindi_variations = num2words(150, lang='hi', variations=True)
print(f"150 in Hindi with variations: {hindi_variations}")

# Convert each digit separately
split_digits = num2words(123, lang='en', split=True)
print(f"123 (split) in English: {split_digits}")

view raw JSON →