blob: 8073a8c09491595604516a7b84b01cf930a8318a [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{soundex} ---
2 None}
Fred Drakeb91e9341998-07-23 17:59:49 +00003\declaremodule{builtin}{soundex}
4
5\modulesynopsis{None}
6
Guido van Rossum3486f271996-12-12 17:02:21 +00007
Fred Drake23bc85a1998-03-08 07:56:48 +00008
Guido van Rossum3486f271996-12-12 17:02:21 +00009The soundex algorithm takes an English word, and returns an
10easily-computed hash of it; this hash is intended to be the same for
11words that sound alike. This module provides an interface to the
12soundex algorithm.
13
14Note that the soundex algorithm is quite simple-minded, and isn't
15perfect by any measure. Its main purpose is to help looking up names
Fred Drakec520b691998-01-20 04:45:44 +000016in databases, when the name may be misspelled --- soundex hashes common
Guido van Rossum3486f271996-12-12 17:02:21 +000017misspellings together.
18
19\begin{funcdesc}{get_soundex}{string}
20Return the soundex hash value for a word; it will always be a
216-character string. \var{string} must contain the word to be hashed,
Fred Drakec7086051998-04-07 19:58:19 +000022with no leading whitespace; the case of the word is ignored. (Note
23that the original algorithm produces a 4-character result.)
Guido van Rossum3486f271996-12-12 17:02:21 +000024\end{funcdesc}
25
26\begin{funcdesc}{sound_similar}{string1, string2}
27Compare the word in \var{string1} with the word in \var{string2}; this
28is equivalent to
Fred Drakefc931ec1998-02-13 21:49:12 +000029\code{get_soundex(\var{string1})} \code{==}
30\code{get_soundex(\var{string2})}.
Guido van Rossum3486f271996-12-12 17:02:21 +000031\end{funcdesc}
Fred Drakec7086051998-04-07 19:58:19 +000032
33
34\begin{seealso}
35
36\seetext{Donald E. Knuth, \emph{Sorting and Searching,} vol. 3 in
37``The Art of Computer Programming.'' Addison-Wesley Publishing
38Company: Reading, MA: 1973. pp.\ 391-392. Discusses the origin and
39usefulness of the algorithm, as well as the algorithm itself. Knuth
40gives his sources as \emph{U.S. Patents 1261167} (1918) and
41\emph{1435663} (1922), attributing the algorithm to Margaret K. Odell
42and Robert C. Russel. Additional references are provided.}
43
44\end{seealso}