{"id":21400196,"url":"https://github.com/oefenweb/damerau-levenshtein","last_synced_at":"2025-08-20T07:13:12.614Z","repository":{"id":19885717,"uuid":"23150137","full_name":"Oefenweb/damerau-levenshtein","owner":"Oefenweb","description":"Get text similarity level with Damerau-Levenshtein distance","archived":false,"fork":false,"pushed_at":"2022-03-23T10:45:05.000Z","size":75,"stargazers_count":37,"open_issues_count":2,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-05T18:52:36.935Z","etag":null,"topics":["damerau-levenshtein","php","text"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/Oefenweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-20T13:44:05.000Z","updated_at":"2025-04-28T09:29:54.000Z","dependencies_parsed_at":"2022-08-23T17:40:55.944Z","dependency_job_id":null,"html_url":"https://github.com/Oefenweb/damerau-levenshtein","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Oefenweb/damerau-levenshtein","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oefenweb%2Fdamerau-levenshtein","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oefenweb%2Fdamerau-levenshtein/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oefenweb%2Fdamerau-levenshtein/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oefenweb%2Fdamerau-levenshtein/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oefenweb","download_url":"https://codeload.github.com/Oefenweb/damerau-levenshtein/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oefenweb%2Fdamerau-levenshtein/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271280981,"owners_count":24732103,"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-08-20T02:00:09.606Z","response_time":69,"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":["damerau-levenshtein","php","text"],"created_at":"2024-11-22T15:19:34.221Z","updated_at":"2025-08-20T07:13:12.544Z","avatar_url":"https://github.com/Oefenweb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Damerau Levenshtein\n\n[![CI](https://github.com/Oefenweb/damerau-levenshtein/workflows/CI/badge.svg)](https://github.com/Oefenweb/damerau-levenshtein/actions?query=workflow%3ACI)\n[![PHP 7 ready](http://php7ready.timesplinter.ch/Oefenweb/damerau-levenshtein/badge.svg)](https://travis-ci.org/Oefenweb/damerau-levenshtein)\n[![codecov](https://codecov.io/gh/Oefenweb/damerau-levenshtein/branch/master/graph/badge.svg)](https://codecov.io/gh/Oefenweb/damerau-levenshtein)\n[![Packagist downloads](http://img.shields.io/packagist/dt/Oefenweb/damerau-levenshtein.svg)](https://packagist.org/packages/oefenweb/damerau-levenshtein)\n[![Code Climate](https://codeclimate.com/github/Oefenweb/damerau-levenshtein/badges/gpa.svg)](https://codeclimate.com/github/Oefenweb/damerau-levenshtein)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Oefenweb/damerau-levenshtein/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Oefenweb/damerau-levenshtein/?branch=master)\n\nGet text similarity level with Damerau-Levenshtein distance.\n\n## Requirements\n\n* PHP 7.1.0 or greater.\n\n## Installation\n\n`composer require oefenweb/damerau-levenshtein`\n\n## Usage\n\n```php\n$pattern = 'foo bar';\n$string  = 'fuu baz';\n\n$damerauLevenshtein = new DamerauLevenshtein($pattern, $string);\n\n$damerauLevenshtein-\u003egetSimilarity(); // absolute edit distance; == 3\n\n$damerauLevenshtein-\u003egetRelativeDistance(); // relative edit distance; == 0.57142857142857\n\n$damerauLevenshtein-\u003egetMatrix(); // get complete distance matrix\n/* ==\n * [\n *   [0,1,2,3,4,5,6,7],\n *   [1,0,1,2,3,4,5,6],\n *   [2,1,1,2,3,4,5,6],\n *   [3,2,2,2,3,4,5,6],\n *   [4,3,3,3,2,3,4,5],\n *   [5,4,4,4,3,2,3,4],\n *   [6,5,5,5,4,3,2,3],\n *   [7,6,6,6,5,4,3,3],\n * ]\n */\n\n$damerauLevenshtein-\u003edisplayMatrix(); // get readable and formatted distance matrix\n/*\n *   '  foo bar' . PHP_EOL\n * . ' 01234567' . PHP_EOL\n * . 'f10123456' . PHP_EOL\n * . 'u21123456' . PHP_EOL\n * . 'u32223456' . PHP_EOL\n * . ' 43332345' . PHP_EOL\n * . 'b54443234' . PHP_EOL\n * . 'a65554323' . PHP_EOL\n * . 'z76665433'\n */\n```\n\nDifferent costs are supported by the constructor and getters / setters.\n\nCharacter comparison (equal check) can easily be overridden by parent class (see `DamerauLevenshtein::compare`).\n\nFor more examples look at `/tests/DamerauLevenshteinTest.php` or **RTFC**.\n\n## License\n\nMIT\n\n#### Author Information\n\nMischa ter Smitten (based on work of [Ph4r05](http://www.phpclasses.org/package/7021-PHP-Get-text-similarity-level-with-Damerau-Levenshtein.html))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foefenweb%2Fdamerau-levenshtein","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foefenweb%2Fdamerau-levenshtein","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foefenweb%2Fdamerau-levenshtein/lists"}