develooper Front page | perl.perlfaq.workers | Postings from January 2005

perlfaq4: How do I find the soundex value of a string?

Thread Next
From:
_brian_d_foy
Date:
January 31, 2005 08:23
Subject:
perlfaq4: How do I find the soundex value of a string?
Message ID:
310120051023034659%comdog@panix.com
* I started modifiying this answer because it's not Knuth's
algorithm.  I thought this was odd, but Knuth credits Odell
and Russell in "Sorting and Searching".


* I've run into several answers that seem to say "You don't really
want to do that" without any idea why someone is asking the question,
then giving a half-hearted explanation of what they don't want to
do.

* I shortened the answer to simply point out the two modules that
the answer recommends. If someone wants to use Text::Soundex, they
are going to see how it works when they reads its documentation or
sees its output.


=head2 How do I find the soundex value of a string?
 
-Use the standard Text::Soundex module distributed with Perl.
-Before you do so, you may want to determine whether `soundex' is in
-fact what you think it is.  Knuth's soundex algorithm compresses words
-into a small space, and so it does not necessarily distinguish between
-two words which you might want to appear separately.  For example, the
-last names `Knuth' and `Kant' are both mapped to the soundex code K530.
-If Text::Soundex does not do what you are looking for, you might want
-to consider the String::Approx module available at CPAN.
+(contributed by brian d foy)
+
+You can use the Text::Soundex module. If you want to do fuzzy or close
+matching, you might also try the String::Approx module.
 
 =head2 How can I expand variables in text strings?

-- 
brian d foy, comdog@panix.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About