Add markov chain text generator.

This commit is contained in:
Alexandr Bogomyakov
2020-02-07 17:24:10 +03:00
parent 7f1f542be2
commit 92686ed13d
6 changed files with 317 additions and 1 deletions

View File

@ -162,7 +162,11 @@ class DataBase:
def get_random_word(self, count=1, like="%"):
sql = "SELECT word FROM word WHERE word LIKE '%s' ORDER BY random() LIMIT %s" % (like, count)
print(sql)
result = self.execute(sql)
return(result)
def get_random_message(self):
sql = "SELECT text FROM xxx_message ORDER BY RANDOM() LIMIT 1"
result = self.execute(sql)
return(result)