{"id":24460879,"url":"https://github.com/shalinir8/mathspell","last_synced_at":"2025-04-13T05:35:05.847Z","repository":{"id":270895978,"uuid":"911780062","full_name":"ShaliniR8/mathspell","owner":"ShaliniR8","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-12T21:19:34.000Z","size":22,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T19:37:02.791Z","etag":null,"topics":["contextual","num2word","package","python","spacy","spacy-nlp"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/mathspell/","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/ShaliniR8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-03T20:42:41.000Z","updated_at":"2025-01-06T01:02:04.000Z","dependencies_parsed_at":"2025-01-03T21:40:06.211Z","dependency_job_id":null,"html_url":"https://github.com/ShaliniR8/mathspell","commit_stats":null,"previous_names":["shalinir8/mathspell"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaliniR8%2Fmathspell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaliniR8%2Fmathspell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaliniR8%2Fmathspell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaliniR8%2Fmathspell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShaliniR8","download_url":"https://codeload.github.com/ShaliniR8/mathspell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234892723,"owners_count":18902907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["contextual","num2word","package","python","spacy","spacy-nlp"],"created_at":"2025-01-21T04:15:43.002Z","updated_at":"2025-01-21T04:15:44.986Z","avatar_url":"https://github.com/ShaliniR8.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MathSpell\n\nMathSpell is a Python package for converting numbers into contextually appropriate words, such as \"twenty-first century\" for years or \"two thousand and twenty-three\" for general numbers.\n\n## Installation\n\n1. Install the package:\n    ```bash\n    pip install mathspell\n    ```\n\n2. Download the required spaCy language model:\n    ```bash\n    python -m spacy download en_core_web_sm\n    ```\n\n3. Upgrade Pint to it's latest version if it is incompatible with the current version of numpy.\n    ```bash\n    pip install --upgrade pint\n    ```\n\n## Usage\n\nAfter installation, you can use MathSpell to process text containing numbers. For example:\n\n```python\nfrom mathspell import analyze_text\n\ntext = \"This is the 21st century. I was born in 1995.\"\nconverted_text = analyze_text(text)\nprint(converted_text)\n# Output: \"This is the twenty-first century. I was born in nineteen ninety-five.\"\n```\n\n## **Further Examples**\n\n### **1. Year Conversion**\n```python\nfrom mathspell import analyze_text\n\ninput_text = \"Something happened in 2021.\"\noutput = analyze_text(input_text)\nprint(output)\n# Output: \"Something happened in twenty twenty-one.\"\n```\n\n---\n\n### **2. Ordinal Numbers**\n```python\nfrom mathspell import analyze_text\n\ninput_text = \"This is my 3rd attempt to fix the bug.\"\noutput = analyze_text(input_text)\nprint(output)\n# Output: \"This is my third attempt to fix the bug.\"\n```\n\n---\n\n### **3. Dates and Years**\n```python\nfrom mathspell import analyze_text\n\ninput_text = \"My birthday is on 4th April, 1993.\"\noutput = analyze_text(input_text)\nprint(output)\n# Output: \"My birthday is on fourth April, nineteen ninety-three.\"\n```\n\n---\n\n### **4. Quantities**\n```python\nfrom mathspell import analyze_text\n\ninput_text = \"This contains 15 boxes.\"\noutput = analyze_text(input_text)\nprint(output)\n# Output: \"This contains fifteen boxes.\"\n```\n\n### **5. Handling Ordinal and Non-Ordinal Context**\n```python\nfrom mathspell import analyze_text\n\ninput_text = \"This is the 1st floor, and the elevator can hold 5 people.\"\noutput = analyze_text(input_text)\nprint(output)\n# Output: \"This is the first floor, and the elevator can hold five people.\"\n```\n\n---\n\n### **6. Temperature Conversion**\n```python\nfrom mathspell import analyze_text\n\ninput_text = \"The temperature is expected to be 25 degrees tomorrow.\"\noutput = analyze_text(input_text)\nprint(output)\n# Output: \"The temperature is expected to be twenty-five degrees tomorrow.\"\n```\n\n---\n\n### **7. Complex Sentence**\n```python\nfrom mathspell import analyze_text\n\ninput_text = \"The 2nd prize was awarded in 2022 for the 10th time.\"\noutput = analyze_text(input_text)\nprint(output)\n# Output: \"The second prize was awarded in twenty twenty-two for the tenth time.\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalinir8%2Fmathspell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshalinir8%2Fmathspell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalinir8%2Fmathspell/lists"}