1998-04-04 03:23:21 -04:00
|
|
|
\section{Built-in Module \module{soundex}}
|
1997-07-17 13:34:52 -03:00
|
|
|
\label{module-soundex}
|
1998-01-20 00:45:44 -04:00
|
|
|
\bimodindex{soundex}
|
1996-12-12 13:02:21 -04:00
|
|
|
|
1998-03-08 03:56:48 -04:00
|
|
|
|
1996-12-12 13:02:21 -04:00
|
|
|
The soundex algorithm takes an English word, and returns an
|
|
|
|
easily-computed hash of it; this hash is intended to be the same for
|
|
|
|
words that sound alike. This module provides an interface to the
|
|
|
|
soundex algorithm.
|
|
|
|
|
|
|
|
Note that the soundex algorithm is quite simple-minded, and isn't
|
|
|
|
perfect by any measure. Its main purpose is to help looking up names
|
1998-01-20 00:45:44 -04:00
|
|
|
in databases, when the name may be misspelled --- soundex hashes common
|
1996-12-12 13:02:21 -04:00
|
|
|
misspellings together.
|
|
|
|
|
|
|
|
\begin{funcdesc}{get_soundex}{string}
|
|
|
|
Return the soundex hash value for a word; it will always be a
|
|
|
|
6-character string. \var{string} must contain the word to be hashed,
|
1998-04-07 16:58:19 -03:00
|
|
|
with no leading whitespace; the case of the word is ignored. (Note
|
|
|
|
that the original algorithm produces a 4-character result.)
|
1996-12-12 13:02:21 -04:00
|
|
|
\end{funcdesc}
|
|
|
|
|
|
|
|
\begin{funcdesc}{sound_similar}{string1, string2}
|
|
|
|
Compare the word in \var{string1} with the word in \var{string2}; this
|
|
|
|
is equivalent to
|
1998-02-13 17:49:12 -04:00
|
|
|
\code{get_soundex(\var{string1})} \code{==}
|
|
|
|
\code{get_soundex(\var{string2})}.
|
1996-12-12 13:02:21 -04:00
|
|
|
\end{funcdesc}
|
1998-04-07 16:58:19 -03:00
|
|
|
|
|
|
|
|
|
|
|
\begin{seealso}
|
|
|
|
|
|
|
|
\seetext{Donald E. Knuth, \emph{Sorting and Searching,} vol. 3 in
|
|
|
|
``The Art of Computer Programming.'' Addison-Wesley Publishing
|
|
|
|
Company: Reading, MA: 1973. pp.\ 391-392. Discusses the origin and
|
|
|
|
usefulness of the algorithm, as well as the algorithm itself. Knuth
|
|
|
|
gives his sources as \emph{U.S. Patents 1261167} (1918) and
|
|
|
|
\emph{1435663} (1922), attributing the algorithm to Margaret K. Odell
|
|
|
|
and Robert C. Russel. Additional references are provided.}
|
|
|
|
|
|
|
|
\end{seealso}
|