blob: 7d483ed2a2f591a6c81222a3c34749424b803e52 [file] [log] [blame]
Fred Drake3a0351c1998-04-04 07:23:21 +00001\section{Built-in Module \module{soundex}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-soundex}
Fred Drakec520b691998-01-20 04:45:44 +00003\bimodindex{soundex}
Guido van Rossum3486f271996-12-12 17:02:21 +00004
Fred Drake23bc85a1998-03-08 07:56:48 +00005
Guido van Rossum3486f271996-12-12 17:02:21 +00006The soundex algorithm takes an English word, and returns an
7easily-computed hash of it; this hash is intended to be the same for
8words that sound alike. This module provides an interface to the
9soundex algorithm.
10
11Note that the soundex algorithm is quite simple-minded, and isn't
12perfect by any measure. Its main purpose is to help looking up names
Fred Drakec520b691998-01-20 04:45:44 +000013in databases, when the name may be misspelled --- soundex hashes common
Guido van Rossum3486f271996-12-12 17:02:21 +000014misspellings together.
15
16\begin{funcdesc}{get_soundex}{string}
17Return the soundex hash value for a word; it will always be a
186-character string. \var{string} must contain the word to be hashed,
19with no leading whitespace; the case of the word is ignored.
20\end{funcdesc}
21
22\begin{funcdesc}{sound_similar}{string1, string2}
23Compare the word in \var{string1} with the word in \var{string2}; this
24is equivalent to
Fred Drakefc931ec1998-02-13 21:49:12 +000025\code{get_soundex(\var{string1})} \code{==}
26\code{get_soundex(\var{string2})}.
Guido van Rossum3486f271996-12-12 17:02:21 +000027\end{funcdesc}