|
 |
 |
 |
Welcome to Code400.com
|
Okay...We all like to get free stuff..Right?!?
Well thats what we are offering here....Free Stuff
- Free storage for your source code.
- Free access to code
samples. (site search)
- Free place to ask questions or just say what you want.
We are interested in what you have to say.
If you can’t find what your’e looking for on this site....
We will add it.
The small print says: We provide the source code on this site as only
a guide. We do not recommend that anyone run any of the code provided
on this site without first testing it.
If you choose to download source from this site directly onto
your production box without testing....Well, YOU are completely to
blame and we don’t want to hear about it.
Random QuoteThe trouble with the world is that the stupid are cocksure and the intelligent are full of doubt
--Bertrand Russell
| |
 |
 |
|
Soundex
Using Soundex SQL Scaler Function
The Soundex Algorithm
- Soundex codes begin with the first letter of the surname followed
by a three-digit code that represents the first three remaining
consonants. Zeros will be added to names that do not have enough
letters to be coded.
- Soundex Coding Guide (Consonants that sound alike have the same code)
- 1 - B,P,F,V
- 2 - C,S,G,J,K,Q,X,Z
- 3 - D,T
- 4 - L
- 5 - M,N
- 6 - R
- The letters A,E,I,O,U,Y,H, and W are not coded.
- Names with adjacent letters having the same equivalent number
are coded as one letter with a single number.
- Surname prefixes are generally not used in the soundex.
To Calculate a Soundex Code by Hand:
- Print name on a piece of paper
- Cross out spaces, punctuation, accents and other marks
- Cross out any of the following characters A, E, I, O, U, H, W, Y
- Cross out the second letter of duplicate characters
- Cross out the second letter of adjacent characters with
the same soundex number.
- Convert characters in positions 2 to 4 to a number
- B, P, F, V -> 1
- C, S, K, G, J, Q, X, Z -> 2
- D, T -> 3
- L -> 4
- M, N -> 5
- R -> 6
- Fill any unused positions with zeros e.g.. Lee is L00, Bailey is B400.
There is always one letter followed by 3 numbers.
Limitations
- Names that sound alike do not always have the same soundex code.
For example, Lee and Leigh are pronounced identically, but have
different soundex codes because the silent g in Leigh is given
a code. The soundex code for Leigh is L000 and the soundex
code for Leigh is L200.
- Soundex is based on English pronunciation. European names may
not soundexed correctly. For example, some French surnames
with silent last letters will not code according to pronunciation.
This is true with French name such as Beaux - where the x is silent.
Sometimes this surname is also spelled Beau and is pronounced
identically to Beaux, yet they will have different soundex codes.
Although I have given only a French example, this would be true of
any name that does not use English pronunciation.
- Sometimes names that don't sound alike have the same soundex code.
When I am searching for the surname Powers, I have to wade through
Pierce, Price, Perez and Park which all have the same soundex code.
Yet Power, a common way to spell Powers 100 years ago, has a different
soundex code.
- Surnames with prefixes were usually coded without the prefix, but not
always. If you are searching for a surnames such as DiCaprio or LaBianca,
you should try the soundex for both with and without the prefix.
- US Census soundex confusion arises with names such as Ashcraft. When
the original soundex coder didn't code the H and didn't consider the
H as a separator between the adjacent letters with the same code
S and C , then the S and C would be considered adjacent letters to be
coded only once and the soundex will be A261. In the 1920 NY Census,
Ashcraft is found under A261. Those who coded the soundex for the
1880, 1900 and 1910 census may or may not have used this rule.
They sometimes considered the H as a separator, and did not code
the S and C as adjacent letters that would only be assigned one
letter, but rather gave a number code to each letter. In this case
Ashcraft would be A226, the result you receive with the calculator
on this page. The important thing to know is that the US
Census was not consistent with using the letter H and W as
separators between adjacent letters. If you are trying to
calculate the soundex for a name with the letters W or H
that separate two adjacent letters, it is best to calculate
the soundex using the two different methods to locate the name
in the US census. This would be true of any name that has any of the
letters C,S,G,J,K,Q,X,Z on both sides of the letter H or W such as
SHS, CHS, KHZ, SWS, KWS, CWK.
Use Soundex converter
Taken from a Gary Guthrie Article:
Soundex is one of several algorithms that create a phonetic
hash value from a given string. In the case of Soundex, the
hash is a four-byte value, and strings with a similar sound
result in the same hash value. A simple
Select * From Reserves
Where Soundex(LastName) =
Soundex("Flanary")
(Flanary = 'F456')
would have returned all users in which the last name
was phonetically similar to Flanary. If the search string
was spelled reasonably close, this query would
have found my name.
Customer file
* ===================================================================
* = File.......... Customer =
* = Description... Customer Master File =
* ===================================================================
A R CUSTOMERR
A CUSTID 5
A LASTNAME 20
A FIRSTNAME 10
A K CUSTID
Customer file with soundex field added
* ===================================================================
* = File.......... Customer =
* = Description... Customer Master File =
* ===================================================================
A R CUSTOMERR
A CUSTID 5
A LASTNAME 20
A FIRSTNAME 10
A LASTSOUND 4
A
A K CUSTID
Populate our new field
C/Exec SQL
C+ Set :LastSound = Soundex( :LastName )
C/End-Exec
|
| |