Walter Bright wrote:
Andrei Alexandrescu wrote:
Daniel Keep wrote:
There's an interesting idea...
Instead of "No member 'foo'", you could have "No member 'foo'; did you
mean 'far' or 'fur'?"
Heh. The string kernels in std.numeric
(http://erdani.dreamhosters.com/d/web/phobos/std_numeric.html) are to
help with exactly that.
I remember, but can't find, some famous programmer posted to the net a
simple spell checking algorithm that worked by counting letter
additions, deletions, and transpositions to determine best matches.
I don't know who the famous programmer was but it sounds like he was
referring to one of the edit distances. std.algorithm has an
implementation of the popular Levenshtein distance.
http://erdani.dreamhosters.com/d/web/phobos/std_algorithm.html#levenshteinDistance
String kernels go way beyond that because they count the weighted length
of all gapped substrings common to two strings.
http://erdani.dreamhosters.com/d/web/phobos/std_numeric.html#gapWeightedSimilarity
With such a similarity, more subtle errors can be detected.
Andrei