{"id":15761606,"url":"https://github.com/finnfiddle/words-to-numbers","last_synced_at":"2025-06-28T06:36:02.538Z","repository":{"id":10354277,"uuid":"65323508","full_name":"finnfiddle/words-to-numbers","owner":"finnfiddle","description":"JS library to convert textual words to numbers with optional fuzzy text matching","archived":false,"fork":false,"pushed_at":"2024-02-15T18:09:38.000Z","size":119,"stargazers_count":249,"open_issues_count":18,"forks_count":59,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-24T01:03:13.341Z","etag":null,"topics":["es6","javascript","node-js","words-to-numbers"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/finnfiddle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2016-08-09T19:48:25.000Z","updated_at":"2025-02-20T11:59:16.000Z","dependencies_parsed_at":"2024-06-18T13:31:43.215Z","dependency_job_id":"5abfe0c8-eef1-4e35-a708-caffa7f4d7bb","html_url":"https://github.com/finnfiddle/words-to-numbers","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":0.25,"last_synced_commit":"5a48956bb7dc767fa1b1fcabd60654d1005833b5"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/finnfiddle/words-to-numbers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnfiddle%2Fwords-to-numbers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnfiddle%2Fwords-to-numbers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnfiddle%2Fwords-to-numbers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnfiddle%2Fwords-to-numbers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/finnfiddle","download_url":"https://codeload.github.com/finnfiddle/words-to-numbers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finnfiddle%2Fwords-to-numbers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261859285,"owners_count":23220718,"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":["es6","javascript","node-js","words-to-numbers"],"created_at":"2024-10-04T11:03:11.412Z","updated_at":"2025-06-28T06:36:02.520Z","avatar_url":"https://github.com/finnfiddle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Words To Numbers\n\nConvert words to numbers. Optionally fuzzy match the words to numbers.\n\n```\nnpm install words-to-numbers\n```\n\nIf the whole string passed is a number then it will return a `Number` type otherwise it will return the original string with all instances of numbers replaced.\n\nTODO: Add functionality for parsing mixed numbers and words. PRs welcome.\n\n## Basic Examples\n\n```javascript\nimport wordsToNumbers from 'words-to-numbers';\nwordsToNumbers('one hundred'); //100\nwordsToNumbers('one hundred and five'); //105\nwordsToNumbers('one hundred and twenty five'); //125\nwordsToNumbers('four thousand and thirty'); //4030\nwordsToNumbers('six million five thousand and two'); //6005002\nwordsToNumbers('a thousand one hundred and eleven'); //1111\nwordsToNumbers('twenty thousand five hundred and sixty nine'); //20569\nwordsToNumbers('five quintillion'); //5000000000000000000\nwordsToNumbers('one-hundred'); //100\nwordsToNumbers('one-hundred and five'); //105\nwordsToNumbers('one-hundred and twenty-five'); //125\nwordsToNumbers('four-thousand and thirty'); //4030\nwordsToNumbers('six-million five-thousand and two'); //6005002\nwordsToNumbers('a thousand, one-hundred and eleven'); //1111\nwordsToNumbers('twenty-thousand, five-hundred and sixty-nine'); //20569\n```\n\n## Multiple numbers in a string\n\nReturns a string with all instances replaced.\n\n```javascript\nwordsToNumbers('there were twenty-thousand, five-hundred and sixty-nine X in the five quintillion Y')) // 'there were 20569 X in the 5000000000000000000 Y'\n```\n\n## With Fuzzy Matching\n\nUses [Jaro distance](http://yomguithereal.github.io/clj-fuzzy/javascript.html#jaro) to find the best match for the number words. Don't rely on this being completely accurate...\n\n```javascript\nimport wordsToNumbers from 'words-to-numbers';\nwordsToNumbers('won huntred', {fuzzy: true}); //100\nwordsToNumbers('too thousant and fiev', {fuzzy: true}); //2005\nwordsToNumbers('tree millyon sefen hunderd and twinty sex', {fuzzy: true}); //3000726\n```\n\n## Decimal Points\n\n```javascript\nimport wordsToNumbers from 'words-to-numbers';\nwordsToNumbers('ten point five'); //10.5\nwordsToNumbers('three point one four one five nine two six'); //3.1415926\n```\n\n## Ordinal Numbers\n\n```javascript\nimport wordsToNumbers from 'words-to-numbers';\nwordsToNumbers('first'); //1\nwordsToNumbers('second'); //2\nwordsToNumbers('third'); //3\nwordsToNumbers('fourteenth'); //14\nwordsToNumbers('twenty fifth'); //25\nwordsToNumbers('thirty fourth'); //34\nwordsToNumbers('forty seventh'); //47\nwordsToNumbers('fifty third'); //53\nwordsToNumbers('sixtieth'); //60\nwordsToNumbers('seventy second'); //72\nwordsToNumbers('eighty ninth'); //89\nwordsToNumbers('ninety sixth'); //96\nwordsToNumbers('one hundred and eighth'); //108\nwordsToNumbers('one hundred and tenth'); //110\nwordsToNumbers('one hundred and ninety ninth'); //199\n```\n\n## Commonjs\n\n```javascript\nconst { wordsToNumbers } = require('words-to-numbers');\nwordsToNumbers('one hundred'); //100;\n```\n\n## Implied Hundreds\n\n```javascript\nwordsToNumbers('nineteen eighty four', { impliedHundreds: true }); //1984\nwordsToNumbers('one thirty', { impliedHundreds: true }); //130\nwordsToNumbers('six sixty two', { impliedHundreds: true }); //662\nwordsToNumbers('ten twelve', { impliedHundreds: true }); //1012\nwordsToNumbers('nineteen ten', { impliedHundreds: true }); //1910\nwordsToNumbers('twenty ten', { impliedHundreds: true }); //2010\nwordsToNumbers('twenty seventeen', { impliedHundreds: true }); //2017\nwordsToNumbers('twenty twenty', { impliedHundreds: true }); //2020\nwordsToNumbers('twenty twenty one', { impliedHundreds: true }); //2021\nwordsToNumbers('fifty sixty three', { impliedHundreds: true }); //5063\nwordsToNumbers('fifty sixty', { impliedHundreds: true }); //5060\nwordsToNumbers('fifty sixty three thousand', { impliedHundreds: true }); //5063000\nwordsToNumbers('one hundred thousand', { impliedHundreds: true }); //100000\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinnfiddle%2Fwords-to-numbers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinnfiddle%2Fwords-to-numbers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinnfiddle%2Fwords-to-numbers/lists"}