In plain words
A restaurant gets 4,000 reviews. Nobody can read them all, but the owner wants to know: are people happy, and about what?
Sentiment analysis does that reading. It looks at each review, post or message and gives it a label like positive or negative, or a score from very unhappy to very happy. Add up thousands of scores and you can see the mood at a glance.
Good systems go further and split one review into parts. "Food was great, delivery was slow" is not simply positive or negative: it is happy about the food and unhappy about the delivery.
Companies use it to track reviews, support tickets and social media. It is a classic job in natural language processing.
Everyday example
A shopkeeper reading the room
A sweet shop owner hears customers chatting at the counter. "The kaju katli is lovely." Good. "But it's so pricey now." Not so good. He does not remember every sentence, but by evening he knows the mood: people love the sweets and grumble about prices. Sentiment analysis does that listening for millions of written comments, and keeps count.
Where the example breaks: The shopkeeper hears tone of voice and sees faces. The AI only gets the words, so sarcasm ("Great, another late delivery"), local slang and mixed languages like Hinglish can fool it.
How it actually works
Sentiment analysis is a form of classification: text goes in, a label or score comes out.
Word lists
The earliest approach counted words from a list: "excellent" plus points, "awful" minus points. It is simple, but it misses context. In a well known 2002 study on film reviews, word lists picked by people scored 58% and 64%, where blind guessing scores 50%.
Learning from labelled examples
The same 2002 study trained machine learning models on reviews already marked positive or negative and reached about 81 to 83%. The model learns which words and phrases go with which feeling, from labelled data.
Handling negation and context
"Neither that funny, nor super witty" contains two positive words but is negative. Stanford's 2013 Sentiment Treebank labelled the feeling of every phrase in 11,855 sentences so models could learn how words combine.
Aspects and scores
Aspect-based sentiment analysis gives a separate feeling for each thing mentioned: food, price, service. Cloud services often return a score; Google's, for example, runs from -1.0 (negative) to 1.0 (positive), plus a separate measure of how strong the emotion is.
Today: transformers and chatbots
Most systems now fine-tune a transformer model on labelled examples, or simply ask a large language model to label the text. Either way, results should be checked on real samples from the language and topic in question.
- Also called
- Opinion mining
- Early landmark
- "Thumbs up?" by Bo Pang, Lillian Lee and Shivakumar Vaithyanathan, 2002, on film reviews
- Typical outputs
- A label (positive, negative, neutral), a score (such as -1 to 1), or a feeling per aspect
- Hard cases
- Sarcasm, negation ("not cheap"), mixed reviews, slang and code-mixed text such as Hinglish
Questions people ask
What is sentiment analysis used for?
Reading customer reviews at scale, sorting support tickets by how upset people are, tracking how people talk about a brand or film on social media, and spotting problems early. It turns a flood of text into a trend line someone can act on.
How accurate is sentiment analysis?
It depends on the text. Clear reviews in well-resourced languages are handled well. Sarcasm, mixed opinions, slang and less common languages lower accuracy. Even people disagree on some texts, so there is no single number; test on your own data.
Can sentiment analysis understand Hindi or Hinglish?
Increasingly, yes, especially with large language models trained on many languages. But mixed-language text with Roman-script Hindi is harder, because there is less labelled data and spelling varies. It is worth checking results by hand on a sample.
What is the difference between sentiment analysis and emotion detection?
Sentiment analysis usually asks one question: positive or negative, and how strongly. Emotion detection tries to name the feeling, such as anger, joy, fear or surprise. Both are kinds of text classification.
Is sentiment analysis a privacy risk?
It can be. Running it on public reviews is common, but analysing private messages or employees' chats raises consent questions. See AI and privacy. The words people write can reveal more than they intended.
Further reading
- Thumbs up? Sentiment Classification using Machine Learning Techniques (Pang, Lee, Vaithyanathan)ACL Anthology, EMNLP, 2002
- Recursive Deep Models for Semantic Compositionality Over a Sentiment TreebankStanford NLP, 2013
- SemEval-2014 Task 4: Aspect Based Sentiment Analysis (Pontiki et al.)ACL Anthology, 2014
- Natural Language API basicsGoogle Cloud, 2026
- What is sentiment analysis?IBM, 2026