{"id":13825522,"url":"https://github.com/scrapinghub/number-parser","last_synced_at":"2025-05-16T00:06:19.768Z","repository":{"id":45124275,"uuid":"262982962","full_name":"scrapinghub/number-parser","owner":"scrapinghub","description":"Parse numbers written in natural language","archived":false,"fork":false,"pushed_at":"2024-10-23T12:27:40.000Z","size":445,"stargazers_count":114,"open_issues_count":19,"forks_count":25,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-14T15:11:37.260Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scrapinghub.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","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":"2020-05-11T08:25:00.000Z","updated_at":"2025-05-01T12:19:14.000Z","dependencies_parsed_at":"2024-01-13T16:25:36.767Z","dependency_job_id":"8463564e-efcf-48e2-89c7-46250c42991c","html_url":"https://github.com/scrapinghub/number-parser","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapinghub%2Fnumber-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapinghub%2Fnumber-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapinghub%2Fnumber-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrapinghub%2Fnumber-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scrapinghub","download_url":"https://codeload.github.com/scrapinghub/number-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442854,"owners_count":22071878,"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":["hacktoberfest"],"created_at":"2024-08-04T09:01:22.702Z","updated_at":"2025-05-16T00:06:19.664Z","avatar_url":"https://github.com/scrapinghub.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"=============\nnumber-parser\n=============\n.. image:: https://img.shields.io/pypi/pyversions/price-parser.svg\n   :target: https://pypi.python.org/pypi/price-parser\n   :alt: Supported Python Versions\n\n``number-parser`` is a simple library that allows you to convert numbers written in the natural\nlanguage to it's equivalent numeric forms. It currently supports cardinal numbers in the following\nlanguages - English, Hindi, Spanish, Ukrainian and Russian and ordinal numbers in English.\n\nInstallation\n============\n::\n\n    pip install number-parser\n\nnumber-parser requires Python 3.9+.\n\nUsage\n=====\n\nThe library provides the following common usages.\n\nConverting numbers in-place\n---------------------------\n\nIdentifying the numbers in a text string, converting them to corresponding numeric values while ignoring non-numeric words.\nThis also supports ordinal number conversion (for English only).\n\n\u003e\u003e\u003e from number_parser import parse\n\u003e\u003e\u003e parse(\"I have two hats and thirty seven coats\")\n'I have 2 hats and 37 coats'\n\u003e\u003e\u003e parse(\"One, Two, Three go\")\n'1, 2, 3 go'\n\u003e\u003e\u003e parse(\"First day of year two thousand\")\n'1 day of year 2000'\n\nParsing a number\n----------------\n\nConverting a single number written in words to it's corresponding integer.\n\n\u003e\u003e\u003e from number_parser import parse_number\n\u003e\u003e\u003e parse_number(\"two thousand and twenty\")\n2020\n\u003e\u003e\u003e parse_number(\"not_a_number\")\n\nParsing an ordinal\n------------------\n\nConverting a single ordinal number written in words to its corresponding integer. (Support for English only)\n\n\u003e\u003e\u003e from number_parser import parse_ordinal\n\u003e\u003e\u003e parse_ordinal(\"twenty third\")\n23\n\u003e\u003e\u003e parse_ordinal(\"seventy fifth\")\n75\n\nParsing a fraction\n------------------\n\nConverting a fractional number written in words to its corresponding integral fraction. (Support for English only)\n\n\u003e\u003e\u003e from number_parser import parse_fraction\n\u003e\u003e\u003e parse_fraction(\"forty two divided by five hundred and six\")\n'42/506'\n\u003e\u003e\u003e parse_fraction(\"one over two\")\n'1/2'\n\u003e\u003e\u003e parse_fraction(\"forty two / one million\")\n'42/1000000'\n\n\nLanguage Support\n----------------\n\nThe default language is English, you can pass the language parameter with corresponding locale for other languages.\nIt currently supports cardinal numbers in the following\nlanguages - English, Hindi, Spanish, Ukrainian and Russian and ordinal numbers in English.\n\n\u003e\u003e\u003e from number_parser import parse, parse_number\n\u003e\u003e\u003e parse(\"Hay tres gallinas y veintitrés patos\", language='es')\n'Hay 3 gallinas y 23 patos'\n\u003e\u003e\u003e parse_number(\"चौदह लाख बत्तीस हज़ार पाँच सौ चौबीस\", language='hi')\n1432524\n\nSupported cases\n---------------\n\nThe library has extensive tests.\nSome of the supported cases are described below.\n\nAccurately handling usage of conjunction while forming the number.\n\n\u003e\u003e\u003e parse(\"doscientos cincuenta y doscientos treinta y uno y doce\", language='es')\n'250 y 231 y 12'\n\n\nHandling ambiguous cases without proper separators.\n\n\u003e\u003e\u003e parse(\"two thousand thousand\")\n'2000 1000'\n\u003e\u003e\u003e parse_number(\"two thousand two million\")\n2002000000\n\n\nHandling nuances in the languag ith different forms of the same number.\n\n\u003e\u003e\u003e parse_number(\"пятисот девяноста шести\", language='ru')\n596\n\u003e\u003e\u003e parse_number(\"пятистам девяноста шести\", language='ru')\n596\n\u003e\u003e\u003e parse_number(\"пятьсот девяносто шесть\", language='ru')\n596\n\nContributing\n============\n\n* Source code: https://github.com/scrapinghub/number-parser\n* Issue tracker: https://github.com/scrapinghub/number-parser/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrapinghub%2Fnumber-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrapinghub%2Fnumber-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrapinghub%2Fnumber-parser/lists"}