Sentiment Analysis (SA) refers to the use of Natural Language Processing (NLP) to systematically identify, extract, quantify, and study affective states and subjective information. Source

Imagine that you have just launched a new advertising campaign, or a new product, just like Disney’s new movie “The Lion King”, and you want to have a clear view of what people think of the movie. Natural language processing (NLP) can help with that, and specifically the task of sentiment analysis (SA). In simple terms, this is a technique that allows you to quickly determine if people are responding positively or negatively to a given topic—in this use case movies.



Sentiment analysis would use different techniques to tokenize and analyze every word and sentence and gather as many signals to indicate whether a review is positive, negative, or neutral. But in order to do that, you have to collect as much raw data as possible and train a model to extract a list of features from a predefined set of positive and negative responses.

To make it more exciting, we’ll try to build a sentiment analysis model without any external resources or libraries and purely with Swift. Surprisingly, there are actually a lot of ways to build a pretty cool NLP model, as long as it’s totally supervised.

Here are the 5 steps we need to take to get a decent result in an iOS app:

Steps

And this is a look at what the final result will look like: