Re:Getting the closest string match
by paulsutter on Friday May 04, 2012 @12:12AM
(#3926972)
He did far more than use Levenshtein distance. He is matching phrases not individual words.
He created different metrics based on Levenshtein distance, combined them using a weighted formula, and used an optimization algorithm to choose weights. And he provides great visualizations on how it worked.
I've tried several approaches to fuzzy string matching, and I'm impressed with his results and approach. I've bookmarked it for future reference.
The main problem is though that he doesn't go into much detail on how specific his set of parameters is to the phrases he's matching against. I suspect that his optimization won't help much when doing a free match against any possible string, in which case the added detail doesn't do much for the person asking (at least not from what we can gather from the question).
This all presupposes that this is what is meant by "closest".
The deservedly highly ranked response at least addresses some interesting ways of defining "close" while skipping the most important, and difficult, case -- semantic content.
Frederick jumps cows
Frederick never jumps cows
Fred leaps bovines
Re:Getting the closest string match
by avalenciano on Thursday May 03, 2012 @11:21PM
(#3926857)
BTW, Levenshtein distance is implemented in Clojure under the Incanter project (incanter.stats).
The long-winded answer goes in to a huge amount of details on really interesting pattern matching problems... but not really the specific problem mentioned by the question asker.
I'm glad for a world with Stack Overflow and other similar resources, because I find the long answer fascinating but if I were asking the question I'd much prefer also having access to the shorter, succinct, and also-correct answer beneath it.