AI Hints
Home›NLP Tutorial›Mining Documents
NLP · Lesson 47 of 106

Text Analytics

What are customers saying?.

⏱ 2 min read▶ Video at 1:23:39🎓 Free
Watch this lesson in the NLP courseWatch on YouTube ↗Full NLP course

A single message is a story. A million messages are data. The owner of Bright Books wants a dashboard. What are customers talking about this month, and what's changing? Once Scribe labels every message, this becomes easy.

Text Analytics
From the video: Text Analytics
  • One message is a story
  • A million is data
  • What's changing?

Topics over time

Here's four months of labelled tickets. We group them by month, and by topic, and show the share of each. Run it. Read down the delivery column. In April, its share jumps sharply. Something went wrong with deliveries, and now the owner can see it the moment it happens, instead of hearing about it weeks later. This is where NLP pays for itself. It turns messages into decisions.

trends.pypython
import pandas as pd
import numpy as np

rng = np.random.default_rng(0)
days = pd.date_range("2026-01-01", periods=120)
topics = rng.choice(["delivery", "refund", "question"], 6000, p=[.4, .2, .4])
when = rng.choice(days, 6000)
late = when > np.datetime64("2026-04-01")
topics[late & (rng.random(6000) < 0.35)] = "delivery"

df = pd.DataFrame({"day": when, "topic": topics})
weekly = df.groupby([pd.Grouper(key="day", freq="MS"), "topic"]).size().unstack()
print((weekly.div(weekly.sum(1), axis=0)).round(2).to_string())
Output
topic       delivery  question  refund
day
2026-01-01      0.41      0.38    0.20
2026-02-01      0.40      0.39    0.21
2026-03-01      0.38      0.41    0.20
2026-04-01      0.58      0.28    0.14

Metrics that matter

A good text dashboard shows volume by topic, sentiment over time, the fastest growing topics, the top problems by product, and how many messages were handled automatically. Add a sample of real messages behind each number, so that people can check. A number with no examples doesn't get trusted. Examples with no numbers don't scale.

Volume by topicwhere's the work?
Sentiment trendare people happier?
Fastest growingwhat's new?
Real examplesbehind each number

Summary

Label everything, count it over time, and text becomes a live view of your business. Next, let's go deeper into how to get the very best from language models, with prompts that make them think.

Key takeaways
  • Group by month and topic
  • Watch for sudden jumps
  • Pair numbers with examples
Next up: Making Models Reason — chain of thought