这个仓库包含了 CTFuzzySearch 引擎和示例用法。
这个简约的代码示例应在几分钟内让您开始。对于更大的演示,请查看示例实现。
CTFuzzyIndex *index = [CTFuzzyIndex new];
// Add words to the index, these can be hundreds of thousands
[index addWordsFromString:@"fuzzy string searching using CTFuzzySearch" options:CTFuzzyIndexIncludeRanges];
// Search the index for matches of word with 2 errors maximum
NSArray *matches = [index search:@"zearchin" withMaxDistance:2];
for(CTFuzzyMatch *match in matches) {
NSLog("Found %d occurrences of matching word '%@'.", [match.data count], match.value);
}