{"id":25470027,"url":"https://github.com/thinkphp/string.levenshtein","last_synced_at":"2025-09-09T00:37:41.490Z","repository":{"id":66903146,"uuid":"965855","full_name":"thinkphp/String.levenshtein","owner":"thinkphp","description":"A String.method MooTools which calculates Levenshtein distance between two strings.","archived":false,"fork":false,"pushed_at":"2010-10-25T08:09:57.000Z","size":104,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-02T08:26:21.200Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://thinkphp.ro/apps/js-hacks/String.levenshtein/String.levenshtein.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinkphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-06T07:38:05.000Z","updated_at":"2025-01-22T20:11:53.000Z","dependencies_parsed_at":"2023-02-20T14:00:21.207Z","dependency_job_id":null,"html_url":"https://github.com/thinkphp/String.levenshtein","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thinkphp/String.levenshtein","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FString.levenshtein","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FString.levenshtein/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FString.levenshtein/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FString.levenshtein/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkphp","download_url":"https://codeload.github.com/thinkphp/String.levenshtein/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FString.levenshtein/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231097,"owners_count":25245687,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-02-18T08:31:44.737Z","updated_at":"2025-09-09T00:37:41.468Z","avatar_url":"https://github.com/thinkphp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"String.levenshtein\n==================\n\n  This method calculates Levenshtein distance between two strings. In information theory and computer \n  science, the Levenshtein distance is a metric for measuring the amount of difference between two \n  sequences (called edit distance). The Levenshtein distance between two strings is given by minimum \n  number of operations needed to transform one string into another given string, where possible operations \n  are insertion, deletion, or substitution of a single character. \n  The Levenshtein distance algorithm has been used in: \n       * Spell checking\n       * Speech recognition\n       * DNA analysis\n       * plagiarism detection\n\n  The complexity of the algorithm is O(mXn), where n and m are the length of string1 and string2.\n\n\n![Screenshot](http://www.levenshtein.net/images/levenshtein_meilenstein_matrix.gif)\n\n\nHow to use\n----------\n\nFirst you must to include the JS files in the head of your HTML document.\n\n            #HTML\n            \u003cscript type=\"text/javascript\" src=\"mootools.js\"\u003e\u003c/script\u003e\n            \u003cscript type=\"text/javascript\" src=\"String.levenshtein.js\"\u003e\u003c/script\u003e\n\nIn your JavaScript code.\n\n           #JavaScript     \n           var words = [\"rodion\",\"dunia\",\"raskolnikov\",\"adrian\",\"statescu\",\"sunday\",\"saturday\",\"jquery\",\"mootools\",\"dojo\"];\n           function matchWords(input) {\n\n              return words.filter(function(word){\n\n                //calculates levenshtein distance\n                var lev = word.levenshtein(input);  \n\n                //in this case the distance is in the iterval [0,1,2,3];\n                if(lev \u003e=0 \u0026\u0026 lev \u003c= 3 ) {\n\n                   return word;\n                }\n\n             });    \n            }\n            var input = \"rascolnicov\";\n            var similarities = matchWords(input);\n            if(window.console) console.log(\"Did you mean: \" + similarities);\n            var similar = matchWords(\"motols\"); \n            if(window.console) console.log(\"Did you mean: \" + similar);     \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fstring.levenshtein","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkphp%2Fstring.levenshtein","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fstring.levenshtein/lists"}