Sentiment analysis
One last topic to examine under text analysis is sentiment analysis. This is the measurement of the positive or negative sentiment of text. There are similar analyses that can be done to measure the emotion of text. The way this works is similar to the last section – we create features from our text, then train a classifier to predict either sentiment, emotions, or some other class from a list of labels. With sentiment analysis, we can train a regressor to predict the sentiment if we label our text with values such as -5 ranging to +5, or we can train a classifier to simply predict positive, neutral, or negative.
Another method for determining sentiment of text are rule-based algorithms. These can use lookup dictionaries where words have a sentiment score, and the sentiment score for a text is added up and averaged to get the overall sentiment. Negation rules can be applied, such as the word "not" before another word flips its value.
There...