Markov: register ._generate_line as markov_generate_line

This commit is contained in:
Brian S. Stephan 2012-04-05 21:24:41 -05:00
parent 2e1bc8d5e0
commit d94d7f0c88
1 changed files with 11 additions and 1 deletions

View File

@ -70,6 +70,8 @@ class Markov(Module):
self.connection = None
thread.start_new_thread(self.thread_do, ())
irc.xmlrpc_register_function(self._generate_line, "markov_generate_line")
def db_init(self):
"""Create the markov chain table."""
@ -321,7 +323,15 @@ class Markov(Module):
raise
def _generate_line(self, target, line='', min_size=15, max_size=100):
"""Reply to a line, using some text in the line as a point in the chain."""
"""
Create a line, optionally using some text in a seed as a point in the chain.
Keyword arguments:
target - the target to retrieve the context for (i.e. a channel or nick)
line - the line to reply to, by picking a random word and seeding with it
min_size - the minimum desired size in characters. not guaranteed
max_size - the maximum desired size in characters. not guaranteed
"""
# if the limit is too low, there's nothing to do
if (max_size <= 3):