siddg97 / DonaldsTweet

A twitter bot which predicts donald trumps next potential tweet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DonaldsTweet

A twitter bot which predicts donald trumps next potential tweet

APIs Used:

  • tweepy - a python library for the twitter API
  • Documentation can be found here !

Setup for API:

  • pip3 install tweepy - For python 3 and up
  • pip install tweepy - For python 2 and under

NOTE:

  • We assume you have installed pip3 or pip 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!

Usage of the API :

import tweepy

Credentials Required :

  • Consumer Key
  • Consumer Secret
  • Access Token
  • Access Token Secret

Authenticating Developer Account with tweepy

  • 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)
    

Functionality of the Bot :

  • At the moment DonaldsTweet tweets a potential tweet which is generated based on the last 100 tweets from Donal Trump

Tweet Generation Model :

  • 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.

A project by :

Clara Hong

&

Siddharth Gupta

About

A twitter bot which predicts donald trumps next potential tweet


Languages

Language:Python 100.0%