krisk / Fuse Swift
Licence: mit
A lightweight fuzzy-search library, with zero dependencies
Stars: ✭ 767
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Fuse Swift
Symspell
SymSpell: 1 million times faster spelling correction & fuzzy search through Symmetric Delete spelling correction algorithm
Stars: ✭ 1,976 (+157.63%)
Mutual labels: fuzzy-search, fuzzy-matching
Fuzzywuzzy
Java fuzzy string matching implementation of the well known Python's fuzzywuzzy algorithm. Fuzzy search for Java
Stars: ✭ 506 (-34.03%)
Mutual labels: fuzzy-search, fuzzy-matching
Fuzzysearch
Find parts of long text or data, allowing for some changes/typos.
Stars: ✭ 157 (-79.53%)
Mutual labels: fuzzy-search, fuzzy-matching
Faint
Extensible TUI fuzzy file file explorer
Stars: ✭ 82 (-89.31%)
Mutual labels: fuzzy-search, fuzzy-matching
Liquidmetal
💦🤘 A mimetic poly-alloy of the Quicksilver scoring algorithm, essentially LiquidMetal. </Schwarzenegger Voice>
Stars: ✭ 279 (-63.62%)
Mutual labels: fuzzy-search, fuzzy-matching
Fuzzball.js
Easy to use and powerful fuzzy string matching, port of fuzzywuzzy.
Stars: ✭ 225 (-70.66%)
Mutual labels: fuzzy-search, fuzzy-matching
Leaderf
An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Stars: ✭ 1,733 (+125.95%)
Mutual labels: fuzzy-search, fuzzy-matching
fish-fzy
fzy inegration with fish. Search history, navigate directories and more. Blazingly fast.
Stars: ✭ 18 (-97.65%)
Mutual labels: fuzzy-search, fuzzy-matching
Yoyo-leaf
Yoyo-leaf is an awesome command-line fuzzy finder.
Stars: ✭ 49 (-93.61%)
Mutual labels: fuzzy-search, fuzzy-matching
Tntsearch
A fully featured full text search engine written in PHP
Stars: ✭ 2,693 (+251.11%)
Mutual labels: fuzzy-search, fuzzy-matching
fuzzy-search
A collection of algorithms for fuzzy search like in Sublime Text.
Stars: ✭ 49 (-93.61%)
Mutual labels: fuzzy-search, fuzzy-matching
levenshtein.c
Levenshtein algorithm in C
Stars: ✭ 77 (-89.96%)
Mutual labels: fuzzy-search, fuzzy-matching
bolt.nvim
⚡ Ultrafast multi-pane file manager for Neovim with fuzzy matching
Stars: ✭ 100 (-86.96%)
Mutual labels: fuzzy-search, fuzzy-matching
SymSpellCppPy
Fast SymSpell written in c++ and exposes to python via pybind11
Stars: ✭ 28 (-96.35%)
Mutual labels: fuzzy-search, fuzzy-matching
Talisman
Straightforward fuzzy matching, information retrieval and NLP building blocks for JavaScript.
Stars: ✭ 584 (-23.86%)
Mutual labels: fuzzy-matching
Ugrep
🔍NEW ugrep v3.1: ultra fast grep with interactive query UI and fuzzy search: search file systems, source code, text, binary files, archives (cpio/tar/pax/zip), compressed files (gz/Z/bz2/lzma/xz/lz4), documents and more. A faster, user-friendly and compatible grep replacement.
Stars: ✭ 626 (-18.38%)
Mutual labels: fuzzy-search
Broot
A new way to see and navigate directory trees : https://dystroy.org/broot
Stars: ✭ 6,362 (+729.47%)
Mutual labels: fuzzy-search
Fuse
What is Fuse?
Fuse is a super lightweight library which provides a simple way to do fuzzy searching.
Usage
Example 1
let fuse = Fuse()
let result = fuse.search("od mn war", in: "Old Man's War")
print(result?.score) // 0.44444444444444442
print(result?.ranges) // [CountableClosedRange(0...0), CountableClosedRange(2...6), CountableClosedRange(9...12)]
Example 2
Search for a text pattern in an array of srings.
let books = ["The Silmarillion", "The Lock Artist", "The Lost Symbol"]
let fuse = Fuse()
// Improve performance by creating the pattern once
let pattern = fuse.createPattern(from: "Te silm")
// Search for the pattern in every book
books.forEach {
let result = fuse.search(pattern, in: $0)
print(result?.score)
print(result?.ranges)
}
Example 3
class Book: Fuseable {
dynamic var name: String
dynamic var author: String
var properties: [FuseProperty] {
return [
FuseProperty(name: "title", weight: 0.3),
FuseProperty(name: "author", weight: 0.7),
]
}
}
let books: [Book] = [
Book(author: "John X", title: "Old Man's War fiction"),
Book(author: "P.D. Mans", title: "Right Ho Jeeves")
]
let fuse = Fuse()
let results = fuse.search("man", in: books)
results.forEach { item in
print("index: " + item.index)
print("score: " + item.score)
print("results: " + item.results)
print("---------------")
}
// Output:
//
// index: 1
// score: 0.015
// results: [(key: "author", score: 0.015000000000000003, ranges: [CountableClosedRange(5...7)])]
// ---------------
// index: 0
// score: 0.028
// results: [(key: "title", score: 0.027999999999999997, ranges: [CountableClosedRange(4...6)])]
Example 4
let fuse = Fuse()
fuse.search("Man", in: books, completion: { results in
print(results)
})
Options
Fuse
takes the following options:
-
location
: Approximately where in the text is the pattern expected to be found. Defaults to0
-
distance
: Determines how close the match must be to the fuzzylocation
(specified above). An exact letter match which isdistance
characters away from the fuzzy location would score as a complete mismatch. A distance of0
requires the match be at the exactlocation
specified, adistance
of1000
would require a perfect match to be within800
characters of the fuzzy location to be found using a 0.8 threshold. Defaults to100
-
threshold
: At what point does the match algorithm give up. A threshold of0.0
requires a perfect match (of both letters and location), a threshold of1.0
would match anything. Defaults to0.6
-
maxPatternLength
: The maximum valid pattern length. The longer the pattern, the more intensive the search operation will be. If the pattern exceeds themaxPatternLength
, thesearch
operation will returnnil
. Why is this important? Read this. Defaults to32
-
isCaseSensitive
: Indicates whether comparisons should be case sensitive. Defaults tofalse
Example Project
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
Fuse is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Fuse"
License
Fuse is available under the MIT license. See the LICENSE file for more info.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].