Folks;

I would like to solicit feedback on the best approach to solve this problem: "phrase contains any word in set {a,b,c...}"

I have a user supplied phrase (usually 3-5 words; max of 10 words) -> thePhrase
The user may provide any random phrase...

I also have a user managed array of words (somewhere around 250 words) -> theTags
Currently these are stored as records in a Core Data entity.
This set of tags is fairly stable but is nonetheless managed by the user

I want the fastest means of determining if thePhrase contains ANY member of theTags. Position and frequency are not important. If ANY Tag is found the 'evaluation' can stop immediately.

method signature proposal - (BOOL) containsAnyTag:(NSString *) thePhrase; [NOTE: I may run this evalution several times in succession on different phrases so, for now, the set of Tags is already setup as an instance variable]

I am open to considering all options.  Speed is THE top priority.
Code complexity is a far distant second.

Seems like a job for regex but I'm a total newbie there and since I don't care about actual location nor frequency maybe it is NOT a job for regex..

Seems like there could be many ways to proceed but I hoping somebody might share some experience or insight.

Thank-You,
Steve
_______________________________________________

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