Sentiment analysis: classify opinions and validate the results
Define what you classify, which labels you use, and how to evaluate sentiment analysis.
Sentiment analysis: classify opinions and validate the results
Sentiment analysis is an NLP task that assigns labels to the evaluative or emotional direction expressed in text. Positive, negative, and neutral labels are common, but some tasks identify opinions about specific aspects of an item. Define the unit and labeling question first so that scores can be interpreted correctly.
Specify what is being classified
Document-level classification predicts the overall attitude of a review. Aspect-based sentiment analysis (ABSA) also identifies the aspect and its opinion, as in “The battery lasts, but the screen is dim.” The battery may be positive and the screen negative; a single label for the whole sentence would lose that distinction.
Sentiment labels do not directly measure the writer’s actual feelings or the objective quality of a product. They classify what the text expresses in response to a defined question. “Delivery was quick, but the packaging was awful” evaluates delivery and packaging differently. “Not bad” may be positive despite containing a negative word, and sarcastic praise may differ from literal praise. These examples are illustrative, not gold labels from a dataset.
Design the task and label rules
**Choose the unit and question.** Decide whether to classify a whole review, sentence, or aspect, and distinguish the opinion holder from its target.
**Write annotation rules.** Define positive, negative, neutral, mixed opinion, factual text without an opinion, sarcasm, negation, and uncertainty with examples. Do not force unclear cases into neutral; use an exclusion or review rule if appropriate.
**Collect representative data.** Match the target language, product or domain, text length, and channel. Split by source or document so duplicate reviews do not appear in both training and test data.
**Compare baselines.** Evaluate lexicons or rules, supervised models, and large language models on the same test set with documented prompts and label guidance. Do not infer quality from model type alone.
**Inspect errors.** In addition to aggregate scores, check negation, sarcasm, mixed opinions, emoji and informal language, aspect confusion, and errors by language or domain.
Do not deploy based on one score
Accuracy is the share of all predictions that are correct. Macro-F1 averages each class’s F1 equally, helping reveal performance on less frequent classes. With imbalanced data, accuracy can be high while a minority label is missed. Review the confusion matrix and per-class precision and recall. For ABSA, state whether both aspect span and polarity must match, or whether semantically valid alternate spans count. Research notes that requiring only one exact gold phrase can undervalue valid variations when aspect and opinion spans are subjective.
| Use case | Evaluation to check |
|---|---|
| Summarizing customer reviews | Document-level scores and samples by product and time |
| Comparing specific features | Aspect extraction and polarity for each aspect |
| Negative cases are rare but important | Per-class recall, macro-F1, and confusion matrix |
| Multiple languages or channels | Separate tests and review of local expressions |
A 2024 study compared large language models with domain-specific smaller models across 13 tasks and 26 datasets. In that study, large models performed satisfactorily on simpler tasks but lagged on complex tasks requiring fine-grained phenomena or structured information; they did better than smaller models in few-shot settings. These findings apply to the study’s data and setup, not as a guarantee for every current model or use case.
Before deployment, validate on a separate sample from the real channel and time period, and record disagreements among human annotators. If classifications feed into customer responses or policy decisions, route low-confidence or sensitive cases to human review. Trustworthiness depends on clear labels, representative data, context-aware evaluation, and monitoring errors after release.
References
Barnes, Øvrelid & Velldal, [Sentiment Analysis Is Not Solved! Assessing and Probing Sentiment Classification](https://aclanthology.org/W19-4802/), BlackboxNLP 2019.
Gardner et al., [Competency Problems: On Finding and Removing Artifacts in Language Data](https://aclanthology.org/2021.emnlp-main.135/), EMNLP 2021.
Zhang et al., [Sentiment Analysis in the Era of Large Language Models: A Reality Check](https://aclanthology.org/2024.findings-naacl.246/), Findings of NAACL 2024.
[Single Ground Truth Is Not Enough: Adding Flexibility to Aspect-Based Sentiment Analysis Evaluation](https://aclanthology.org/2025.naacl-long.603/), NAACL 2025.