Skip to content
Twitter bot that uses President Trump's Twitter account to create Markov chains that imitate him.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
AllTrumpSpeechesCleaned.txt
DonaldTrumBot.py
README.md
WordBankCreator.py
requirements.txt

README.md

donald-trump-bot

Twitter bot that uses President Trump's Twitter account to create Markov chains that imitate him. Currently running on a Raspberry Pi.

The main script, DonaldTrumBot.py, is scheduled to run every ten minutes. Most times it will exit without doing anything, but about ~2-3 times a day (on average) it will create a tweet and post it. To create a tweet, it requires the files wordbank.pkl and starters.pkl that are generated by WordBankCreator.py.

The secondary script, WordBankCreator.py, sifts through Trump's tweets and comes up with the probabilities of certain words following other words and dumps the results into the files wordbank.pkl and starters.pkl, which are used by the main script to generate tweets. This script also has a function called create_tweet_database, which downloads a complete archive of Trump's tweets from here and stores them in a SQLLite database called TrumpTweets.db. This database is then periodically updated with new tweets when WordBankCreator.py runs.

WordBankCreator.py uses the module Spacy for part-of-speech tagging, which is rather intensive and takes a good 3 hours on the Pi, so this script only runs once a week.

You can’t perform that action at this time.