Here is a spellchecker of sorts. It will find certain possible valid words stored in a hidden field "dict", where the misspelled test word either has one char mistyped, one extra char somewhere, or if the test word is a string one or two chars shorter than, but contained in a valid word. It is implemented as a handler for single words. I also used my first pass at creating a library version of Rinaldi's "fullFind".
I used a scrabble dictionary to populate field "dict", so no word is longer than 15 chars. This was an old HC project ported over just to get practice with Rev. I doubt it has any value except for the joy of scripting. Only the very patient need proceed further... on mouseUp ask "Check which word?" put it into toFind find whole toFind in fld "dict" if the result = "" then exit mouseup --word is correct else put fld "dict" into dict --find toFind within possibles up to 2 chars longer put revFullFind(dict,toFind,"txt") into subset repeat with y = number of lines of subset down to 1 if abs(the length of line y of subset - the length of toFind) > 2 then delete line y of subset end repeat put subset into possibles --find possibles of same length as toFind but with one char incorrect put the length of toFind into wordlength repeat for each line theLine in dict if the length of theline = wordlength then put theline & return after temp end repeat repeat for each line thisLine in temp put 0 into test repeat with y = 1 to the number of chars of thisLine if char y of thisLine ‚ char y of toFind then add 1 to test end repeat if test = 1 then put thisLine & return after possibles end if end repeat --find possibles where toFind has an extra char subtract 1 from wordLength repeat for each line theLine in dict if the length of theLine = wordLength then put theLine & return after oneCharLessList end repeat repeat with y = 1 to number of chars of toFind put toFind into temp delete char y of temp put temp & return after toCheck end repeat repeat for each line theLine in toCheck end repeat end if answer possibles end mouseUp function revFullFind theText,theString,form put "" into temp put 0 into counter repeat for each line theline in thetext add 1 to counter if theString is in theLine then if form = "linNum" then put counter & return after temp else if form = "txt" then put theLine & return after temp end if end if end repeat return temp end revFullFind ************** Make your life easier with all your friends, email, and favorite sites in one place. Try it now. (http://www.aol.com/?optin=new-dp& icid=aolcom40vanity&ncid=emlcntaolcom00000010)
_______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
