Fuzzy Name Matching in Postgres
info.crunchydata.com
info.crunchydata.com
SOUNDEX turns 103 this year. https://en.wikipedia.org/wiki/Soundex It's used for telephone-directory and census lookup for names in American English, and is designed for high false-positive matches. It's simplistic. But it's a snap to index. In Bayes lingo it's sensitive but not selective.
I guess for English names, Soundex is fairly good.
https://en.wikipedia.org/wiki/International_nonproprietary_n...
> At present, the soundex, metaphone, dmetaphone, and dmetaphone_alt functions do not work well with multibyte encodings (such as UTF-8).
I#m not sure but most postgres databases use utf-8
It was in France for the Yellow Pages (PagesJaunes) and initially we used soundex but it was too English centric. We ended up using the Double Metaphone [1] which works better for other European languages.
Our database (Oracle) didn't come with any extension to do that so we'd programmatically populate a column at the time the table was loaded, then indexed it.
We also weren't quite searching for family names but for city names and street names, so there was a fair bit of pre-processing applied to identify the list of most likely words to be useful for the match.
[1] https://en.wikipedia.org/wiki/Metaphone#Double_Metaphone
It’s a trivia game app based on a TV show. In the TV show candidates try to guess the right answer just by saying. How it’s written is not relevant (in order to score points). However in the app users need to write it down (voice support coming soon) and can make spelling mistakes. For a lot of stuff the Levenshtein distance just doesn’t cut it.
A quantum leap would be to integrate an implementation of the symmetric delete algorithm, such as https://github.com/wolfgarbe/SymSpell
Soundex and Phonex can yield too many false negatives outside of phonetically English names. Levenshtein/Jaro-Winkler aren't indexable solutions themselves, so they require N^2 comparisons. SymSpell conceptually combines these two into an indexed string-distance solution. It has the usual index issue of being designed for many reads, few writes.
that would have been the right fit for fuzzy name matching.
TF-IDF is a useful option as part of a high precision pipeline _post_ blocking.
A two step pipeline is typical and necessary because the high precision pipeline, while more accurate than the blocking algorithm, suffers from being slow.
Similaritiy search (https://www.elastic.co/guide/en/elasticsearch/reference/curr...) is far better assuming you have some corpus already.
https://www.alibabacloud.com/blog/keyword-analysis-with-post...
The key is you have to compute the IDF into a side table using the ts_stat function, since this is a global property (inter-document frequency) of your corpus. Once you have your IDF table you can write a ranking function based on that table.
the Alibaba Cloud article is nice..but we are really comparing this with Elastic