Soundex Code Of The Misspelled Word example essay topic
Opening Statement - Cyrez Alright I know im a very lazy person. I have been extremly busy, and i have not put my baby first... (My baby is N 3 T) I know it has been very slow lately. And I intend to change that. I just need to save up some more to do what I want... So sorry If it has been to slow lately.
I plan to start The N 3 T-W 0 Rk Back up. And within a month or two I also plan to start Up a webhosting company... Haha its alot more expensive then what they make it seem like. Sure its $50 a month.
But then you half to get the ssl certifi c and make sure you have a way to process credit cards, Then make sure everyone has there own I. P Address and then you half to advertise soo it gets quite expensive. But Once I have it going, I guarantee It wil be top notch. Hmm what else is there to talk about?? Im sitting with my laptop getting ready to goto sleep, Working on an E-zine that should of been done 3 months ago... I dont know what happened haha... Well Sorry about my baling And on with the magazine.
Enjoy... 2. New Mac's - Cyrez Im no Mac freak, I always had the impression that they were way to easy to use, And i always wanted somethin more difficult, you know somthing you feel like your in control of, so I dont feel like an idiot you know?? But my dads gf bought one of those new Powerbook G 4's you know the really slim ones that have the sick ass screen and such. Well im messing around with it, its pretty cool. I plug in my rj-45 network cable, and without any configuration, its online.
Ohh and thats not all, I want to start up windows networking, so i start that process. And at the bottom it says "To access this computer from your pc goto the following url... I had this baby networked in less then a minute. No hassles at all.
I was like wow Im starting to like this thing... But its mac soo i cant. So i research OSX a little bit, and found its built off of unix. They call there version Darwin. And the whole o /'s is Open source. So i guess Im starting To like this mac.
What Can I Do? But dont get my wrong I still choose linux over mac any day. I just like the Mac Laptops. 3. Soundex: Uses in spell checking - BackSlash Explanation: Ever wondered how the popular word processors such as Word and Wordperfect are able to provide the user with a list of alternate spellings for a word that comes up as being misspelled? The answer is through a standard called Soundex.
Soundex was developed in the 19th century by the US government with the purpose of categorizing similar sounding names in the census. The idea was that it would provide a standardized way of determining if two names sounded the same. Why this was necessary to the census I am not sure, however, over a hundred years after its creation, Soundex is being put to use in word processors. It works as follows.
The word processor's spell checker is activated and an incorrectly spelled word is found within the document, the word processor then provides the user with a list of replacement words. This is where Soundex comes in. To determine which words will be added to the list of replacements, the computer first determines the Soundex code of the incorrectly spelled word. Then the computer loops through all the correctly spelled words in it's database and finds the Soundex code of all the words. Then all the words in the word processor's database that have a Soundex code that matches the incorrectly spelled word are added to the list of replacement words. Rules of Soundex: 1) Soundex codes are 4 characters long.
The first character is a letter, and the last three are numbers. Example: C 000, P 236, J 250 2) The first character is the first letter of the word. Example: "newspaper" returns N 211 3) The three numbers after the letter are numbers derived from the letters in the word through the below table. B, F, P, V all equal the number 1 C, G, J, K, Q, S, X, Z all equal the number 2 D, T all equal the number 3 L equals the number 4 M, N all equal the number 5 R equals the number 6 A, E, I, O, U, H, W, Y are all ignored 4) If two consecutive letters have the same Soundex number, the second is ignored and it's Soundex number is not added to the final code. For instance, in the word "errol", the second "r" would not result in "6" being added to the final Soundex code because "r" precedes it. Also, in the case of the word "ec gbl", the "g" would be ignored because it follows a "c", and both "g" and "c" have the same Soundex number.
5) A vowel can act as a separator. So, if you had "rar", the second "r" would still add "6" to the Soundex code because it the vowel kept it from directly proceeding the first "r". 6) The letters "h" and "W" do not act as separators like the vowels did. So in the case of the word "rw" the second "r" would be ignored and not add a number to the soundex code. Just imagine that the "h" and "w" are not in the words, thus the letters with the same soundex code would be right beside each other which breaks rule 4. This would work the same if the word was "chg".
The "g" would not add its number to the Soundex code because the "h" is ignored and it would be following a "c" which has the same Soundex number as "g". 7) If the final code is less than 4 you add 0's on until it is 4 characters long. If it is longer than 4 characters you disregard everything except the first 4 characters. Working an Example: I'm sure those rules served to do nothing more than confuse you, so allow me to show you an example that puts the rules to use.
1) The word is "bark", so first we put down the letter "b". Take notice that the letter "b" is equivilant to the Soundex number 1, so when we move to the second letter we must make sure that it does not have a Soundex number of 1 so that rule 4 is not broken. The second letter is "a" which does not have a Soundex number, so it is ignored. We move onto the third letter "r" which has a Soundex number of 6. Since the letter before was a vowel we do not have to worry about putting down two consecutive letters with the same Soundex number. So we add "6" to our Soundex code.
Right now the Soundex code looks like "b 6". The "b" is from the first letter "b", the "a" was ignored, and the "6" is from the letter "r". The last letter is "k" which has a Soundex number of "2". Since the "2" is not equivilant to its preceding number, "6", it is added to the code. The code is now at "b 62", but we are out of letters. Thus we fill in the last spot with a "0" to give us the Soundex code of "b 620" Soundex Uses In Programming: Soundex can be used to determine a list of words that can serve as an alternate spelling for a misspelled word.
This comes in handy if you are trying to code a word processor with spell checking capibilitys and want it to suggest alternative spellings. Basically, you must find the Soundex code of the misspelled word, and then loop through your list of correctly spelled words while finding the Soundex code of each. All words with a Soundex code that matches the misspelled word can be added to the list of alternatative spellings. Below is a Soundex convertor coded in VB. I won't attempt to explain it, but if you are willing to take the time to look through it and find my logic, you can see how Soundex is useful. I know the code isn't commented, and it would take to much time to explain each step.
But as you will see, near the bottom is the code for a command button click, it checks to see if the word matches any words on a list of correctly spelled words. If it doesn't it calls the function getsoundexcode which uses the function getsoundexletter to return the Soundex code. Then it loops through all the correctly spelled words and determines their Soundex codes. It compares the correctly spelled word's Soundex codes to the incorrectly spelled word. If they match it adds the word to a list of suggested spellings.
Function getsoundexletter (letter As String) Select Case letter Case "b", "p", "f", "v" getsoundexletter = 1 Exit Function Case "c", "s", "g", "j", "k", "q", "x", "z" getsoundexletter = 2 Exit Function Case "d", "t" getsoundexletter = 3 Exit Function Case "l" getsoundexletter = 4 Exit Function Case "m", "n" getsoundexletter = 5 Exit Function Case "r" getsoundexletter = 6 Exit Function Case "h", "w" getsoundexletter = 8 Case Else getsoundexletter = 7 End Select End Function Function getsoundexcode (word As String) wordlength = Len (word) For i = 1 To wordlength currentletter = Mid (word, i, 1) currentsoundex = getsoundexletter (CStr (currentletter) ) If i = 1 Then soundexcode = Case (currentletter) Else If currentsoundex previoussoundex Then If currentsoundex 7 Then If currentsoundex 8 Then soundexcode = soundexcode & currentsoundex End If End If End If End If If currentsoundex "8" Then previoussoundex = currentsoundex End If Next i If Len (soundexcode) 4 Then soundexcode = Left (soundexcode, 4) End If If Len (soundexcode) 4 Then Do Until Len (soundexcode) = 4 soundexcode = soundexcode & "0" Loop End If getsoundexcode = soundexcode End Function Private Sub cmdCheckSpellingClick Dim spelledcorrect As Boolean spelledcorrect = False List 2. Clear originalword = " " similarword = " " If Trim (Text 1. SelText) = " " Then Exit Sub End If For i = 0 To List 1. ListCount - 1 If Text 1. SelText = List 1. List (i) Then spelledcorrect = True Exit For End If Next i If spelledcorrect = False Then originalword = getsoundexcode (Text 1.
SelText) MsgBox originalword For i = 0 To List 1. ListCount - 1 similarword = getsoundexcode (List 1. List (i) ) If originalword = similarword Then List 2. Add Item List 1.
List (i) End If Next i End If End Sub.