From: Peter Szinek Date: 2006-04-06T23:11:04+09:00 Subject: Re: String generalization Hi, > Peter, thanks for the quiz. I needed it right now :-) Actually it was not ment as quiz (its a task at hand at my workplace), but i like the mentionality of the Ruby ML that everybody started to solve it as a quiz ;-) Good work James! > > I'm not sure I understand the rules. I had expected: > > '//' -> /+ Yeah, you re right with this one. > 'jd�;d:L348kddd3' -> [a-z]+�;[a-z]:[A-Z]\d+[a-z]+\d The idea is, that if the input string is a mixture of this and that without some 'sensible' pattern, it should be just generalized to .* Well, it is not very straightforward to pin down whether a string is a mixture or not, and when there is a sensible pattern in it. (And what is sensible in this context) ATM i am using some crazy heuristics wich works very nicely in the practice, but no one knows (not even me) what it is really doing ;-) It just works. To put it another way: a human user can tell that 'jd�;d:L348kddd3' is some crap and not a repeating pattern of something (like a tel #, an email, a name) in any way. So the rule is, that if you, as a human user think it is a crap rather than something meaningful, the computer should say this as well ;-). And you produced a chunk of a code which can be wired into the first machine passing the Turing test... bw, Peter