Hi PetaMem!
Thanks for that additional information! Chatbots are a really interesting topic!
Looking at your specific problem (and not the general generalicity of regexes) makes me
wonder if the empirical approach (do a check on how many possible strings are matched by the regex)
really doesn't work. However with some modifications:
- Your problem doesn't seem to be real-time - and the order of your rules seem to be static:
therefore you could
do the generalicity-rating in some offline preprocessing phase, e.g. by letting your computer work on it all night/weekend/holliday
- Instead of looking at all possible input strings, just narrow it to the expected data.
You will probably have tons of chat-logs which you can use
So your rating could be: how many matches are found by a regex in a given set of logs
Regarding the high number of possible characters (as also mentioned by JavaFan): Here you could do some preprocessing,
e.g. by replacing the german A-Umlaut by ae. This will also help with some other "languages" like
leetspeak ... your chatbot seems to get confused when greeted by a friendly "h3110" ;-)
However I fear that any automatic ordering would just be one criteria for determining the order of the rules.
You will probably add additionally some rating done by a human. And the idea of giving additional context to
the rule (like you wrote: try this before ruleX ...) sounds great to me. Have you also experimented
with randomness? (Using a random order in case of several rules have a similar rating.) That way the answers might not be so predictable...
HTH, Rata
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.