twitools/markov.py
2017-02-18 20:55:06 +01:00

17 lines
475 B
Python
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
import dbtools, setuptools, 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.twoHelper(setuptools.MARKOV)):
return two.tweet(text, ref).id
if __name__ == "__main__":
tweet(markovify(getText()))