Determining the Sentiment of a Document

Learn what sentiment analysis is and how it is performed using natural language tools in R.

Understanding sentiment analysis

Sentiment analysis extracts subjective emotional intent from text. It attempts to attach positive or negative values. Sometimes, it may provide additional ratings for anger, anticipation, disgust, fear, joy, sadness, surprise, or trust.

Sentiment analysis can be a simple rule-based system, such as counting the number of positive and negative words. It may also be based on a more complex machine learning algorithm, such as a support vector machine (SVM) or a recurrent neural network (RNN).

Sentiment analysis is useful in a variety of applications, such as brand reputation management, customer service, and political analysis. It can help companies understand how their customers feel about their products or services and identify improvement areas. It can also be used to monitor social media and news feeds to track public opinion on a particular topic or issue.

When analyzing sentiments, it’s essential to note that the function takes words like “not” into account to understand the text’s actual meaning. For instance, “He was happy” and “He was not happy” convey opposite sentiments, and the function recognizes this linguistic nuance.

Get hands-on with 1200+ tech skills courses.