e r l a n g : c o o k b o o k

/ Erlang.StringSoundexMatching

This Web


WebHome 
WebChanges 
TOC
NewRecipe 
WebTopicList 
WebStatistics 

All Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Erlang Links


Erlang.org
Erlang Wiki
ErlMan
Erlang Wiki
The Jungerl
Erlang-fr.org
Joe Armstrong
Lambda the Ultimate

Erlang Web Ring


[Prev]: Joe Armstrong's Page
[Next]: Joe Armstrong's Page

Soundex Matching

Problem

You want to generate Soundex hashes of surnames, for doing "sounds-like" indexing databases, or retrieving information from the US Census records and similar pre-existing databases.

Solution

Note: This library does not exist yet. Scheme data shown for the time being:

Use the soundex library:

> (soundex "Smith")
"S530"
> (soundex "Smyth")
"S530"

Both current NARA Soundex and "old" Soundex are supported (soundex is an alias for soundex-nara):

> (soundex-nara "Ashcraft")
"A261"
> (soundex-old "Ashcraft")
"A226"

Multiple Soundex keys based on prefix-skipping can be generated with the soundex-nara/prefixing, soundex-old/prefixing, and soundex/p procedures:

> (soundex/p "vanderlinden")
("V536" "D645" "L535")

Discussion

Soundex is a string hash historically used by the US Census for indexing surnames by a function of what they "sound" like, rather than their precise spelling. Further general information on Soundex is available at http://www.archives.gov/research_room/genealogy/census/soundex.html.

The Soundex module can be installed? via a *.plt file available from http://www.neilvandyke.org/soundex-scm/. Specify the PLT module form of soundex.scm with like:

(require (lib "soundex.ss" "soundex"))

(Most non-PLT Scheme implementations can use the load procedure or other facility to load the file soundex.scm.)

Soundex keys are represented as four-character strings, therefore the equal? procedure can be used to compare them:

> (equal? (soundex "Johnson") (soundex "Jackson"))
#f
> (equal? (soundex "Johnson") (soundex "JANZEN"))
#t

See Also

Further general information on Soundex is available from:

Discussion

This doesn't apply to Erlang, and is only here as a placeholder until the library is implemented. Coming to a Jungerl near you...

-- BrentAFulgham - 23 Aug 2004

CookbookForm
TopicType: Recipe
ParentTopic: StringRecipes
TopicOrder: 230

 
 
Copyright © 2004 by the contributing authors. All material on the Erlang Cookbook web site is the property of the contributing authors.
This material can be redistributed and/or modified under the terms of the GNU Lesser General Public License (LGPL), version 2.1, as published by the Free Software Foundation.
Ideas, requests, problems regarding Schematics Cookbook? Send feedback.
/ You are Main.guest