warning about missing markov; returns '???' when generation failed

This commit is contained in:
Tomáš Mládek 2019-05-29 10:25:15 +02:00
parent 00397b2dac
commit d6372671be

View file

@ -507,7 +507,7 @@ class MarkovBlabberer:
self.logger.info("Sentence of the day: " + self.make_sentence())
def make_sentence(self, tries=100):
return self.markov.make_sentence(tries=tries)
return self.markov.make_sentence(tries=tries) or "???"
def add_to_corpus(self, text):
text = text.lower()
@ -536,6 +536,7 @@ if __name__ == '__main__':
try:
markov = MarkovBlabberer("initial.txt")
except FileNotFoundError:
logging.warning("Didn't find `initial.txt`, continuing without markov blabbering!")
markov = None
delojza = DelojzaBot(config.get('delojza', 'tg_api_key'),