When computing the string distance depending on the chosen algorithm you can 
exit the function earlier if the distance is becoming too high. 

An other possible way is to do some fuzzy string search:
http://en.wikipedia.org/wiki/Fuzzy_string_searching

HTH

--
mathk


----- Message d'origine ----
> Thanks. The distance is computed because the entry string is dynamic and
> it's  providing a distance between the title of the song and what was entered
> as  text. So I can't pre-compute that data and stuff into a dictionary. Each
> time  the method is called, the *stringValue* will be different.
> 
> On Tue, Jul  19, 2011 at 9:55 AM, Vincent Habchi <vi...@macports.org> wrote:
> 
> >  > Someone told me to look into
> >  -enumerateKeysAndObjectsWithOptions:usingBlock: (using
> >  NSEnumerationConcurrent) Would that be a better way? If so, I haven't  seen
> > this used before - how could I apply it?
> >
> > You can  try to use that, but, basically, it is the same problem: you
> > enumerate  all entries in your dictionary and compute your string distance
> > for  each, which is cumbersome. The algorithm I propose you is way faster,
> >  because you don't have to recompute this distance each time you search.  
>But,
> > once again, the crude way to compute a hash code might not suit  your needs.
> >
> >  Vincent
> _______________________________________________
> 
> Cocoa-dev  mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/mathieusuen%40yahoo.fr
> 
> This  email sent to mathieus...@yahoo.fr
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to