{"id":46748065,"url":"https://github.com/doppio/word2num","last_synced_at":"2026-03-09T20:16:43.971Z","repository":{"id":163724947,"uuid":"639183044","full_name":"doppio/word2num","owner":"doppio","description":"A Python package for converting numbers expressed in natural language to numerical values.","archived":false,"fork":false,"pushed_at":"2023-11-25T00:28:56.000Z","size":45,"stargazers_count":13,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-25T04:05:05.059Z","etag":null,"topics":["natural-language-processing","text-parser"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doppio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-11T00:08:44.000Z","updated_at":"2025-07-21T19:16:44.000Z","dependencies_parsed_at":"2023-11-25T01:28:31.310Z","dependency_job_id":null,"html_url":"https://github.com/doppio/word2num","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/doppio/word2num","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doppio%2Fword2num","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doppio%2Fword2num/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doppio%2Fword2num/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doppio%2Fword2num/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doppio","download_url":"https://codeload.github.com/doppio/word2num/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doppio%2Fword2num/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30310259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["natural-language-processing","text-parser"],"created_at":"2026-03-09T20:16:43.217Z","updated_at":"2026-03-09T20:16:43.957Z","avatar_url":"https://github.com/doppio.png","language":"Python","readme":"# word2num 💬 → 🔢 \u003c!-- omit in toc --\u003e\n\n![PyPI Version](https://img.shields.io/pypi/v/word2num?logo=pypi\u0026logoColor=white\u0026style=flat-square)\n\n`word2num` is a Python package for converting numbers expressed in natural language to numerical values. It supports:\n\n- Fractions\n- Decimals\n- Negative values\n- Large numbers into the quintillions\n- Digit sequences\n- Fuzzy string matching\n\n---\n\n## Table of Contents \u003c!-- omit in toc --\u003e\n- [🛠️ Installation](#️-installation)\n- [💻 Usage](#-usage)\n- [🐻 Fuzzy String Matching](#-fuzzy-string-matching)\n  - [Default Fuzzy Threshold](#default-fuzzy-threshold)\n  - [Custom Fuzzy Threshold](#custom-fuzzy-threshold)\n  - [Disable Fuzzy Matching](#disable-fuzzy-matching)\n- [🌐 Language Support](#-language-support)\n- [🤝 Contributing](#-contributing)\n- [📃 License](#-license)\n\n---\n\n\n## 🛠️ Installation\n\nTo use `word2num`, you must first install it. You can do this using pip by running the following command in your terminal:\n\n```\npip install word2num\n```\n\n## 💻 Usage\n\nOnce installed, you can use `word2num` to convert numbers expressed in natural language to numerical values. To parse a single string, use the `word2num` convenience function:\n\n```python\nfrom word2num import word2num\n\nword2num(\"fifty-seven thousand four hundred and twenty-one\")  # 57421\n```\n\nIf you need to parse multiple strings, you can create your own instance of `Word2Num` and call its `parse` method:\n\n```python\nfrom word2num import Word2Num\n\nw2n = Word2Num()\nw2n.parse(\"one hundred and one\")     # 101\nw2n.parse(\"seventeen billion\")       # 17000000000\nw2n.parse(\"negative eight\")          # -8\nw2n.parse(\"half\")                    # 0.5\nw2n.parse(\"one and three quarters\")  # 1.75\nw2n.parse(\"one three three seven\")   # 1337\n```\n\nNote that these functions will return `None` if a valid numerical value couldn't be interpreted.\n\n## 🐻 Fuzzy String Matching\n\n`word2num` uses fuzzy string matching to help parse misspelled number words.\n\n### Default Fuzzy Threshold\n\nBy default, `word2num` uses a fuzzy threshold of 80, which means that it will match a word to a number if the fuzzy score is 80 or higher.\n\n### Custom Fuzzy Threshold\n\nYou can change the fuzzy threshold by passing a `fuzzy_threshold` parameter to the `word2num` function or to the `Word2Num` class constructor:\n\n```python\n# Using the word2num function\nword2num(\"soxteeeen\", fuzzy_threshold=60) # [16]\n\n# Using the Word2Num class\nw2n = Word2Num(fuzzy_threshold=60)\nw2n.parse(\"twoo hunrdered and twienty-too\")  # [222]\n```\n\n### Disable Fuzzy Matching\n\nTo disable fuzzy matching (exact matching only), you can set the `fuzzy_threshold` to 100:\n\n```python\nw2n = Word2Num(fuzzy_threshold=100)\nw2n.parse(\"two hundered and twinty-two\")  # None\n```\n\n## 🌐 Language Support\n\n* English\n* Spanish\n\nWe'd love to add support for other languages. Contributions are more than welcome, so if you're interested in contributing, see the \"Contributing\" section below!\n\n## 🤝 Contributing\n\nContributions to `word2num` are more than welcome! If you'd like to contribute, please follow these guidelines:\n\n- Make sure the tests pass by running `pytest` in the root directory of the repository.\n- If appropriate, add new tests to cover your changes.\n- Follow the existing code style and conventions.\n- Create a pull request with your changes.\n\n## 📃 License\n\n`word2num` is released under the MIT License. See `LICENSE.txt` for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoppio%2Fword2num","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoppio%2Fword2num","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoppio%2Fword2num/lists"}