# NumWord
![Manual Test](https://github.com/HarshitDalal/numword/actions/workflows/manual_test.yml/badge.svg)
![Daily Test](https://github.com/HarshitDalal/numword/actions/workflows/daily_test.yml/badge.svg)
![PyPI](https://img.shields.io/pypi/v/NumWord)
![PyPI Downloads](https://img.shields.io/pypi/dm/NumWord)
![License MIT](https://img.shields.io/github/license/HarshitDalal/numword)
![codecov](https://codecov.io/gh/HarshitDalal/NumWord/graph/badge.svg?token=3DAOLLEYO3)
NumWord is a Python package that converts numbers written in words to their numerical representation.
## Features
- Convert single digits, two digits, large numbers, decimal numbers, and mixed numbers from words to numbers.
- Convert numbers to words.
- Supports English language.
- Supports Hindi language.
## Installation
To install the package, use pip:
```bash
pip install -r requirements.txt
```
## Usage
Here is an example of how to use the NumWord package:
```python
from NumWord import WordToNumber, NumberToWord
# Convert words to numbers in English
word_to_num_converter = WordToNumber()
result = word_to_num_converter.convert("one hundred twenty three point four five six")
print(result) # Output: 123.456
# Convert numbers to words in English
num_to_word_converter = NumberToWord()
result = num_to_word_converter.convert(123.456)
print(result) # Output: one hundred twenty-three point four five six
# Convert words to numbers in Hindi
word_to_num_converter = WordToNumber()
result = word_to_num_converter.convert("एक सौ तेईस दशमलव चार पांच छह", lang='hi')
print(result) # Output: 123.456
# Convert numbers to words in Hindi
num_to_word_converter = NumberToWord()
result = num_to_word_converter.convert(123.456, lang='hi')
print(result) # Output: एक सौ तेईस दशमलव चार पांच छह
```
## Running Tests
To run the tests, use the following command:
```bash
python -m unittest discover tests
```
## License
This project is licensed under the MIT License - see the MIT License file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/HarshitDalal/NumWord",
"name": "NumWord",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "number, word, conversion, numbers2words, number to word, word to number, num2words, words2number",
"author": "Harshit Dalal",
"author_email": "harshitdalal96@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f2/ee/766e73e16cb3809490e28129b9ae30e32b8eb480a6b47ad52832330b8675/numword-0.0.2.tar.gz",
"platform": null,
"description": "# NumWord\n\n![Manual Test](https://github.com/HarshitDalal/numword/actions/workflows/manual_test.yml/badge.svg)\n![Daily Test](https://github.com/HarshitDalal/numword/actions/workflows/daily_test.yml/badge.svg)\n![PyPI](https://img.shields.io/pypi/v/NumWord)\n![PyPI Downloads](https://img.shields.io/pypi/dm/NumWord)\n![License MIT](https://img.shields.io/github/license/HarshitDalal/numword)\n![codecov](https://codecov.io/gh/HarshitDalal/NumWord/graph/badge.svg?token=3DAOLLEYO3)\n\nNumWord is a Python package that converts numbers written in words to their numerical representation.\n\n## Features\n\n- Convert single digits, two digits, large numbers, decimal numbers, and mixed numbers from words to numbers.\n- Convert numbers to words.\n- Supports English language.\n- Supports Hindi language.\n\n## Installation\n\nTo install the package, use pip:\n\n```bash\npip install -r requirements.txt\n```\n\n## Usage\nHere is an example of how to use the NumWord package:\n\n```python\nfrom NumWord import WordToNumber, NumberToWord\n\n# Convert words to numbers in English\nword_to_num_converter = WordToNumber()\nresult = word_to_num_converter.convert(\"one hundred twenty three point four five six\")\nprint(result) # Output: 123.456\n\n# Convert numbers to words in English\nnum_to_word_converter = NumberToWord()\nresult = num_to_word_converter.convert(123.456)\nprint(result) # Output: one hundred twenty-three point four five six\n\n\n# Convert words to numbers in Hindi\nword_to_num_converter = WordToNumber()\nresult = word_to_num_converter.convert(\"\u090f\u0915 \u0938\u094c \u0924\u0947\u0908\u0938 \u0926\u0936\u092e\u0932\u0935 \u091a\u093e\u0930 \u092a\u093e\u0902\u091a \u091b\u0939\", lang='hi')\nprint(result) # Output: 123.456\n\n# Convert numbers to words in Hindi\nnum_to_word_converter = NumberToWord()\nresult = num_to_word_converter.convert(123.456, lang='hi')\nprint(result) # Output: \u090f\u0915 \u0938\u094c \u0924\u0947\u0908\u0938 \u0926\u0936\u092e\u0932\u0935 \u091a\u093e\u0930 \u092a\u093e\u0902\u091a \u091b\u0939\n``` \n\n\n## Running Tests\nTo run the tests, use the following command:\n```bash\npython -m unittest discover tests\n```\n\n## License\nThis project is licensed under the MIT License - see the MIT License file for details.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A package to convert words to numbers",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/HarshitDalal/NumWord"
},
"split_keywords": [
"number",
" word",
" conversion",
" numbers2words",
" number to word",
" word to number",
" num2words",
" words2number"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e3c6717c03ef170a1114cb2b2d2d672006f591bc74206282f5ca241b6fae0f1f",
"md5": "813d3290b16cc782205bc24b53847e1d",
"sha256": "d801f774d9e801ac8be183169ce9a368fc3c7269d149808242b1ab460edd6edc"
},
"downloads": -1,
"filename": "NumWord-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "813d3290b16cc782205bc24b53847e1d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 9378,
"upload_time": "2025-02-01T11:37:39",
"upload_time_iso_8601": "2025-02-01T11:37:39.787082Z",
"url": "https://files.pythonhosted.org/packages/e3/c6/717c03ef170a1114cb2b2d2d672006f591bc74206282f5ca241b6fae0f1f/NumWord-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f2ee766e73e16cb3809490e28129b9ae30e32b8eb480a6b47ad52832330b8675",
"md5": "a5675231f1cd08f508561c985ba78501",
"sha256": "1b541a21507cd4e96805b36165768fa525ad18fd32fd0288f2e126cdfc0d8bed"
},
"downloads": -1,
"filename": "numword-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "a5675231f1cd08f508561c985ba78501",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9305,
"upload_time": "2025-02-01T11:37:43",
"upload_time_iso_8601": "2025-02-01T11:37:43.624998Z",
"url": "https://files.pythonhosted.org/packages/f2/ee/766e73e16cb3809490e28129b9ae30e32b8eb480a6b47ad52832330b8675/numword-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-01 11:37:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HarshitDalal",
"github_project": "NumWord",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "numword"
}