Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Soundex
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==American Soundex== The Soundex code for a name consists of a [[Letter (alphabet)|letter]] followed by three [[numerical digit]]s: the letter is the first letter of the name, and the digits encode the remaining [[consonant]]s. Consonants at a similar [[place of articulation]] share the same digit so, for example, the [[labial consonant]]s B, F, P, and V are each encoded as the number 1. The correct value can be found as follows: #Retain the first letter of the name and drop all other occurrences of a, e, i, o, u, y, h, w. # Replace consonants with digits as follows (after the first letter): #* b, f, p, v β 1 #* c, g, j, k, q, s, x, z β 2 #* d, t β 3 #* l β 4 #* m, n β 5 #* r β 6 # If two or more letters with the same number are adjacent in the original name (before step 1), only retain the first letter; also two letters with the same number separated by 'h', 'w' or 'y' are coded as a single number, whereas such letters separated by a vowel are coded twice. This rule also applies to the first letter. # If there are too few letters in the word to assign three numbers, append zeros until there are three numbers. If there are four or more numbers, retain only the first three. Using this algorithm, both "Robert" and "Rupert" return the same string "R163" while "Rubin" yields "R150". "Ashcraft" and "Ashcroft" both yield "A261". "Tymczak" yields "T522" not "T520" (the chars 'z' and 'k' in the name are coded as 2 twice since a vowel lies in between them). "Pfister" yields "P236" not "P123" (the first two letters have the same number and are coded once as 'P'), and "Honeyman" yields "H555". The following algorithm is followed by most SQL languages (excluding PostgreSQL{{Example needed|date=December 2018}}): # Save the first letter. Map all occurrences of a, e, i, o, u, y, h, w. to zero(0) # Replace all consonants (include the first letter) with digits as in [2.] above. # Replace all adjacent same digits with one digit, and then remove all the zero (0) digits # If the saved letter's digit is the same as the resulting first digit, remove the digit (keep the letter). # Append 3 zeros if result contains less than 3 digits. Remove all except the first letter and 3 digits after it (This step is the same as [4.] in explanation above). The two algorithms above do not return the same results in all cases primarily because of the difference between when the vowels are removed. The first algorithm is used by most programming languages and the second is used by SQL. For example, "Tymczak" yields "T522" in the first algorithm, but "T520" in the algorithm used by SQL. Often, both algorithms generate the same code. As examples, both "Robert" and "Rupert" yield "R163" and "Honeyman" yields "H555". In designing an application, which combines SQL and a programming language, the architect must decide whether to do all of the Soundex encoding in the SQL server or all in the programming language. The MySQL implementation can return more than 4 characters.<ref>CodingForums.com ([http://www.codingforums.com/php/386663-how-get-sql-soundex-value-php.html])</ref><ref>{{cite web |url=http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_soundex |title=MySQL :: MySQL 5.5 Reference Manual :: 12.5 String Functions - SOUNDEX |work=dev.mysql.com}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)