12/29/2008

Spelling Corrector

Input: a word (probably wrongly spelled) A, a set of correct words Bs.
Output: a set of words in Bs that are similar to A (close edit-distance to A).

Algorithms:
result = do 1-radius range query to A.
if(result = null)
result = do 2-radius range query to A.

1-radius query:
for each query, for each each letter in A, remove it or change it with another letter.
So the generated word set S1 are of (25+1)*|A| new words. To see if there is a word in S1 that is identical to a word in Bs. If there is, output this word.

2-radius query:
for each word in S1, repeat previous algorithm.

references:
algo. in java: http://raelcunha.com/spell-correct.php
algo. in python and relevant theory: http://norvig.com/spell-correct.html

没有评论: