It could also have been:
        Word[1247]?[1235789]
or
        Word[124578][13579]?

Conclusion:
Don't think a reliable solution for this can exist. It's just too few information to detect the right pattern. Even as a human being I'm actually not even 75% sure what's the right pattern for these words. How should a computer then?

On Jul 17, 2008, at 5:18 PM, Erik Buck wrote:

You ask an interesting computer science question (that's unrelated to Cocoa).

Surely the following sequence of words would produce Word[1-9]{1,2} instead of Word[0-9]{1,2} because there is no representative 0 in the sample ?

 "Word1"
"Word2"
"Word5"
"Word8"
"Word11"
"Word19"
"Word23"
"Word45"
"Word77"

Anyway, I think this is an unsolvable problem, and I might start with an attempted proof of its unsolvability rather than a solution. Lots of artificial intelligence and/or statistical pattern recognition could be applied to achieve reasonable results in general cases. If you have specific cases like letters followed by numbers you might use a lexer and parser like flex/bison.

Have you considered a "perfect hash" ? What are you really trying to achieve ?
 http://en.wikipedia.org/wiki/Perfect_hash_function
 http://www.nist.gov/dads/HTML/minimalPerfectHash.html
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to