CourseNatural Language Processing: The Complete Course · Module 4: Text as Vectors and Classification · part 26 of 73
Part 26 · Module 4: Text as Vectors and Classification

Lesson 1: Turning messages into word and character counts

55 min read·14 Oct 2026
Module 4 · Lesson 1 · About 45 minutes · Needs: basic Python; tokens and vocabulary size from Module 2 help but are not required

The situation

It is Monday 28 September 2026, project week 4. The rule router from Module 1 is still the baseline, and Rosa wants to know whether a trained model can beat it. A model learns from numbers, not from sentences, so every message has to become a row of numbers first.

Ines picks the test case, message TW-M0280 from 9 April: "Volt 2 battery dead again. Second pack in a month. I want this sorted properly this time." This lesson turns it, and the rest of the simulated inbox, into counts of words, word pairs and letter groups, and shows the mistakes that quietly ruin them.

TW-M0280, WEB FORM, 9 APRIL Volt 2 battery dead again. Second pack in a month... volt battery dead again second pack this this volt 1 battery 1 dead 1 again 1 refund 0 this 2 ...
A model reads numbers, so the running example becomes a row of counts: one column per word, 2 under "this", 0 under "refund" (blue: your pipeline; grey: zero).

The rest of this part opens with an account

Signing up is free and takes one email. Nothing to pay, and nothing renews.