# 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:
```sh
pip install indic-num2words
```
## Usage
The module provides a single function for converting numbers to words:
```python
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!
Raw data
{
"_id": null,
"home_page": "https://github.com/sutariyaraj/indic-num2words/",
"name": "indic-num2words",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "python, indic, languages, text to speech, TTS, setup.py",
"author": "Indic-Num2Words Contributors",
"author_email": "sutariyaraj77725@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2a/e2/2b467bdc10f9fd8ef872827a5c287c45932423a989d17194ad4a340ed651/indic_num2words-1.3.0.tar.gz",
"platform": null,
"description": "# indic-num2words - Convert Numbers to Words for Indian Languages\n\nThe `indic-num2words` module converts numerical digits like `36` into words like `\u091b\u0924\u094d\u0924\u0940\u0938` in various Indian languages.\n\n## Installation\n\nTo install the latest stable release from PyPI:\n\n```sh\npip install indic-num2words\n```\n\n## Usage\n\nThe module provides a single function for converting numbers to words:\n\n```python\nfrom num_to_words import num_to_word\n\n# Examples:\nprint(num_to_word(36, lang='hi')) # Output: \u091b\u0924\u094d\u0924\u0940\u0938\nprint(num_to_word('\u096a\u096b', lang='hi')) # Output: \u092a\u0948\u0902\u0924\u093e\u0932\u0940\u0938\nprint(num_to_word(\"35,43,57,730\", lang='hi')) # Output: \u092a\u0948\u0902\u0924\u0940\u0938\u0915\u0930\u094b\u0921\u093c \u0924\u0948\u0902\u0924\u093e\u0932\u0940\u0938\u0932\u093e\u0916 \u0938\u0924\u094d\u0924\u093e\u0935\u0928\u0939\u091c\u093c\u093e\u0930 \u0938\u093e\u0924\u0938\u094c \u0924\u0940\u0938\nprint(num_to_word(795, lang='kn', separator='-')) # Output: \u0c8f\u0cb3\u0cc1\u0ca8\u0cc2\u0cb0-\u0ca4\u0cca\u0c82\u0cac\u0ca4\u0ccd\u0ca4\u0cc8\u0ca6\u0cc1\nprint(num_to_word(545589, lang='en', separator=', ', combiner='-')) # Output: five-lakh, forty-five-thousand, five-hundred, eighty-nine\n```\n\n### Function Parameters\n\n- `num` (int, str): The number to be converted. This can be an integer, string of digits, or a formatted number string.\n- `lang` (str): The language code for the desired output language. Supported languages are listed below.\n- `separator` (str, optional): A string to use as a separator between number groups. Default is a space.\n- `combiner` (str, optional): A string to combine words in complex numbers. Default is a space.\n\n## Supported Languages\n\nThe module currently supports conversion to the following languages:\n\n- `en` (English-India)\n- `hi` (Hindi)\n- `gu` (Gujarati)\n- `mr` (Marathi)\n- `bn` (Bengali)\n- `te` (Telugu)\n- `ta` (Tamil)\n- `kn` (Kannada)\n- `or` (Oriya)\n- `pa` (Punjabi)\n- `ml` (Malayalam)\n\n## Use Cases\n\n1. **Speech Recognition Pre-processing:** Convert numbers to words to improve speech recognition accuracy.\n2. **Language Modeling Data Pre-processing:** Prepare text data for training language models by converting numerical data to words.\n\n## What's Next\n\nWe are planning to add support for the following languages:\n\n- Urdu\n- Assamese\n\nIf 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.\n\n## Contributing\n\nWe welcome contributions! If you'd like to help out, feel free to submit pull requests or raise issues on our GitHub repository.\n\n---\n\nFeel free to reach out if you have any questions or need further assistance. Happy coding!\n",
"bugtrack_url": null,
"license": "Apache License",
"summary": "Package to convert numbers to words with support of multiple indian languages.",
"version": "1.3.0",
"project_urls": {
"Homepage": "https://github.com/sutariyaraj/indic-num2words/",
"Source": "https://github.com/sutariyaraj/indic-num2words/",
"Tracker": "https://github.com/sutariyaraj/indic-num2words/issues"
},
"split_keywords": [
"python",
" indic",
" languages",
" text to speech",
" tts",
" setup.py"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "242f6633fab9b268025ba56627b26b70ff3bd09ea3eba7672b7159a3a229a29f",
"md5": "63ec38c6e2575f6484db6e3c2d0283f0",
"sha256": "fdb5f81f409bb5fd46256e0af62a13d45fd9b9f83f4f166537c52225bc0d33be"
},
"downloads": -1,
"filename": "indic_num2words-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "63ec38c6e2575f6484db6e3c2d0283f0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17439,
"upload_time": "2024-07-08T07:58:33",
"upload_time_iso_8601": "2024-07-08T07:58:33.938038Z",
"url": "https://files.pythonhosted.org/packages/24/2f/6633fab9b268025ba56627b26b70ff3bd09ea3eba7672b7159a3a229a29f/indic_num2words-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2ae22b467bdc10f9fd8ef872827a5c287c45932423a989d17194ad4a340ed651",
"md5": "74e7f0f3846e08184067e7127bd0f9e8",
"sha256": "ee38e2e94eb39caa824505a60251b5b6b47750ad95edb87e6e682f5ba421b448"
},
"downloads": -1,
"filename": "indic_num2words-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "74e7f0f3846e08184067e7127bd0f9e8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 17728,
"upload_time": "2024-07-08T07:58:35",
"upload_time_iso_8601": "2024-07-08T07:58:35.484896Z",
"url": "https://files.pythonhosted.org/packages/2a/e2/2b467bdc10f9fd8ef872827a5c287c45932423a989d17194ad4a340ed651/indic_num2words-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-08 07:58:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sutariyaraj",
"github_project": "indic-num2words",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "indic-num2words"
}