soundex algorithm wanted
Ed Falk
falk at sun.uucp
Fri Sep 5 10:48:29 AEST 1986
>
> Unfortunately, it doesn't generate correct Soundex codes.
> The algorithm is actually pretty tricky, and I've seen
> lots that don't handle names like Lloyd and Manning
> properly. Here's one that I believe is correct:
> -----
Both this version and the previous version had the same bug, to wit:
lc = tolower(*name);
The 'tolower' function only works if the input was already upper case.
(at least in bsd 4.2 that's the way it is). The line should read
lc = isupper(*name) ? tolower(*name) : *name ;
Also, this version left trailing "0"'s on the output. Is this right?
Perhaps someone could just post the plain english description of
soundex...
thanx..
--
-ed falk, sun microsystems
falk at sun.com
sun!falk
More information about the Comp.sources.unix
mailing list