{"id":19598238,"url":"https://github.com/sphericalkat/dart-fuzzywuzzy","last_synced_at":"2025-04-09T14:14:19.851Z","repository":{"id":38406651,"uuid":"352168196","full_name":"SphericalKat/dart-fuzzywuzzy","owner":"SphericalKat","description":"A dart port of the popular fuzzywuzzy package","archived":false,"fork":false,"pushed_at":"2025-03-06T04:46:21.000Z","size":12257,"stargazers_count":47,"open_issues_count":4,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T12:13:41.846Z","etag":null,"topics":["dart-library","dart-port","fuzzy-search","fuzzywuzzy","levenshtein","null-safety"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/fuzzywuzzy","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SphericalKat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-03-27T20:15:32.000Z","updated_at":"2025-03-27T17:21:05.000Z","dependencies_parsed_at":"2024-03-24T12:31:57.675Z","dependency_job_id":"38127c2d-14a8-4510-8744-a0f886b53da0","html_url":"https://github.com/SphericalKat/dart-fuzzywuzzy","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Fdart-fuzzywuzzy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Fdart-fuzzywuzzy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Fdart-fuzzywuzzy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Fdart-fuzzywuzzy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SphericalKat","download_url":"https://codeload.github.com/SphericalKat/dart-fuzzywuzzy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"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":["dart-library","dart-port","fuzzy-search","fuzzywuzzy","levenshtein","null-safety"],"created_at":"2024-11-11T09:05:24.430Z","updated_at":"2025-04-09T14:14:19.835Z","avatar_url":"https://github.com/SphericalKat.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FuzzyWuzzy\n\n[![Tests](https://github.com/SphericalKat/dart-fuzzywuzzy/actions/workflows/test.yml/badge.svg)](https://github.com/SphericalKat/dart-fuzzywuzzy/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/SphericalKat/dart-fuzzywuzzy/badge.svg?branch=master)](https://coveralls.io/github/SphericalKat/dart-fuzzywuzzy?branch=master)\n\nThis is a Dart port of the popular [FuzzyWuzzy](https://github.com/seatgeek/fuzzywuzzy) python package. This algorithm uses [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to calculate similarity between strings.\n\nI personally needed to use this for my own search algorithms, and there weren't any packages as good as my experience with FuzzyWuzzy was, so here we are. Enjoy!\n\n- Just one dependency ([collection](https://pub.dev/packages/collection)).\n- Pure Dart implementation of the superfast [python-Levenshtein](https://github.com/ztane/python-Levenshtein/).\n- Simple to use.\n- Lightweight.\n- Massive props to the folks over at seatgeek for coming up with the [algorithm](https://chairnerd.seatgeek.com/fuzzywuzzy-fuzzy-string-matching-in-python/).\n\n## Get started\n\n### Add dependency\n\n```yaml\ndependencies:\n  fuzzywuzzy: \u003clatest version\u003e\n```\n\n## Usage\n\nFirst, import the package\n\n```dart\nimport 'package:fuzzywuzzy/fuzzywuzzy.dart'\n```\n\n### Simple ratio\n\n```dart\nratio(\"mysmilarstring\", \"myawfullysimilarstirng\") // 72\nratio(\"mysmilarstring\", \"mysimilarstring\")        // 97\n```\n\n### Partial ratio\n\n```dart\npartialRatio(\"similar\", \"somewhresimlrbetweenthisstring\") // 71\n```\n\n### Token sort ratio\n\n```dart\ntokenSortPartialRatio(\"order words out of\", \"words out of order\") // 100\ntokenSortRatio(\"order words out of\",\"  words out of order\")       // 100\n```\n\n### Token set ratio\n\n```dart\ntokenSetRatio(\"fuzzy was a bear\", \"fuzzy fuzzy fuzzy bear\")         // 100\ntokenSetPartialRatio(\"fuzzy was a bear\", \"fuzzy fuzzy fuzzy bear\")  // 100\n```\n\n### Weighted ratio\n\n```dart\nweightedRatio(\"The quick brown fox jimps ofver the small lazy dog\", \"the quick brown fox jumps over the small lazy dog\") // 97\n```\n\n### Extract\n\n```dart\nextractOne(\n        query: 'cowboys',\n        choices: [\n          'Atlanta Falcons',\n          'New York Jets',\n          'New York Giants',\n          'Dallas Cowboys'\n        ],\n        cutoff: 10,\n      ) // (string Dallas Cowboys, score: 90, index: 3)\n```\n\n```dart\nextractTop(\n        query: 'goolge',\n        choices: [\n          'google',\n          'bing',\n          'facebook',\n          'linkedin',\n          'twitter',\n          'googleplus',\n          'bingnews',\n          'plexoogl'\n        ],\n        limit: 4,\n        cutoff: 50,\n      ) // [(string google, score: 83, index: 0), (string googleplus, score: 75, index: 5)]\n```\n```dart\nextractAllSorted(\n        query: 'goolge',\n        choices: [\n          'google',\n          'bing',\n          'facebook',\n          'linkedin',\n          'twitter',\n          'googleplus',\n          'bingnews',\n          'plexoogl'\n        ],\n        cutoff: 10,\n      ) // [(string google, score: 83, index: 0), (string googleplus, score: 75, index: 5), (string plexoogl, score: 43, index: 7), (string bingnews, score: 29, index: 6), (string linkedin, score: 29, index: 3), (string facebook, score: 29, index: 2), (string bing, score: 23, index: 1), (string twitter, score: 15, index: 4)]\n```\n```dart\nextractAll(\n        query: 'goolge',\n        choices: [\n          'google',\n          'bing',\n          'facebook',\n          'linkedin',\n          'twitter',\n          'googleplus',\n          'bingnews',\n          'plexoogl'\n        ],\n        cutoff: 10,\n      ) // [(string google, score: 83, index: 0), (string bing, score: 23, index: 1), (string facebook, score: 29, index: 2), (string linkedin, score: 29, index: 3), (string twitter, score: 15, index: 4), (string googleplus, score: 75, index: 5), (string bingnews, score: 29, index: 6), (string plexoogl, score: 43, index: 7)]\n```\n### Extract using any a list of any type\nAll `extract` methods can receive `List\u003cT\u003e` and return `List\u003cExtractedResult\u003cT\u003e\u003e`\n```dart\nclass TestContainer {\n  final String innerVal;\n  TestContainer(this.innerVal);\n}\n\nextractOne\u003cTestContainer\u003e(\n        query: 'cowboys',\n        choices: [\n          'Atlanta Falcons',\n          'New York Jets',\n          'New York Giants',\n          'Dallas Cowboys'\n        ].map((e) =\u003e TestContainer(e)).toList(),\n        cutoff: 10,\n        getter: (x) =\u003e x.innerVal\n      ).toString(); // (string Dallas Cowboys, score: 90, index: 3)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsphericalkat%2Fdart-fuzzywuzzy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsphericalkat%2Fdart-fuzzywuzzy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsphericalkat%2Fdart-fuzzywuzzy/lists"}