by nmrm · 12y ago · 0 comments
But that's pretty stupid, because you don't generalize beyond your examples.
What's your approach?
<em>edit: removed random conjecture</em>
A simple heuristic is the smallest regex.
So in your example, given the training examples:
aba
abaa
aaaaba
and the counter examples: abba
ba
ab
It's clear to a human I probably want to match "a+ba+". That's clearly much smaller than ("aba" | "abaa" | "aaaaba") & !("abba" | "ba" | "ab"), so it would be a "better" regex.