{"id":26876824,"url":"https://github.com/sphericalkat/rapidfuzz-flutter","last_synced_at":"2026-04-08T21:31:30.496Z","repository":{"id":284865917,"uuid":"955716167","full_name":"SphericalKat/rapidfuzz-flutter","owner":"SphericalKat","description":"A flutter wrapper for rapidfuzz","archived":false,"fork":false,"pushed_at":"2025-03-28T03:49:11.000Z","size":248,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T04:31:47.130Z","etag":null,"topics":["android","ffi","flutter","ios","linux","macos","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","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":"2025-03-27T04:43:39.000Z","updated_at":"2025-03-28T04:06:23.000Z","dependencies_parsed_at":"2025-03-28T04:31:52.525Z","dependency_job_id":"acdb0846-8f5b-4486-91ae-3aebc853fd32","html_url":"https://github.com/SphericalKat/rapidfuzz-flutter","commit_stats":null,"previous_names":["sphericalkat/rapidfuzz-flutter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Frapidfuzz-flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Frapidfuzz-flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Frapidfuzz-flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SphericalKat%2Frapidfuzz-flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SphericalKat","download_url":"https://codeload.github.com/SphericalKat/rapidfuzz-flutter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246458008,"owners_count":20780678,"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":["android","ffi","flutter","ios","linux","macos","windows"],"created_at":"2025-03-31T11:17:06.017Z","updated_at":"2026-04-08T21:31:30.468Z","avatar_url":"https://github.com/SphericalKat.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rapidfuzz\n\nA Flutter port of the [rapidfuzz](https://github.com/maxbachmann/rapidfuzz) library. Note that results may differ from the original implementation due to minor differences in the implementation.\n\n## Usage\n\n### Installation\n```bash\nflutter pub add rapidfuzz\n```\n\n### Import\n```dart\nimport 'package:rapidfuzz/rapidfuzz.dart';\n```\n\n## Algorithms\n\n### Ratio\nCalculates a Levenshtein simple ratio between the strings\nThis indicates a measure of similarity\n\n```dart\nratio(\"this is a test\", \"this is a test!\") // 96.55172413793103\n```\n### Partial Ratio\nInconsistent substrings lead to problems in matching.\nThis ratio uses a heuristic called \"best partial\" for when two strings are\nof noticeably different lengths.\n\n```dart\npartialRatio(\"this is a test\", \"this is a test!\") // 100.0\n```\n\n### Token Sort Ratio\nFind all alphanumeric tokens in the string and sort these tokens\nand then take ratio of resulting joined strings.\n\n```dart\nratio(\"fuzzy wuzzy was a bear\", \"wuzzy fuzzy was a bear\") // 90.90908813476562\ntokenSortRatio(\"fuzzy wuzzy was a bear\", \"wuzzy fuzzy was a bear\") // 100\n```\n\n### Token Set Ratio\nSplits the strings into tokens and computes intersections and remainders\nbetween the tokens of the two strings. A comparison string is then\nbuilt up and is compared using the simple ratio algorithm.\n\n```dart\ntokenSortRatio(\"fuzzy was a bear\", \"fuzzy fuzzy was a bear\") // 83.8709716796875\ntokenSetRatio(\"fuzzy was a bear\", \"fuzzy fuzzy was a bear\") // 100\n```\n\n### Weighted Ratio\nCalculates a weighted ratio between [s1] and [s2] using the best option from\nthe above fuzzy matching algorithms\n\n```dart\nweightedRatio(\"The quick brown fox jimps ofver the small lazy dog\", \"the quick brown fox jumps over the small lazy dog\") // 96.96969696969697\n```\n\n## Extraction\nIt is often more useful to extract the most similar strings from a list of strings than to calculate the ratio between two strings.\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.0, 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 googleplus, score: 90.0, index: 5), (string google, score: 83.33333333333334, index: 0)]\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 googleplus, score: 90.0, index: 5), (string google, score: 83.33333333333334, index: 0), (string plexoogl, score: 42.85714285714286, index: 7), (string bingnews, score: 28.57142857142857, index: 6), (string linkedin, score: 28.57142857142857, index: 3), (string facebook, score: 28.57142857142857, index: 2), (string bing, score: 22.5, index: 1), (string twitter, score: 15.384615384615385, 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.33333333333334, index: 0), (string bing, score: 22.5, index: 1), (string facebook, score: 28.57142857142857, index: 2), (string linkedin, score: 28.57142857142857, index: 3), (string twitter, score: 15.384615384615385, index: 4), (string googleplus, score: 90.0, index: 5), (string bingnews, score: 28.57142857142857, index: 6), (string plexoogl, score: 42.85714285714286, 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.0, index: 3)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsphericalkat%2Frapidfuzz-flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsphericalkat%2Frapidfuzz-flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsphericalkat%2Frapidfuzz-flutter/lists"}