Skip to content

Sentiment Analysis

Classifying opinion in text as positive, negative or neutral, the main approaches, and the pitfalls of sarcasm, domain and aggregation.

Editorial team 2 min read

Sentiment analysis classifies the opinion or emotion expressed in text — product reviews, support tickets, survey comments, social media posts.

Levels of Detail

  • Document-level: is this review positive or negative overall?
  • Sentence-level: sentiment of each sentence.
  • Aspect-based: sentiment towards specific aspects — "great battery, terrible screen".

Approaches

  • Lexicons: count positive and negative words. Transparent but crude.
  • Classic machine learning: bag-of-words features with logistic regression or Naive Bayes.
  • Fine-tuned transformers: accurate on text similar to their training data.
  • Large language models: can classify with instructions, handle nuance and explain their reasoning.

Common Pitfalls

  • Sarcasm and irony: "Great, it broke again."
  • Domain shift: a model trained on film reviews may misread medical feedback.
  • Neutral and mixed text: many real comments aren't clearly positive or negative.
  • Negation and comparisons: "not bad", "better than the last one".
  • Language and dialect differences.

Evaluate on Your Data

Label a few hundred of your own texts and measure accuracy per class. Include mixed and neutral examples.

Using Results Responsibly

Aggregated sentiment trends are more reliable than individual scores. Pair scores with sample comments so people see what's driving them, and don't make consequential decisions about individuals from sentiment scores alone.

More in Applied AI

All Applied AI guides →
Applied AI Guide · 2 min

Image Classification With Pretrained Models

Classifying images without training from scratch: choosing a pretrained model, preparing images correctly and reading the output.

Applied AI 2 min read 19 May 2026

Applied AI Guide · 2 min

Object Detection Explained

How object detection finds and localises multiple objects in an image, the main model families and how accuracy is measured.

Applied AI 2 min read 18 May 2026

Applied AI Guide · 2 min

Image Segmentation

Semantic, instance and panoptic segmentation: labelling images pixel by pixel, and where each is used.

Applied AI 2 min read 17 May 2026

Applied AI Guide · 2 min

Optical Character Recognition (OCR) With AI

Extracting text from images and scanned documents: how modern OCR works, where it fails and how to improve results.

Applied AI 2 min read 16 May 2026