next up previous contents
Next: A. Changelog Up: Aspell .28.3 alpha A Previous: 5. International Support   Contents


6. How Aspell Works

The magic behind my spell checker comes from merging Lawrence Philips excellent metaphone algorithm and Ispell's near miss strategy which is inserting a space or hyphen, interchanging two adjacent letters, changing one letter, deleting a letter, or adding a letter.

The process goes something like this.

  1. Convert the misspelled word to its soundslike equivalent (its metaphone for English words).
  2. Find words that have the same soundslike pattern.
  3. Find words that have similar soundslike patterns. A similar soundlike pattern is a pattern that is obtained by interchanging two adjacent letters, changing one letter, deleting a letter, or adding a letter.
  4. FInd misspelled words that have a correctly spelled replacement by the same criteria of step number 2 and 3. That is the misspelled word in the word pair (such as teh->the) would appear in the suggestions list as if it was a correct spelling.
  5. Score the result list and return the words with the lowest score. The score is roughly the weighed average of the edit distance of the word to the misspelled word, the soundslike equivalent of the two words, and the phoneme of the two words. The edit distance is the weighed total of the number of deletions, insertions, exchanges, or adjacent swaps needed to make one string equivalent to the other.
  6. Replace the misspelled words that have correctly spelled replacements with their replacements and remove any duplicates that might arise because of this.
Please note that the soundslike equivalent is a rough approximation of how the words sounds. It is not the phoneme of the word by any means. For more details about exactly how each step is performed please see the file suggest.cc. For more information on the metaphone algorithm please see the file metaphone.cc which included a detailed description of it.


next up previous contents
Next: A. Changelog Up: Aspell .28.3 alpha A Previous: 5. International Support   Contents
Kevin Atkinson 1999-11-20