{"id":15717957,"url":"https://github.com/seanoshea/fuzzymatchingswift","last_synced_at":"2025-08-20T16:31:41.347Z","repository":{"id":10735109,"uuid":"66233274","full_name":"seanoshea/FuzzyMatchingSwift","owner":"seanoshea","description":"Fuzzy matching String extensions","archived":false,"fork":false,"pushed_at":"2024-09-29T02:23:05.000Z","size":224,"stargazers_count":45,"open_issues_count":10,"forks_count":4,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-12-19T13:07:29.923Z","etag":null,"topics":["fuzzymatch","fuzzymatching","ios","macosx","swift5","tvos"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/seanoshea.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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":"2016-08-22T02:28:29.000Z","updated_at":"2024-12-12T14:22:49.000Z","dependencies_parsed_at":"2024-10-24T14:31:26.702Z","dependency_job_id":"c9fdb1b8-0aeb-44a3-890a-64ea4423549a","html_url":"https://github.com/seanoshea/FuzzyMatchingSwift","commit_stats":{"total_commits":112,"total_committers":2,"mean_commits":56.0,"dds":0.008928571428571397,"last_synced_commit":"e282a6393222c88c7c038c72871e2c4284591e34"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanoshea%2FFuzzyMatchingSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanoshea%2FFuzzyMatchingSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanoshea%2FFuzzyMatchingSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanoshea%2FFuzzyMatchingSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanoshea","download_url":"https://codeload.github.com/seanoshea/FuzzyMatchingSwift/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230438185,"owners_count":18225870,"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":["fuzzymatch","fuzzymatching","ios","macosx","swift5","tvos"],"created_at":"2024-10-03T21:51:44.905Z","updated_at":"2024-12-19T13:07:33.015Z","avatar_url":"https://github.com/seanoshea.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FuzzyMatchingSwift\n\n[![CI Status](https://circleci.com/gh/seanoshea/FuzzyMatchingSwift/tree/develop.svg?style=svg)](https://circleci.com/gh/seanoshea/FuzzyMatchingSwift/tree/develop)\n[![Code Coverage](http://codecov.io/github/seanoshea/FuzzyMatchingSwift/coverage.svg?branch=develop)](http://codecov.io/github/seanoshea/FuzzyMatchingSwift?branch=develop)\n[![PRs Welcome](https://img.shields.io/badge/prs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n[![License](https://img.shields.io/cocoapods/l/FuzzyMatchingSwift.svg?style=flat)](http://cocoapods.org/pods/FuzzyMatchingSwift)\n[![Version](https://img.shields.io/cocoapods/v/FuzzyMatchingSwift.svg?style=flat)](http://cocoapods.org/pods/FuzzyMatchingSwift)\n[![Platform](https://img.shields.io/cocoapods/p/FuzzyMatchingSwift.svg?style=flat)](http://cocoapods.org/pods/FuzzyMatchingSwift)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n![Swift 5.2.x](https://img.shields.io/badge/Swift-5.2.x-orange.svg)\n[![Languages](https://img.shields.io/github/languages/count/seanoshea/FuzzyMatchingSwift)](https://img.shields.io/github/languages/count/seanoshea/FuzzyMatchingSwift)\n[![Top Language](https://img.shields.io/github/languages/top/seanoshea/FuzzyMatchingSwift)](https://img.shields.io/github/languages/top/seanoshea/FuzzyMatchingSwift)\n[![Open Issues](https://img.shields.io/github/issues/seanoshea/FuzzyMatchingSwift)](https://img.shields.io/github/issues/seanoshea/FuzzyMatchingSwift)\n[![Closed Issues](https://img.shields.io/github/issues-closed/seanoshea/FuzzyMatchingSwift)](https://img.shields.io/github/issues-closed/seanoshea/FuzzyMatchingSwift)\n[![Twitter: @seanoshea](https://img.shields.io/badge/contact-@seanoshea-blue.svg?style=flat)](https://twitter.com/seanoshea)\n\n## Acknowledgements\n\nThe majority of the fuzzy matching logic included in this project is taken from [Neil Fraser's](https://neil.fraser.name/) [google-diff-match-patch](https://code.google.com/p/google-diff-match-patch/)\n\n## Usage\n\n### Matching on Strings\n\n`FuzzyMatchOptions` can be passed to any of these methods to alter how the strict or loose the fuzzy matching algorithm operates.\n\n- `threshold` in `FuzzyMatchOptions` defines how strict you want to be when fuzzy matching. A value of 0.0 is equivalent to an exact match. A value of 1.0 indicates a very loose understanding of whether a match has been found.\n- `distance` in `FuzzyMatchOptions` defines where in the host String to look for the pattern.\n\n```swift\n\"abcdef\".fuzzyMatchPattern(\"ab\") // returns 0\n\"abcdef\".fuzzyMatchPattern(\"z\") // returns nil\n\"🐶🐱🐶🐶🐶\".fuzzyMatchPattern(\"🐱\") // returns 1\n```\n\n### Matching on Arrays of Strings\n\nReturns a new instance of an Array which is sorted by the closest fuzzy match. Does not sort the host Array in place. Will always return the same number of elements that are found in the host Array.\n\n```swift\n[\"one\", \"two\", \"three\"].sortedByFuzzyMatchPattern(\"on\")\n// returns [\"one\", \"two\", \"three\"]\n[\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\", \"ten\"].sortedByFuzzyMatchPattern(\"on\")\n// returns [\"one\", \"nine\", \"two\", \"four\", \"seven\", \"ten\", \"three\", \"five\", \"six\", \"eight\"]\n[\"one\", \"one\", \"two\"].sortedByFuzzyMatchPattern(\"on\")\n// returns [\"one\", \"one\", \"two\"]\n```\n\n### Providing a confidence level\n\nA confidence level allows client code to understand how likely the fuzzy searching algorithm is to find a pattern within a host String. `confidenceScore` returns a Double which indicates how confident we are that the pattern can be found in the host String. A low value (0.001) indicates that the pattern is likely to be found. A high value (0.999) indicates that the pattern is not likely to be found.\n\n```swift\n\"Stacee Lima\".confidenceScore(\"SL\") // returns 0.5\n\"abcdef\".confidenceScore(\"g\") // returns nil\n\"🐶🐱🐶🐶🐶\".confidenceScore(\"🐱\") // returns 0.001\n\"🐶🐱🐶🐶🐶\".confidenceScore(\"🐱🐱🐱🐱🐱\") // returns 0.8\n```\n\n## Documentation\n\nAll documentation is maintained at [Cocoadocs](http://cocoadocs.org/docsets/FuzzyMatchingSwift/)\n\n## Requirements\n\n- iOS \u003e= 18.0\n- MacOS \u003e= 15.0\n- watchOS \u003e= 11.0\n- tvOS \u003e= 8.0\n\n## Installation\n\n### CocoaPods\n\nFuzzyMatchingSwift is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:\n\n```ruby\npod \"FuzzyMatchingSwift\"\n```\n\n### Carthage\n\nFuzzyMatchingSwift is available via [Carthage](https://github.com/Carthage/Carthage). To install, just add this entry to your Cartfile:\n\n```ruby\ngithub \"seanoshea/FuzzyMatchingSwift\"\n```\n\nOnce you've altered your Cartfile, simply run `carthage update`. Check out the instructions in [Carthage's README](https://github.com/Carthage/Carthage) for up to date installation instructions.\n\n## SwiftLint\n\n[SwiftLint](https://github.com/realm/SwiftLint) can be run on the codebase with:\n\n```bash\nswiftlint lint --config .swiftlint.yml\n```\n\n## Author\n\nseanoshea, oshea.ie@gmail.com. See the Acknowledgements section for the original basis for this code.\n\n## License\n\nFuzzyMatchingSwift is available under the Apache 2 license. See the LICENSE file for more info.\n\n## Contributing\n\nSee the [Contributing Instructions](CONTRIBUTING.MD) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanoshea%2Ffuzzymatchingswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanoshea%2Ffuzzymatchingswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanoshea%2Ffuzzymatchingswift/lists"}