It's an election year, and everyone is asking the same question: who is the candidate who can steer America through these troubled times? Voters want to know which candidate they can trust on the major issues. As students both witnessing the presidential elections unveil, we wanted to create a web app that would provide accurate insight into candidates' true sentiments on crucial policies.

What it does

Our app uses Twitter API to get the most recent tweets of a given presidential candidate on a number of issues. It then uses NLTK to analyze those tweets' sentiments on a number of issues, and displays the results on an intuitive graph. It also displays the tweets analyzed along with the data it extrapolates.

How I built it

We built the app using a backend of Flask and Jinja2, coupled with the vaderSentiment wrapper for the NLTK NLP library. On the frontend, we used HTML, CSS, and Javascript.

Challenges we ran into

Some challenges we ran into were the trade-off between speed of operation and comprehensiveness of data. We tried to find a balance of the largest number of tweets that could still be analyzed in a convenient time. We also struggled for some time with vaderSentiment, as it is an advanced sentiment analysis library whose usage requires precision. Eventually, we surmounted these challenges and were able to continue development.

Accomplishments that we are proud of

We were proud of learning how to use NLTK and Twitter API.

What we learned

We learned a lot about NLTK and its vaderSentiment wrapper, and consequently about machine learning itself. We learned how to properly interpret AI score data as well as how to render it in a user-friendly fashion.

In addition to learning a lot about the presidential candidate playing field, we learned a lot about Flask URL argument construction. Constructing the URLs was critical to the wireframe of our project. For example, we had URL parameters for the candidates as a first-level stage, but we needed to add the parameters for each individual issue as well. Automating the construction of these URLs made life a lot easier and made our project scalable.

What's next for Zebra

We would like to expand Zebra to cover politics on the broader spectrum. Instead of just covering the political candidates for the 2020 presidential election, we hope to extend the reach of Zebra to both state and county elections.

Share this project: