# Sentiment analysis

> Canonical: https://skillalmanac.com/glossary/sentiment-analysis | Last verified: 2026-11-25 | Index status: index-eligible

Sentiment analysis is the task of judging, by software, whether a piece of text expresses a positive, negative or neutral attitude, such as in a product review or a support message.

Also called: sentiment analysis AI, sentiment analysis NLP, sentiment analysis tool, opinion mining, sentiment classification.

## In plain language

Sentiment analysis reads text and labels the mood behind it. A shop might run thousands of reviews through it to see how many customers sound happy and how many sound annoyed, instead of reading each one. The label can be as simple as positive, negative or neutral. It is not a mind reader. Sarcasm, jokes and missing context can flip the real meaning, so a review that says great, it broke on day one may be scored positive. Treat the totals as a rough guide and read a sample of the underlying text before you act, especially when a decision about a person or a refund depends on it.

## Technical definition

IBM describes two main approaches. Rule-based systems classify keywords against lexicons, groups of words such as affordable for positive or expensive for negative, and total a score. Machine learning systems learn to read sentiment from the words and their order, and IBM notes they are more adaptable and can handle more complex scenarios. IBM names context, sarcasm and irony as sources of error. In the Stanford textbook Speech and Language Processing, the classification chapter uses sentiment analysis as an example, with a review as the input and a set such as positive and negative as the output, and words like awesome and awful as informative features.

## How it shows up when you use agents

You meet sentiment analysis whenever an agent has to sort feedback: reviews, survey comments, support tickets or social posts. Two routes are common. One is a dedicated classifier, a model trained for the label. The other is asking a general [large language model](/glossary/large-language-model) in plain words, which is [zero-shot learning](/glossary/zero-shot-learning) when you give no examples. The field it belongs to is [natural language processing](/glossary/natural-language-processing).

What breaks when it is misunderstood: trusting the label on sarcasm or short messages, comparing scores from different tools as if they used one scale, and acting on a total without reading examples. A mixed review can be both positive and negative, and one label hides that.

Next action: read twenty labeled items yourself before you rely on the totals, and keep the original text next to each label. For a customer-facing reply, the [review-reply-writer](/skills/skill-almanac/review-reply-writer) skill classifies the review and checks the facts before drafting. For themes with traceable quotes rather than a score, see [user-research-synthesis](/skills/skill-almanac/user-research-synthesis).

## Common confusions

- **Sentiment analysis versus emotion detection.** Sentiment analysis, as IBM describes it, judges whether text is positive, negative or neutral. Naming an emotion such as anger or joy is a finer task.
- **Sentiment analysis versus topic classification.** Sentiment asks how the writer feels. Topic classification asks what the text is about. A review can be on topic and negative at once.
- **Sentiment analysis versus named entity recognition.** Sentiment labels the attitude of the text. NER finds the people, places and organisations it names. Combined, they say who the writer is positive or negative about. See [Named entity recognition](/glossary/named-entity-recognition).
- **Myth.** A model reads tone as a person does. IBM says software has a hard time with irony and sarcasm, so check a sample.

## Worked examples in this catalogue

### [review-reply-writer](https://skillalmanac.com/skills/skill-almanac/review-reply-writer)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: One calm public reply to a customer review, written after the review is classified and every fact the reply will state is checked.

Why it exercises the concept: Classifying a review by its tone is the sentiment step, and the skill uses it to decide what kind of reply to write, then checks facts so the reply does not invent any.

### [user-research-synthesis](https://skillalmanac.com/skills/skill-almanac/user-research-synthesis)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Many interview notes turned into themes where every claim cites verbatim quotes by participant id.

Why it exercises the concept: A contrast case: it groups feedback by theme with quotes you can check, which shows what a single positive or negative label leaves out.

### [Prompt Engineering for Agents vs Chat Models](https://skillalmanac.com/learn/prompt-engineering-guide-for-agents)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A worked agent prompt that states scope, a completion check and a fallback, plus advice to use 3 to 5 examples inside example tags when you add examples.

Why it exercises the concept: Asking a model to label sentiment is a prompting task, and the guide shows how to set the scope and the check, and when to add examples.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

```
claude
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code's overview shows data piped into a one-line instruction, for example log output passed to claude -p with a request to flag anomalies.

Why it exercises the concept: The same piping pattern can pass a file of reviews to a model with an instruction to label each one, which is sentiment analysis done with a general model.

## Related terms

- [Natural language processing (NLP)](https://skillalmanac.com/glossary/natural-language-processing.md)
- [Supervised learning](https://skillalmanac.com/glossary/supervised-learning.md)
- [Large language model (LLM)](https://skillalmanac.com/glossary/large-language-model.md)
- [Zero-shot learning](https://skillalmanac.com/glossary/zero-shot-learning.md)
- [Named entity recognition (NER)](https://skillalmanac.com/glossary/named-entity-recognition.md)

## Sources

- [What is sentiment analysis?](https://www.ibm.com/think/topics/sentiment-analysis), IBM (accessed 2026-11-24)
- [Logistic Regression and Text Classification (Speech and Language Processing, chapter 4)](https://web.stanford.edu/~jurafsky/slp3/4.pdf), Stanford University (Jurafsky and Martin) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
