Sign in to follow this  
Followers 0
myspacee

Spellchecker suggestion feature

2 posts in this topic

Hello to all,

un these days a take again my Spellchecker project. It use some pubblic resources (open office dictionaries)

and take part of my other scripts.

I'm here to ask if is possbile to script a common spellchecker feature.

A program that return 'similar' words.

For me similar concept describe this :

- missing letters [friendshp]

- mispelled letters [frientship]

- more letters than [friendshiip]

my task is return all word (of given list) that contain most letter possible of given one.

Nice test concept can be done here: http://www.spellchecker.net/spellcheck/

where form, on mispelled word, return suggestion.

Thak you for any reply,

m.

Share this post


Link to post
Share on other sites



Think to have sort of solution for my problem.

Change approach.

First attempt to implement Soundex a phonetic algorithms which can find similar sounding terms and names.

A Soundex search algorithm takes a written word, such as a person's name, as input and produces a character

string that identifies a set of words that are (roughly) phonetically alike.

Try to implement "The Soundex Algorithm" :

#include <string.au3>

;~ The Soundex Algorithm

;~  1. Capitalize all letters in the word and drop all punctuation marks. Pad the word with rightmost blanks as needed during each procedure step.
;~  2. Retain the first letter of the word.
;~  3. Change all occurrence of the following letters to '0' (zero):
;~       'A', E', 'I', 'O', 'U', 'H', 'W', 'Y'.
;~  4. Change letters from the following sets into the digit given:
;~         * 1 = 'B', 'F', 'P', 'V'
;~         * 2 = 'C', 'G', 'J', 'K', 'Q', 'S', 'X', 'Z'
;~         * 3 = 'D','T'
;~         * 4 = 'L'
;~         * 5 = 'M','N'
;~         * 6 = 'R' 
;~  5. Remove all pairs of digits which occur beside each other from the string that resulted after step (4).
;~  6. Remove all zeros from the string that results from step 5.0 (placed there in step 3)
;~  7. Pad the string that resulted from step (6) with trailing zeros and return only the first four positions, which will be of the form <uppercase letter> <digit> <digit> <digit>. 

$answer = InputBox("Question", "What your name ?", "Robert", "", -1, -1, 0, 0)


;-------------------------------------------------------- char CONVERSION
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "!", " ")
    $answer = StringReplace($answer, chr(34), " ")
    $answer = StringReplace($answer, "#", " ")
    $answer = StringReplace($answer, "$", " ")
    $answer = StringReplace($answer, "%", " ")
    $answer = StringReplace($answer, "&", " ")
    $answer = StringReplace($answer, "'", " ")
    $answer = StringReplace($answer, "(", " ")
    $answer = StringReplace($answer, ")", " ")
    $answer = StringReplace($answer, "*", " ")
    $answer = StringReplace($answer, "+", " ")
    $answer = StringReplace($answer, ",", " ")
    $answer = StringReplace($answer, "-", " ")
    $answer = StringReplace($answer, ".", " ")
    $answer = StringReplace($answer, "/", " ")
    $answer = StringReplace($answer, ";", " ")
    $answer = StringReplace($answer, "<", " ")
    $answer = StringReplace($answer, "=", " ")
    $answer = StringReplace($answer, ">", " ")
    $answer = StringReplace($answer, "?", " ")
    $answer = StringReplace($answer, "@", " ")
    $answer = StringReplace($answer, ":", " ")
    $answer = StringReplace($answer, "[", " ")
    $answer = StringReplace($answer, "\", " ")
    $answer = StringReplace($answer, "]", " ")
    $answer = StringReplace($answer, "^", " ")
    $answer = StringReplace($answer, "_", " ")
    $answer = StringReplace($answer, "`", " ")
    $answer = StringReplace($answer, "{", " ")
    $answer = StringReplace($answer, "}", " ")
    $answer = StringReplace($answer, "~", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "¡", " ")
    $answer = StringReplace($answer, "¢", " ")
    $answer = StringReplace($answer, "£", " ")
    $answer = StringReplace($answer, "¤", " ")
    $answer = StringReplace($answer, "¥", " ")
    $answer = StringReplace($answer, "¦", " ")
    $answer = StringReplace($answer, "§", " ")
    $answer = StringReplace($answer, "¨", " ")
    $answer = StringReplace($answer, "©", " ")
    $answer = StringReplace($answer, "ª", " ")
    $answer = StringReplace($answer, "«", " ")
    $answer = StringReplace($answer, "¬", " ")
    $answer = StringReplace($answer, "­", " ")
    $answer = StringReplace($answer, "®", " ")
    $answer = StringReplace($answer, "¯", " ")
    $answer = StringReplace($answer, "°", " ")
    $answer = StringReplace($answer, "±", " ")
    $answer = StringReplace($answer, "²", " ")
    $answer = StringReplace($answer, "³", " ")
    $answer = StringReplace($answer, "´", " ")
    $answer = StringReplace($answer, "µ", " ")
    $answer = StringReplace($answer, "¶", " ")
    $answer = StringReplace($answer, "·", " ")
    $answer = StringReplace($answer, "¸", " ")
    $answer = StringReplace($answer, "¹", " ")
    $answer = StringReplace($answer, "º", " ")
    $answer = StringReplace($answer, "»", " ")
    $answer = StringReplace($answer, "¼", " ")
    $answer = StringReplace($answer, "½", " ")
    $answer = StringReplace($answer, "¾", " ")
    $answer = StringReplace($answer, "¿", " ")
    $answer = StringReplace($answer, "×", " ")
    $answer = StringReplace($answer, "Þ", " ")
    $answer = StringReplace($answer, "ß", " ")
    $answer = StringReplace($answer, "÷", " ")
    $answer = StringReplace($answer, "ø", " ")
    $answer = StringReplace($answer, "þ", " ")
    $answer = StringReplace($answer, "|", " ")
    
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "", " ")
    $answer = StringReplace($answer, "  ", " ")

    $answer = StringReplace($answer, "0", "")
    $answer = StringReplace($answer, "1", "")
    $answer = StringReplace($answer, "2", "")
    $answer = StringReplace($answer, "3", "")
    $answer = StringReplace($answer, "4", "")
    $answer = StringReplace($answer, "5", "")
    $answer = StringReplace($answer, "6", "")
    $answer = StringReplace($answer, "7", "")
    $answer = StringReplace($answer, "8", "")
    $answer = StringReplace($answer, "9", "")
    $answer = StringReplace($answer, "  ", "") 




    $answer = StringReplace($answer,"á", "A")
    $answer = StringReplace($answer,"à", "A")
    $answer = StringReplace($answer,"â", "A")
    $answer = StringReplace($answer,"ä", "A")
    $answer = StringReplace($answer,"ã", "A")
    $answer = StringReplace($answer,"å", "A")
    $answer = StringReplace($answer,"æ", "A")
    $answer = StringReplace($answer,"b", "B")
    $answer = StringReplace($answer,"c", "C")
    $answer = StringReplace($answer,"ç", "C")

    $answer = StringReplace($answer,"d", "D")
    $answer = StringReplace($answer,"ð", "O")
    $answer = StringReplace($answer,"e", "E")
    $answer = StringReplace($answer,"é", "E")
    $answer = StringReplace($answer,"è", "E")
    $answer = StringReplace($answer,"ê", "E")
    $answer = StringReplace($answer,"ë", "E")

    $answer = StringReplace($answer,"í", "I")
    $answer = StringReplace($answer,"ì", "I")
    $answer = StringReplace($answer,"î", "I")
    $answer = StringReplace($answer,"ï", "I")

    $answer = StringReplace($answer,"ñ", "N")
    $answer = StringReplace($answer,"ó", "O")
    $answer = StringReplace($answer,"ò", "O")
    $answer = StringReplace($answer,"ô", "O")
    $answer = StringReplace($answer,"ö", "O")
    $answer = StringReplace($answer,"õ", "O")
    $answer = StringReplace($answer,"ø", "O")
    $answer = StringReplace($answer,"", "O")

    $answer = StringReplace($answer,"", "S")

    $answer = StringReplace($answer,"ú", "U")
    $answer = StringReplace($answer,"ù", "U")
    $answer = StringReplace($answer,"û", "U")
    $answer = StringReplace($answer,"ü", "U")

    $answer = StringReplace($answer,"ý", "Y")
    $answer = StringReplace($answer,"ÿ", "Y")
    $answer = StringReplace($answer,"", "Z")
    $answer = StringReplace($answer,"", "Z")


    $answer = StringReplace($answer, " ", "")   ;remove spaces


    $answer = StringUpper($answer)              ; uppercase all
        
;-------------------------------------------------------- split string
    $BOSS_letter = stringleft($answer,1)
    $other_letters = StringMid($answer, 2)
        
;-------------------------------------------------------- LETTERs sobstitution
;~         * 0 = 'A', E', 'I', 'O', 'U', 'H', 'W', 'Y'.
    $other_letters = StringReplace($other_letters ,"A", "0")
    $other_letters = StringReplace($other_letters ,"E", "0")
    $other_letters = StringReplace($other_letters ,"I", "0")
    $other_letters = StringReplace($other_letters ,"O", "0")
    $other_letters = StringReplace($other_letters ,"U", "0")
    $other_letters = StringReplace($other_letters ,"H", "0")
    $other_letters = StringReplace($other_letters ,"W", "0")
    $other_letters = StringReplace($other_letters ,"Y", "0")
;~         * 1 = 'B', 'F', 'P', 'V'
    $other_letters = StringReplace($other_letters ,"B", "1")
    $other_letters = StringReplace($other_letters ,"F", "1")
    $other_letters = StringReplace($other_letters ,"P", "1")
    $other_letters = StringReplace($other_letters ,"V", "1")
;~         * 2 = 'C', 'G', 'J', 'K', 'Q', 'S', 'X', 'Z'
    $other_letters = StringReplace($other_letters ,"C", "2")
    $other_letters = StringReplace($other_letters ,"G", "2")
    $other_letters = StringReplace($other_letters ,"J", "2")
    $other_letters = StringReplace($other_letters ,"K", "2")
    $other_letters = StringReplace($other_letters ,"Q", "2")
    $other_letters = StringReplace($other_letters ,"S", "2")
    $other_letters = StringReplace($other_letters ,"X", "2")
    $other_letters = StringReplace($other_letters ,"Z", "2")
;~         * 3 = 'D','T'
    $other_letters = StringReplace($other_letters ,"D", "3")
    $other_letters = StringReplace($other_letters ,"T", "3")
;~         * 4 = 'L'
    $other_letters = StringReplace($other_letters ,"L", "4")
;~         * 5 = 'M','N'
    $other_letters = StringReplace($other_letters ,"M", "5")
    $other_letters = StringReplace($other_letters ,"N", "5")
;~         * 6 = 'R' 
    $other_letters = StringReplace($other_letters ,"R", "6")
    
    
    
;-------------------------------------------------------- remove pair
$other_letters = StringReplace($other_letters ,"AA", "A")
$other_letters = StringReplace($other_letters ,"BB", "B")   
$other_letters = StringReplace($other_letters ,"CC", "C")   
$other_letters = StringReplace($other_letters ,"DD", "D")   
$other_letters = StringReplace($other_letters ,"EE", "E")   
$other_letters = StringReplace($other_letters ,"FF", "F")   
$other_letters = StringReplace($other_letters ,"GG", "G")   
$other_letters = StringReplace($other_letters ,"HH", "H")   
$other_letters = StringReplace($other_letters ,"II", "I")   
$other_letters = StringReplace($other_letters ,"JJ", "J")   
$other_letters = StringReplace($other_letters ,"KK", "K")   
$other_letters = StringReplace($other_letters ,"LL", "L")   
$other_letters = StringReplace($other_letters ,"MM", "M")   
$other_letters = StringReplace($other_letters ,"NN", "N")   
$other_letters = StringReplace($other_letters ,"OO", "O")   
$other_letters = StringReplace($other_letters ,"PP", "P")   
$other_letters = StringReplace($other_letters ,"QQ", "Q")   
$other_letters = StringReplace($other_letters ,"RR", "R")   
$other_letters = StringReplace($other_letters ,"SS", "S")   
$other_letters = StringReplace($other_letters ,"TT", "T")   
$other_letters = StringReplace($other_letters ,"UU", "U")   
$other_letters = StringReplace($other_letters ,"VV", "V")   
$other_letters = StringReplace($other_letters ,"WW", "W")   
$other_letters = StringReplace($other_letters ,"XX", "X")   
$other_letters = StringReplace($other_letters ,"YY", "Y")       
$other_letters = StringReplace($other_letters ,"ZZ", "Z")
    
;-------------------------------------------------------- Remove all zeros
$other_letters = StringReplace($other_letters ,"0", "")

;--------------------------------------------------------;remove spaces
$other_letters = StringReplace($other_letters, " ", "")         

;-------------------------------------------------------- ASSEMBLE Soundex CODE
$NEW_answer = $BOSS_letter & StringLeft($other_letters & "00000" ,3)


;-------------------------------------------------------- return Soundex CODE
        msgbox(0,"",$NEW_answer)

I must change my wordlist and put near my word pre-calculated Soundex key

Autoit;A330

So i can open door to suggestion feature in my spellchecker script.

And if this can't worcs i laern neuw staaf ... :D

m.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0