Markov: default bot to only one sentence replies
This commit is contained in:
parent
2917ea9626
commit
b7b165fd8f
|
@ -140,14 +140,15 @@ class Markov(Module):
|
||||||
|
|
||||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||||
return self.irc.reply(event, u"{0:s}: {1:s}".format(nick,
|
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:
|
else:
|
||||||
# i wasn't addressed directly, so just respond
|
# i wasn't addressed directly, so just respond
|
||||||
topics = [x for x in what.split(' ') if len(x) >= 3]
|
topics = [x for x in what.split(' ') if len(x) >= 3]
|
||||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||||
|
|
||||||
return self.irc.reply(event, u"{0:s}".format(u" ".join(_generate_line(context,
|
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):
|
def markov_learn(self, event, nick, userhost, what, admin_unlocked):
|
||||||
"""Learn one line, as provided to the command."""
|
"""Learn one line, as provided to the command."""
|
||||||
|
@ -191,11 +192,13 @@ class Markov(Module):
|
||||||
|
|
||||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||||
return u" ".join(_generate_line(context, topics=topics,
|
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:
|
else:
|
||||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||||
return u" ".join(_generate_line(context, min_words=min_size,
|
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):
|
def thread_do(self):
|
||||||
"""Do various things."""
|
"""Do various things."""
|
||||||
|
|
Loading…
Reference in New Issue