It’s seems that, in the last decade, people increasingly have turned to social networks to express their opinions on everything from everyday life to politics and even businesses. This has been an important source — for businesses — to probe the market and get a clear picture of the needs and directions that influence it.

For me, the social media that seems the most active in the area of expressing opinions is probably Twitter.

Twitter is an online news and social networking service that allows users to send and read short messages of 280 characters called “Tweets”. Registered users can read and post Tweets, but those who are not registered can only read them.

So Twitter is a public platform with a wealth of public opinion from people around the world and from all age groups. In October 2019, Twitter had more than 330 million active users per month, with 40% of those active daily.

The most widely-used technique to assess opinions in a given text is sentiment analysis. It’s extremely useful in monitoring social media because it allows us to have an overview of public opinion behind certain topics. However, it’s also handy for business analysis and various other situations in which the text needs to be analyzed.

Sentiment analysis is in demand due to its effectiveness. Thousands of text documents can be processed in seconds, compared to the hours (or days) a team of human reviewers would need to complete the same analysis manually. That’s why so many companies are adopting text and sentiment analysis and incorporating it into their processes and decision pipelines.

Photo by Flaunter.com on Unsplash

The last presidential election in the USA was probably the most interesting source of data analysis, and Seth Stephens-Davidowitz’s book “Everybody Lies” is in my opinion the one that covered all the underlying aspects of opinion making. In this book, he explores how hard it is to capture what people really think. I highly recommend it—informative but also really funny.

Since almost everyone has a smartphone in their pocket and uses it more than any other electronic device, it seems obvious to create a mobile application that employs sentiment analysis. Empowering users to look into trends and analyze Tweets by using machine learning techniques seems like a good way to democratize public opinion.

In this article, I’ll create an iOS application that will consume the Twitter API and process Tweets using natural language processing techniques.

Overview

Twitter API Flask API Natural Language API Custom sentiment analysis classifier Building the iOS Application Testing on real data Conclusion

All the material used in this project can be downloaded on my GitHub account:

This is a look at what the final result will look like: