The following Free Software macros are for general use. They can be loaded into any S-Lang application using the version of S-Lang noted with each macro set (typically the latest released version of S-Lang) or a more recent version.
All of this Free Software is licensed to you under the GNU General Public License (or GNU GPL) version 2 or later. For additional Free Software, visit my slrn macros webpage.
Create and reverse Soundex hashes. A Soundex hash reduces a word to its pronounciation by an English speaker—a US English speaker. This macro set provides functions to compute this hash and a regular expression describing all words with the same hash (reversing the hash). This should be useful if you are making a phonetic comparison of strings or listing of keywords by their pronounced sounds. This is the API:
% Find the Soundex hash for a string or array of strings. String_Type[] Soundex->soundex (String_Type[]); String_Type Soundex->soundex (String_Type); % Find the Soundex hash as described by NARA for a string or array of strings. String_Type[] Soundex->nara (String_Type[]); String_Type Soundex->nara (String_Type); % Set the object to be returned when there is no hash for the input. Soundex->set_undefined (Any_Type v); % v is any S-Lang object. Any_Type Soundex->get_undefined (); % Type depends on what v is. % Compute a description of all strings that match the given Soundex hash. String_Type[] Soundex->reverse (String_Type[]); String_Type Soundex->reverse (String_Type hash); % Self-test and demonstrate. Soundex->demo ();