Commit Graph

12 Commits

Author SHA1 Message Date
Brian S. Stephan 2aa369add7 rewrite recursion/alias code for the 500th time.
more of a moving of the code, actually, it now exists in (an overridden)
_handle_event, so that recursions happen against irc events directly,
rather than an already partially interpreted object.

with this change, modules don't need to implement do() nor do we have a
need for the internal_bus, which was doing an additional walk of the
modules after the irc event was already handled and turned into text. now
the core event handler does the recursion scans.

to support this, we bring back the old replypath trick and use it again,
so we know when to send a privmsg reply and when to return text so that
it may be chained in recursion. this feels old hat by now, but if you
haven't been following along, you should really look at the diff.

that's the meat of the change. the rest is updating modules to use
self.reply() and reimplementing (un)register_handlers where appropriate
2011-02-17 01:08:45 -06:00
Brian S. Stephan 28f450ab5d Markov: improve min_size by implementing min_search_tries
if the end of a chain has been reached via __end, but min_size
has not been satisfied, discard the last couple elements in the
chain and try again. use min_search_tries so we don't do this
forever.
2011-01-25 20:42:52 -06:00
Brian S. Stephan 7b4b86dc0d Markov: add support for requesting desired min/max size of a reply
note that since the min_size support is kind of crude at the moment,
this only partially works
2011-01-25 20:25:15 -06:00
Brian S. Stephan c732466129 Merge branch 'master' of git.incorporeal.org:dr.botzo 2011-01-24 16:51:52 -06:00
Brian S. Stephan 2f3feb093d have !markov learn echo the text it learned, in case someone wants to chain it with other commands for some reason 2011-01-24 16:51:05 -06:00
Brian S. Stephan 18fc614a4a assorted whitespace nitpicking 2011-01-20 14:15:10 -06:00
Brian S. Stephan 7c05f60ffd Markov: implement a min_size, which tries to make a chain of at least min_size words.
note that this isn't guaranteed, if the chain is such that the
current tuple has nowhere to go but to the end of the line, then
it will follow it --- it doesn't try to go back and rebuilt a different
chain or anything.
2011-01-19 18:44:07 -06:00
Brian S. Stephan ac0429569e Markov: size -> max_size, since I'm going to try adding a min_size soon 2011-01-19 18:35:01 -06:00
Brian S. Stephan 176ca25c68 Markov: increase the default max length from 25 words to 100 words.
it's expected that, usually, the chain will have hit an end before this.
2011-01-19 18:32:15 -06:00
Brian S. Stephan d592d3f3bb Markov: regexes should only match start of line --- add ^ 2011-01-19 10:20:20 -06:00
Brian S. Stephan 3283fac1ff Markov: remove some debugging i forgot to clean out before the initial commit 2011-01-18 22:51:40 -06:00
Brian S. Stephan 8dd223f778 Markov: a module to implement a chatterbot via markov chains.
yeah, we have MegaHAL, but i can't find a good implementation in
python that actually works and is stable, so we'll implement a
simple thing ourselves. works pretty much like MegaHAL does, but
without the string corruption.

original code provided by ape, care of mike bloy
2011-01-18 22:30:59 -06:00