What is Sentiment Analysis?

Sentiment Analysis is an NLP task that assigns a declared sentiment representation, such as polarity or valence, to a defined text unit and opinion target. Its result is meaningful only with a label scheme, annotation policy, language, domain, and evaluation protocol.

Quick Facts

Created2000s (modern deep learning approaches from 2010s)
SpecificationOfficial Specification

How It Works

Target and granularity define the question

Document-level analysis assumes one dominant opinion for the full text. Sentence-level analysis assigns labels to smaller units. Aspect-based sentiment links an opinion expression to an entity or attribute, so one review can be positive about quality and negative about delivery. Before modeling, define the opinion holder when relevant, target, text span, label set, treatment of mixed or absent sentiment, and whether implicit aspects are annotated.

Labels are measured judgments, not objective facts

Annotation guidance determines how negation, intensifiers, comparison, quotation, sarcasm, domain jargon, and multiple opinions are handled. Measure agreement and adjudicate ambiguous examples instead of hiding them. Preserve language, domain, source, time, and annotator provenance. A model trained on restaurant reviews cannot be assumed to transfer to finance, medicine, support tickets, or a different language.

Scores require calibration and an action policy

A probability or provider sentiment score is model-specific and may not be calibrated. Select thresholds on validation data under the actual error costs, reserve an abstain or review state, and avoid treating sentiment as a direct proxy for user intent, urgency, truth, mental state, or customer satisfaction. When sentiment affects routing or moderation, combine it with explicit signals and give users a correction or escalation path.

Evaluate classes, targets, and distribution shift

Report a confusion matrix and per-class precision, recall, and F1; macro-F1 prevents majority labels from hiding weak classes. Aspect systems also need target and opinion-span extraction metrics, relation correctness, and polarity or regression quality. Use entity-, author-, source-, or time-aware splits to limit leakage, then slice errors by language, domain, sarcasm, mixed sentiment, text length, and rare labels.

Key Characteristics

  • Binds a sentiment label or score to a declared text unit and target
  • Can operate at document, sentence, aspect, or opinion-expression level
  • Depends on an annotation policy for mixed, implicit, sarcastic, and neutral cases
  • Produces domain- and language-dependent scores rather than universal emotion facts
  • Needs calibration, abstention, and downstream action rules
  • Requires per-class, target-level, and distribution-shift evaluation

Common Use Cases

  1. Analyzing sentiment toward specific product attributes in customer reviews
  2. Prioritizing support conversations with calibrated rules and human override
  3. Tracking opinion changes over time while preserving source and sampling context
  4. Auditing survey comments against a stable label taxonomy
  5. Creating reviewed features for downstream research rather than automatic high-impact decisions

Example

loading...
Loading code...

Frequently Asked Questions

What is the difference between sentiment analysis and opinion mining?

The terms are often used interchangeably. Sentiment analysis commonly emphasizes assigning polarity or affect scores, while opinion mining can include extracting the opinion holder, target, aspect, expression, and relation. A project should define its exact output rather than relying on either broad label.

How is sentiment different from emotion and stance?

Sentiment usually describes evaluative polarity or valence toward a target. Emotion classification predicts states such as joy or anger, while stance predicts support, opposition, or neutrality toward a proposition or entity. The labels can correlate but are not equivalent, so they require separate annotation and evaluation contracts.

How does aspect-level sentiment analysis differ from document-level analysis?

Document-level analysis assigns an aggregate label to a complete text. Aspect-level analysis identifies the target or attribute and links it to an opinion and sentiment, allowing one review to be positive about food but negative about service. It therefore needs extraction and relation metrics in addition to polarity accuracy.

Can one sentiment model be used across every domain and language?

No. Vocabulary, sarcasm, label prevalence, writing style, cultural conventions, and even the meaning of positive language vary by domain and language. Validate on representative target data, monitor shift, and preserve an abstain or review path. Translation of the input is another model step and must be evaluated separately.

How should a sentiment model be evaluated?

Freeze the target, label policy, model version, threshold, and data split. Report the confusion matrix, per-class precision and recall, macro-F1, calibration, coverage after abstention, and errors by language, domain, source, sarcasm, mixed sentiment, and time. For aspect-based tasks, also score target and opinion extraction and their linkage.

Related Terms

Related Articles