CourseNatural Language Processing: The Complete Course · Module 2: Tokenisation and Word Normalisation · part 17 of 73
Part 17 · Module 2: Tokenisation and Word Normalisation

Lab: A tokenisation and normalisation report for Rosa

58 min read·14 Oct 2026
Module 2 · Lab · About 60 minutes · Needs: lessons 1 to 3 of this module, and the Module 1 lab (or its cells, pasted here)

What you are building

INBOX/TOKENS.PY tokenize, sentences train_subword normalise_words THE REPORT, PER OPTION vocabulary size unknown words on HARD_TEST keyword router accuracy same training split, same 80 hand-written messages
The lab settles one file (blue) and measures every option three ways: vocabulary, unknown words (amber) and the router's score (green).

Rosa's question this week is short: does any of this tokenising and normalising help the inbox, or is it busywork? The lessons gave three answers in three notebooks, each on its own slice of data. This lab puts the three lessons' code into one file, inbox/tokens.py, with its tests, and then writes one report on the same messages: how big the vocabulary is under each option, how many words of the 80 hand-written HARD_TEST messages are unknown, and what each option does to Module 1's keyword router.

Open a new Colab notebook, call it module-02-lab.ipynb, and run each cell in order.

The rest of this part opens with an account

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