Markov: default bot to only one sentence replies

This commit is contained in:
Brian S. Stephan 2014-05-03 21:00:48 -05:00
parent 2917ea9626
commit b7b165fd8f
1 changed files with 7 additions and 4 deletions

View File

@ -140,14 +140,15 @@ class Markov(Module):
self.lines_seen.append(('.self.said.', datetime.now()))
return self.irc.reply(event, u"{0:s}: {1:s}".format(nick,
u" ".join(_generate_line(context, topics=topics))))
u" ".join(_generate_line(context, topics=topics, max_sentences=1))))
else:
# i wasn't addressed directly, so just respond
topics = [x for x in what.split(' ') if len(x) >= 3]
self.lines_seen.append(('.self.said.', datetime.now()))
return self.irc.reply(event, u"{0:s}".format(u" ".join(_generate_line(context,
topics=topics))))
topics=topics,
max_sentences=1))))
def markov_learn(self, event, nick, userhost, what, admin_unlocked):
"""Learn one line, as provided to the command."""
@ -191,11 +192,13 @@ class Markov(Module):
self.lines_seen.append(('.self.said.', datetime.now()))
return u" ".join(_generate_line(context, topics=topics,
min_words=min_size, max_words=max_size))
min_words=min_size, max_words=max_size,
max_sentences=1))
else:
self.lines_seen.append(('.self.said.', datetime.now()))
return u" ".join(_generate_line(context, min_words=min_size,
max_words=max_size))
max_words=max_size,
max_sentences=1))
def thread_do(self):
"""Do various things."""