Approaches for this Matching Problem?
Approaches for this Matching Problem?
- Subject: Approaches for this Matching Problem?
- From: Steve Cronin <email@hidden>
- Date: Sun, 21 Jun 2009 22:42:34 -0500
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 (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