{"id":19018441,"url":"https://github.com/skim-rs/fuzzy-matcher","last_synced_at":"2025-12-12T13:24:17.639Z","repository":{"id":53311074,"uuid":"173222065","full_name":"skim-rs/fuzzy-matcher","owner":"skim-rs","description":"Fuzzy Matching Library for Rust","archived":false,"fork":false,"pushed_at":"2024-06-29T10:40:14.000Z","size":68,"stargazers_count":272,"open_issues_count":6,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T13:35:26.428Z","etag":null,"topics":["fuzzy-matching","rust","text-search"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/skim-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-03-01T02:36:19.000Z","updated_at":"2025-03-26T21:14:08.000Z","dependencies_parsed_at":"2024-01-18T04:06:59.038Z","dependency_job_id":"8f8aa18a-546f-4782-a683-4840c5cb88ed","html_url":"https://github.com/skim-rs/fuzzy-matcher","commit_stats":{"total_commits":55,"total_committers":5,"mean_commits":11.0,"dds":"0.21818181818181814","last_synced_commit":"ee73fa4559a9ea06e51b54b0a436590c911c18a1"},"previous_names":["skim-rs/fuzzy-matcher","lotabout/fuzzy-matcher"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skim-rs%2Ffuzzy-matcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skim-rs%2Ffuzzy-matcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skim-rs%2Ffuzzy-matcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skim-rs%2Ffuzzy-matcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skim-rs","download_url":"https://codeload.github.com/skim-rs/fuzzy-matcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526768,"owners_count":20953143,"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":["fuzzy-matching","rust","text-search"],"created_at":"2024-11-08T20:00:46.629Z","updated_at":"2025-12-12T13:24:17.593Z","avatar_url":"https://github.com/skim-rs.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"[![Crates.io](https://img.shields.io/crates/v/fuzzy-matcher.svg)](https://crates.io/crates/fuzzy-matcher)\n\n# Fuzzy Matcher\n\nFuzzy matching algorithm(s) in Rust!\n\n## Usage\n\nIn your Cargo.toml add the following:\n\n```toml\n[dependencies]\nfuzzy-matcher = \"*\"\n```\n\nHere are some code example:\n\n```rust\nuse fuzzy_matcher::FuzzyMatcher;\nuse fuzzy_matcher::skim::SkimMatcherV2;\n\nlet matcher = SkimMatcherV2::default();\nassert_eq!(None, matcher.fuzzy_match(\"abc\", \"abx\"));\nassert!(matcher.fuzzy_match(\"axbycz\", \"abc\").is_some());\nassert!(matcher.fuzzy_match(\"axbycz\", \"xyz\").is_some());\n\nlet (score, indices) = matcher.fuzzy_indices(\"axbycz\", \"abc\").unwrap();\nassert_eq!(indices, [0, 2, 4]);\n```\n\n- `fuzzy_match` only return scores while `fuzzy_indices` returns the matching\n    indices as well.\n- Both function return None if the pattern won't match.\n- The score is the higher the better.\n\n## More example\n\n`echo \"axbycz\" | cargo run --example fz \"abc\"` and check what happens.\n\n## About the Algorithm\n\n### Skim\n\nThe skim is currently used by [skim](https://github.com/lotabout/skim), a\nfuzzy finder.\n\n#### Skim V2\n\n- Just like fzf v2, the algorithm is based on Smith-Waterman algorithm which\n    is normally used in DNA sequence alignment\n- Also checkout https://www.cs.cmu.edu/~ckingsf/bioinfo-lectures/gaps.pdf for\n    more details\n- The time complexity is `O(mn)` where `m, n` are the length of the pattern\n    and input line.\n- Space complexity is `O(mn)` for `fuzzy_indices` and `O(2n)` for\n    `fuzzy_match` which will compress the table for dynamic programming.\n- V2 matcher has an option to set the max element of the score matrix, if\n    `m*n` exceeded the limit, it will fallback to a linear search.\n\n#### Skim V1\n\n- It's based on Smith's post [Reverse Engineering Sublime Text’s Fuzzy Match](https://www.forrestthewoods.com/blog/reverse_engineering_sublime_texts_fuzzy_match/)\n- The implementation here actually has some flaws that don't perform well\n    in certain cases.\n- It's recommended to checkout original implementation in [C++](https://github.com/forrestthewoods/lib_fts/blob/master/code/fts_fuzzy_match.h) and [JavaScript](https://github.com/forrestthewoods/lib_fts/blob/master/code/fts_fuzzy_match.js)\n\n### Clangd\n\n- The algorithm is based on [clangd's FuzzyMatch.cpp](https://github.com/MaskRay/ccls/blob/master/src/fuzzy_match.cc).\n- Also checkout https://github.com/lewang/flx/issues/98 for some variants.\n- The algorithm is `O(mn)` where `m, n` are the length of the pattern and\n    input line.\n- Space complexity is `O(mn)` for `fuzzy_indices` and `O(2n)` for\n    `fuzzy_match` which will compress the table for dynamic programming.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskim-rs%2Ffuzzy-matcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskim-rs%2Ffuzzy-matcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskim-rs%2Ffuzzy-matcher/lists"}