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