A twitter bot which predicts donald trumps next potential tweet
pip3 install tweepy
- For python 3 and uppip install tweepy
- For python 2 and under
- We assume you have installed
pip3
orpip
before hand on your device. - Alternatively you could clone the
tweepy
repository from GitHub:git clone https;//github.com/tweepy/tweepy.git cd tweepy python setup.py install
- You will need to go here to get credentials requiered for your bot!
import tweepy
- Consumer Key
- Consumer Secret
- Access Token
- Access Token Secret
- Initialize your credentials:
consumer_key = 'consumer key' consumer_secret = 'consumer secret' access_token = 'access token' access_token_secret = 'access token secret'
- Authentication:
auth = tweepy.OAuthHandler(consumer_key, consumer_key) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth)
- At the moment DonaldsTweet tweets a potential tweet which is generated based on the last 100 tweets from Donal Trump
- We use the
Markov Chain Model
with a history of 2 words and make a markov tree based on the inputs. - To generate a random tweet we select a random path from the root of the tree to the end, giving us a grammatically correct tweet.