Skip to content

burningserenity/Sentiments

Repository files navigation

Sentiments

Python app for analyzing the positive or negative connotation of a Twitter user's tweets.

First, register for a Twitter API key, if you don't already have one.

Next, install the pip packages listed in requirements.txt using pip install -r requirements.txt

Set up Flask to use application.py by entering export FLASK_APP="application.py" at the command line.

Then, export you Twitter API key and secret in the same manner, as API_KEY and API_SECRET, respectively. Make sure you enclose the actual key values in quotes.

With the API key and secret set, ensure tweets has permission to execute, and run tweets at the command line like this: ./tweets twitterUser

A list of the user's recent tweets will be output, along with a :), :|, or :( if the tweet is found to have a positive, neutral, or negative connotation, respectively. Tweets are scored by each word, every positive word is worth 1 point, every negative word -1 point. All other words are 0 points. A final score is tallied at the end for all tweets.

With the API environment variables and the Flask app set, enter flask run at the command line and you may access the Flask app at localhost in your web browser, by directing it to localhost:5000, or whichever port you have Flask configured for. This will allow you to search for a Twitter user in a search bar, which will display aggregate information about a user's tweets in a pie chart.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published