blob: 25e82cf6e557c75f482483210e53a41356a90896 [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}
Fred Drake37f15741999-11-10 16:21:37 +000035 \seetext{Donald E. Knuth, \citetitle{Sorting and Searching}, vol. 3
36 in ``The Art of Computer Programming.'' Addison-Wesley
37 Publishing Company: Reading, MA: 1973. pp.\ 391-392.
38 Discusses the origin and usefulness of the algorithm, as
39 well as the algorithm itself. Knuth gives his sources as
40 \emph{U.S. Patents 1261167} (1918) and \emph{1435663}
41 (1922), attributing the algorithm to Margaret K. Odell and
42 Robert C. Russel. Additional references are provided.}
Fred Drakec7086051998-04-07 19:58:19 +000043\end{seealso}