Re: Spelling suggestions for common words - ispell, etc.



On Apr 3, 6:47 pm, sftriman <ironma...@xxxxxxxxx> wrote:
I am looking for a way to, without custom defining a dictionary, to
get a list of suggested words for a misspelled word. Or better, "the"
most likely intended word for a misspelled word.

from which I could easily pass on the dmr suggestions, but, scoring
and evaluating the suggestions for wjite is harder. "white" and
"write" are 'ranked' (I guess) 3rd, 4th, and 7th.

One thing which might help you rank the strings is the "Levenshtein
distance". This gives you the "difference" between two strings as a
number. I don't know if it is on CPAN but there is a module found
here:

http://world.std.com/~swmcd/steven/perl/lib/String/Levenshtein/index.html

The documentation is here:

http://world.std.com/~swmcd/steven/perl/lib/String/Levenshtein/Levenshtein.html

Presumably the string with the smallest Levenshtein distance from the
input string would be the most likely candidate for the spelling
checker, although some very rare words might have small distances.
.



Relevant Pages

  • Re: Fuzzy Lookups
    ... Computes a relative distance between two strings. ... def LevenshteinRelative: ... Returns the Levenshtein distance between two strings ...
    (comp.lang.python)
  • Re: Algorithm/Theory help: Patterns, comparing, calculating distance between?
    ... The definition and computation distances between strings is a heavily ... To get a handle on the literature, look for Levenshtein distance (check ... Then you find the minimum cost sequence of edits that are required to ... it is common to define a positive cost for each non-trivial edit ...
    (comp.ai)
  • Re: Minimum levenshtein distance for a set of words
    ... | - tells me how many words have this distance ... The algorithm in there that perhaps comes closest to doing ... smallest *total* distance to the given strings. ... Then I suppose by adjusting the weights you could find the ...
    (sci.math)
  • Re: Minimum levenshtein distance for a set of words
    ... > | - set of all words which have the minimum distance if finite ... > The algorithm in there that perhaps comes closest to doing ... > smallest *total* distance to the given strings. ... For example for a set A with two elements and cost values all the same ...
    (sci.math)
  • Re: Baggs Para-Acoustic DI question
    ... Feedback happens when the sound from the speakers hits the guitar in ... phase with the vibrating strings, ... the vibration of the strings. ... depends on the ratio between the distance from you to the speaker ...
    (rec.music.makers.guitar.acoustic)