Skip to content

StringScore is an Objective-C library which provides super fast fuzzy string matching/scoring. Based on the JavaScript library of the same name.

Notifications You must be signed in to change notification settings

w-m/StringScore

 
 

Repository files navigation

StringScore

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.

Setup code extracted

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.

Additional changes

The other changes focus on speeding up the algorithm itself by generating fewer NSString objects.

Credits

Author: Nicholas Bruning

Special thanks to Joshaven Potter for providing the basis for this library.

License

Licensed under the MIT license.

About

StringScore is an Objective-C library which provides super fast fuzzy string matching/scoring. Based on the JavaScript library of the same name.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%