A simple console application that fetches and analyzes the sentiment of tweets
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.
dataset
.gitignore
LICENSE
README.md
cleaner.py
main.py
saved_model.pkl
tweets.txt
twitterclient.py

README.md

twitter-sentiment-analysis

A simple console application that fetches and analyzes the sentiment of tweets

Usage

These instructions assume that Python3 is set as the default python in your environment.

To fetch tweets from the Twitter API, you'll need to update the app key, secret and token in twitterclient.py

  • To use the pretrained model with a default query of "#RoyalWedding":
$ python main.py
  • To use the pretrained model with your own custom tweets, place the tweets in a text file (see tweets.txt for an example) and run:
$ python main.py --tweets <path_to_text_file>
  • To force the model to retrain:
$ python main.py --train
  • To see the evaluation metrics while training:
$ python main.py --train --eval
  • To use the twitter API to fetch tweets for a given query:
$ python main.py --query "query"