Markov bot
This commit is contained in:
parent
8d48ac6cdf
commit
d6b95f504c
1 changed files with 16 additions and 0 deletions
16
markov.py
Executable file
16
markov.py
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import dbtools, twitools
|
||||
import argparse, markovify, operator, random, re, sys
|
||||
|
||||
def getText(db = dbtools.dbHelper()):
|
||||
return '\n'.join(db.executeQuery("SELECT text FROM tweets;"))
|
||||
|
||||
def markovify(text):
|
||||
return markovify.Text(text).make_short_sentence(130).replace("@", "@")
|
||||
|
||||
def tweet(text, ref = 0, two = twitools.twObject()):
|
||||
return two.tweet(text, ref).id
|
||||
|
||||
if __name__ == "__main__":
|
||||
tweet(markovify(getText()))
|
Loading…
Reference in a new issue