This project is a geographic visualization of Twitter data across the USA, analyzing the sentiments of the tweets based on certain key words. It is a project of the CS61A course at UC Berkeley.
Data Source:
This repository includes a sample tweets data in 2011 as a txt file, located under the /data direcotry. There is also a compressed file with more data.
If you want to use your own data, please place it under /data and modify data.py accordingly.
Please use:
python3 trends.py -m <keyword>
e.g.
python3 trends.py -m texas
python3 trends.py -m sandwich
python3 trends.py -m obama
python3 trends.py -m "my life"
The CS61A instructional page explains how this program works:
Collecting public Twitter posts (tweets) that have been tagged with geographic locations and filtering for those that contain the "texas" query term,
Assigning a sentiment (positive or negative) to each tweet, based on all of the words it contains,
Aggregating tweets by the state with the closest geographic center, and finally
Coloring each state according to the aggregate sentiment of its tweets. Red means positive sentiment; blue means negative.