Measuring Opinion with Sentiment Analysis and Opinion Mining
This lesson explains sentiment analysis, which determines the opinion expressed in text: whether the writer is positive, negative, neutral or mixed, and how confident the model is.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish document-level from sentence-level sentiment.
- Explain how opinion mining links opinions to their targets.
- Interpret sentiment labels and confidence scores.
- Recognize the limits of sentiment analysis, such as sarcasm.
Document and sentence sentiment
Azure Language sentiment analysis returns a label for each document and for each sentence in it: positive, negative, neutral or, for a document with both positive and negative sentences, mixed. Each label comes with confidence scores between 0 and 1 for positive, neutral and negative, which add up to 1. Applications use the scores to set thresholds, for example to flag strongly negative reviews for follow-up.
Reading confidence scores
Opinion mining
A single label can hide detail. In The camera is superb but the battery is disappointing, the document is mixed. Opinion mining, also called aspect-based sentiment analysis, links each opinion to its target (aspect): positive about camera, negative about battery. This tells a product team exactly what to improve.
The following diagram compares a document label with opinion mining.

Model-based sentiment and its limits
Generative models can also judge sentiment and tone, and can label finer emotions such as frustrated or delighted when instructed. Every approach struggles with sarcasm, irony and domain-specific language (sick can be praise), so important decisions should not rely on sentiment alone.
Interpreting the scores
Confidence scores show how certain the model is, which matters as much as the label. For the review Delivery was quick and the packaging was fine, the scores might be 0.92 positive, 0.07 neutral and 0.01 negative, a clear positive result. For It arrived, I suppose, they might be 0.30 positive, 0.55 neutral and 0.15 negative: the label is neutral, but the low top score shows uncertainty.
Applications therefore set thresholds that match their purpose. A team that wants to contact every unhappy customer might flag any review with a negative score above 0.6, accepting some false alarms. A dashboard that reports overall satisfaction might use only confident results and report the share of reviews in each category over time, which shows trends even when individual results are imperfect.
Labels and thresholds
Reading a sentiment result
A review reads: "Check-in was quick and the staff were lovely. The room, however, was noisy and the air conditioning failed." What overall sentiment is expected, and how can the hotel see which parts were criticized?
The first sentence is positive and the second negative, so the document label is mixed.
Opinion mining returns the aspects: positive for check-in and staff, negative for room and air conditioning. Key phrase extraction would list the topics but not whether each was praised or criticized.
What does opinion mining add to sentiment analysis?
Show answer
It links sentiment to specific aspects, such as the food being good but the service slow.
Exam Tips
Remember for the exam
- Labels are positive, negative, neutral and mixed, with confidence scores per label.
- Opinion mining links sentiment to specific aspects.
- Sarcasm and domain language limit every sentiment approach.