Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Sentiment Analysis

nounNatural Language Processingalso opinion mining, emotion AI, sentiment classification

In one line

Sentiment analysis is the use of natural language processing to identify and classify opinions, emotions and attitudes expressed in text.

Sentiment analysis, also called opinion mining, is the use of natural language processing to identify, extract and classify the opinions, attitudes and emotions expressed in text. The simplest form assigns a label such as positive, negative or neutral to a review, post or message. More advanced forms identify the object being discussed, the strength of the feeling, or specific emotions such as anger, joy or fear. Bing Liu describes the field as the study of people’s opinions, sentiments, evaluations and emotions toward entities and their attributes [3].

Overview

People express opinions constantly in product reviews, social media, surveys, emails and news comments. Reading all of this by hand is impossible at scale, so organizations use sentiment analysis to summarize what people think. The task is a type of text classification and relies on natural language understanding, because sentiment depends on meaning, context and sometimes on subtle cues.

The problem is less simple than it first appears. “This phone is sick” may be praise, “not bad” is mildly positive, and “Great, another delay” is probably sarcastic. A useful system must cope with negation, irony, slang and domain differences, since the word “unpredictable” is negative for a car and positive for a thriller.

Levels of analysis

Sentiment can be assessed at several levels of detail.

  • Document level. One overall label for a whole review or article.
  • Sentence level. A label for each sentence, which helps when a text mixes opinions.
  • Aspect level. Sentiment toward specific features, such as “the battery is excellent but the screen is dim.” This is often called aspect-based sentiment analysis and is more useful for product feedback.
  • Emotion detection. Classifying text into categories such as joy, sadness, anger, fear and surprise, rather than only polarity.

Methods

### Lexicon-based approaches

These use dictionaries of words with sentiment scores, and combine the scores with rules for negation and intensifiers such as “very.” They are transparent and need no training data, but they handle context and sarcasm poorly and need adaptation for new domains.

### Classical machine learning

In 2002, Pang, Lee and Vaithyanathan showed that standard classifiers such as Naive Bayes and support vector machines, trained on labeled movie reviews, outperformed simple keyword methods [1]. Features were typically word counts. See supervised learning and support vector machines.

### Deep learning

Neural networks learn representations of words and sentences instead of relying on hand-built features. The Stanford Sentiment Treebank labeled sentiment for every phrase in parse trees, which let models learn how meaning is composed, including the effect of negation [2]. Recurrent networks and later transformer models improved accuracy further, usually through pretraining followed by fine-tuning on labeled examples.

### Large language models

General-purpose language models can classify sentiment through prompts with little or no labeled data, using zero-shot or few-shot instructions. They also explain their judgments in words, though that explanation does not always reflect how the label was reached.

Typical workflow

  1. Collect text from the chosen source, such as reviews or social posts.
  2. Clean it by removing duplicates and handling emojis, hashtags and links.
  3. Choose a method and label set, for example positive, neutral and negative.
  4. Train or configure the model and test it on labeled examples from the same domain.
  5. Apply it to new text, aggregate results by time, product or topic, and review samples by hand.

Applications

  • Brand and reputation monitoring. Tracking opinion about companies, products and campaigns on social media.
  • Customer feedback. Sorting reviews and support tickets to find recurring complaints, often with text mining.
  • Finance. Estimating the tone of news and company reports as one input into market analysis, though predictive value is debated.
  • Politics and public opinion. Studying reactions to policies or events, with caution about unrepresentative samples.
  • Healthcare and well-being research. Studying patient feedback or language patterns, with strict attention to privacy and ethics.
  • Conversational systems. Letting a chatbot detect frustration and escalate to a person.

Evaluation

Systems are scored by accuracy, precision, recall and F1 on labeled test sets. Class imbalance matters, since neutral text is often the majority. Human annotators often disagree on borderline cases, so the labels themselves contain uncertainty, and agreement between annotators puts a ceiling on how well a model can score.

Limitations and ethical issues

  • Sarcasm and context. Irony, humor and cultural references frequently cause errors.
  • Domain shift. A model trained on movie reviews may fail on financial news.
  • Language and dialect bias. Models may misread dialects, minority languages or non-standard spelling, and studies have found differences in how systems score text from different groups.
  • Unrepresentative data. Social media users are not a random sample of the population.
  • Privacy. Analyzing personal posts or private messages raises consent and data-protection issues.
  • Over-interpretation. Text sentiment is not the same as true feelings, and treating it as a reliable reading of emotion can mislead.

Handling hard cases

Practitioners use several techniques to deal with the difficult parts of sentiment. Negation handling marks the words within a negated phrase so that “not good” is not read as positive. Emoji and emoticon mapping treats symbols as signals, since they often carry the real feeling of a short message. Multilingual models allow one system to score text in many languages, and domain-specific fine-tuning adapts a general model to jargon such as medical or financial language. For sarcasm, some researchers add context such as earlier messages in a thread, or the author’s past posts, though this raises further privacy questions. Even so, sarcasm detection stays among the hardest open problems in the area.

Related tasks

Sentiment analysis is closely related to several other language tasks. Stance detection asks whether the author supports or opposes a specific target, which differs from general positivity. Emotion recognition assigns categories of feeling. Toxicity and hate speech detection looks for abusive language, and intent detection asks what the writer wants to do. Some of these draw on named entity recognition to find the target of an opinion, and on semantic analysis to interpret meaning.

Good practice

Before relying on a sentiment system, teams should test it on a sample of their own data labeled by several people, report accuracy by language and by group of speakers, and inspect errors by hand. Results are best presented as trends and ranges, not as exact numbers for individual messages. Whenever the output could affect a person, for example in hiring or credit decisions, sentiment scores should not be used as the sole basis for action, and human review is appropriate.

FAQs

What is sentiment analysis? It is the use of language technology to detect whether text expresses a positive, negative or neutral opinion, and sometimes the specific emotion.

What is aspect-based sentiment analysis? It identifies sentiment about particular features or topics within a text, such as a phone’s battery versus its screen, instead of giving one overall score.

How accurate is sentiment analysis? Accuracy depends on the domain and the method. Models can perform well on clear text and worse on sarcasm, mixed opinions and unfamiliar domains.

What is the difference between sentiment analysis and emotion detection? Sentiment analysis usually measures polarity, such as positive or negative. Emotion detection classifies finer feelings such as anger, joy or fear.

Is sentiment analysis used in business? Yes. Companies use it to monitor brand perception, analyze reviews and prioritize customer support.

Key facts

  • Pang, Lee and Vaithyanathan published an influential 2002 study applying machine learning to classify movie reviews as positive or negative1.
  • The Stanford Sentiment Treebank, released in 2013, provided sentiment labels for phrases within parse trees to train models on compositional meaning2.
  • Bing Liu's textbook defines sentiment analysis as the study of people's opinions, sentiments, evaluations and emotions toward entities and their attributes3.

Related concepts

Quick checkWhat is sentiment analysis?Show answer

Sentiment analysis, also called opinion mining, is the use of natural language processing to detect whether a piece of text expresses a positive, negative or neutral attitude, and sometimes which emotions it conveys.

Sources

  1. Bo Pang, Lillian Lee and Shivakumar Vaithyanathan, Thumbs up? Sentiment Classification using Machine Learning Techniques, https://arxiv.org/abs/cs/0205070
  2. Richard Socher et al., Recursive Deep Models for Semantic Compositionality Over a Sentiment Treebank, https://aclanthology.org/D13-1170/
  3. Bing Liu, Sentiment Analysis and Opinion Mining, Morgan and Claypool, https://doi.org/10.2200/S00416ED1V01Y201204HLT016

Editorially reviewed by Specialty Digest Editorial TeamLast reviewed November 17, 2026Researched and drafted with AI assistanceReport an issue