Markov: register ._generate_line as markov_generate_line
This commit is contained in:
parent
2e1bc8d5e0
commit
d94d7f0c88
@ -70,6 +70,8 @@ class Markov(Module):
|
|||||||
self.connection = None
|
self.connection = None
|
||||||
thread.start_new_thread(self.thread_do, ())
|
thread.start_new_thread(self.thread_do, ())
|
||||||
|
|
||||||
|
irc.xmlrpc_register_function(self._generate_line, "markov_generate_line")
|
||||||
|
|
||||||
def db_init(self):
|
def db_init(self):
|
||||||
"""Create the markov chain table."""
|
"""Create the markov chain table."""
|
||||||
|
|
||||||
@ -321,7 +323,15 @@ class Markov(Module):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def _generate_line(self, target, line='', min_size=15, max_size=100):
|
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 the limit is too low, there's nothing to do
|
||||||
if (max_size <= 3):
|
if (max_size <= 3):
|
||||||
|
Loading…
Reference in New Issue
Block a user