質問

I'm working on an iOS app. I have a Core Data database with a lot of company names.

When the user insert a company name that does not exist, I would like to show "similar" company names. For example, if the user entered "Aple", I would like to show "Did you mean Apple?".

I know that the technique of finding strings that match a pattern approximately (rather than exactly) is called approximate string matching or, colloquially, fuzzy string searching.

In theory, there are many algorithms, more or less valid: the Levenshtein distance computing algorithm and so on.

But in practice, is there someone who has already implemented something similar that can be used easily with core data?

役に立ちましたか?

解決

I found a solution. Use this NSString's category available on GitHub: NSString-DamerauLevenshtein.

他のヒント

Try looking at Soundex, I believe that is part of the core featureset for SQLite, if that is your underlying data store.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top