TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | May 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Kirollos Risk.
BitapSearch provides a simple way to do fuzzy searching.
let bitap = BitapSearch()
let result = bitap.search("od mn war", in: "Old Man's War")
print(result?.score) // 0.44444444444444442
print(result?.ranges) // [CountableRange(0..<0), CountableRange(2..<6), CountableRange(9..<12)]
let bitap = BitapSearch()
let books = ["The Silmarillion", "The Lock Artist", "The Lost Symbol"]
// Improve performance by creating the pattern once
let pattern = bitap.createPattern(from: "Te silm")
books.forEach {
let result = bitap.search(pattern, in: $0)
print(result?.score)
print(result?.ranges)
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
BitapSearch is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "BitapSearch"
Kirollos Risk, [email protected]
BitapSearch is available under the MIT license. See the LICENSE file for more info.