It appears that on 1/16/00 5:18 PM, Richard MacLemale [EMAIL PROTECTED] 
wrote:

>function soundex thisWord
>  put char 1 of thisWord into thisWord2
>  repeat with j = 2 to (the number of chars of thisWord)
>    if char j of thisWord = char j+1 of thisWord then next repeat
>    if (char j of thisWord is not "a") and \
>        (char j of thisWord is not "e") and \
>        (char j of thisWord is not "i") and \
>        (char j of thisWord is not "o") and \
>        (char j of thisWord is not "u") and \
>        (char j of thisWord is not "y") and \
>        (char j of thisWord is not "h") then
>      put char j of thisWord after thisWord2
>    end if
>  end repeat
>  return thisWord2
>end soundex

This looks great! You could speed it up by using this:

function soundex thisWord
  put char 1 of thisWord into thisWord2
  repeat with j = 2 to (the number of chars of thisWord)
    if char j of thisWord = char j+1 of thisWord then next repeat
    if (char j of thisWord is not in "aeiouyh") then
      put char j of thisWord after thisWord2
    end if
  end repeat
  return thisWord2
end soundex

This isn't much of a big deal, since you only hit this code once each 
time you find a misspelled word. But combining the dictionary file and 
the soundex file and using the filter command would make things a lot 
simpler and faster. If each line of the combined file looked like this:

creature<tab>crtr

with the word, a tab, and then the soundex, then you could use offset for 
the spellcheck by doing the offset of <return>creature<tab> in return & 
theWordList. The great thing would be finding the suggestions based on 
the soundex. Say you have the soundex in a variable, theSoundex. Then you 
could return the lines that match the soundex just by doing this:

put theWordList into theSoundexMatches
put "*" & tab before theSoundex
filter theSoundexMatches with theSoundex
put theSoundexMatches into fld "Suggestions"

If you set the don't wrap of fld "Suggestions" to true, and the first tab 
stop to a suitably high number, then the list will just show the actual 
words you're suggesting, without the soundexes showing at all.

I'm typing this off the top of my head, so I'm sure there's an even 
better way, but there you go.

gc

Geoff Canyon [EMAIL PROTECTED]
"C.D. Caterpillar teaches kids how to read, not how to watch cartoons."


This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm

Reply via email to