This fork was created to prove that StringScore provides reasonable performance. The question about it was raised on the Stackoverflow question Objective-c: Fast Fuzzy Search Match.
Mainly, the setup code is pulled out of the scoreAgainst:
method, thus 3 new methods are added to NSString+StringScore
:
- (NSCharacterSet *)invalidCharacterSet;
- (NSString *)decomposedStringWithInvalidCharacterSet:(NSCharacterSet *)invalidCharacterSet;
- (CGFloat) scoreAgainst:(NSString *)anotherString fuzziness:(NSNumber *)fuzziness options:(NSStringScoreOption)options
invalidCharacterSet:(NSCharacterSet *)invalidCharacterSet decomposedString:(NSString *)string;
The first two can be used to generate the data that is needed for the scoring algorithm. It will speed up the operation if scoreAgainst:
is called repeatedly on the same string.
The other changes focus on speeding up the algorithm itself by generating fewer NSString objects.
Author: Nicholas Bruning
Special thanks to Joshaven Potter for providing the basis for this library.
Licensed under the MIT license.