Re: Using a Soundex category...
Re: Using a Soundex category...
- Subject: Re: Using a Soundex category...
- From: glenn andreas <email@hidden>
- Date: Wed, 06 Jul 2011 13:32:10 -0500
On Jul 6, 2011, at 1:23 PM, Eric E. Dolecki wrote:
> I found a Soundex NSString category here:
>
> http://www.cocoadev.com/index.pl?NSStringSoundex
>
> However, when I tried it out I get strange results...
>
> //someString is set to different strings each time tested
> BOOL test = [someString soundsLikeString:@"Face"];
> NSLog(@"sounds like Face: %d",test);
>
> Place = 0
> Ace = 0
> Mace = 0
> Fake = 1
> Testing = 0
> Brake = 0
>
> It would seem something is off to get negatives on Place, Ace & Mace.
>
> Any ideas or perhaps a different Soundex implementation I could try? I
> am already using Levenstein distance, but on it's own it's not good
> enough.
Soundex is based on having the first character providing a "unique" sound, with the rest of the character mapped together.
If you wanted to ignore that first character distinction, prepend your strings with a character like "X" that is unlikely to be a first character (since otherwise you'll get into trouble with its "drop double letters" step). The code appears to not care what the first character is (i.e., doesn't test for alphabetic characters), so you could probably use something like "#".
Glenn Andreas email@hidden
The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden