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

neu
Tomáš Mládek 2019-05-29 10:25:15 +02:00
parent 00397b2dac
commit d6372671be
1 changed files with 2 additions and 1 deletions

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'),