Skip to content

Text Classification in Practice

From keyword rules to fine-tuned transformers and LLMs: how to build a classifier for tickets, emails or documents.

Editorial team 2 min read

Text classification assigns categories to text: routing support tickets, tagging documents, detecting spam, flagging urgent emails.

Define the Categories Well

Write clear definitions with examples, decide how to handle texts that fit several or none, and check that two people would agree on labels. Ambiguous categories cap achievable accuracy.

Approaches, From Simple to Powerful

  1. Keyword rules: fast to build and a good baseline.
  2. TF-IDF + logistic regression: strong, fast and explainable with a few thousand labelled examples.
  3. Embeddings + a simple classifier: good accuracy with fewer labels.
  4. Fine-tuned transformer: high accuracy with enough labelled data.
  5. LLM with instructions and examples: works with little or no labelled data and handles new categories easily, at higher per-request cost.

Labelled Data

Label a representative sample, including hard cases. For LLM approaches, you still need labelled examples to evaluate, even if not to train.

Evaluation

Use per-class precision and recall and the confusion matrix to see which categories are confused. Check performance on recent data, since topics shift over time.

Handling Uncertainty

Route low-confidence predictions to a person, and use their decisions as new training or evaluation data.

Monitoring

New products, issues and phrasing appear over time. Track the share of low-confidence predictions and periodically re-label a sample to check accuracy.

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 4 Jun 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 3 Jun 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 2 Jun 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 1 Jun 2026