CourseNatural Language Processing: The Complete Course · Module 9: Translation, Multilingual NLP and Evaluating Generation · part 63 of 73
Part 63 · Module 9: Translation, Multilingual NLP and Evaluating Generation

Lab: Route four languages, scored one at a time

98 min read·14 Oct 2026
Module 9 · Lab · About 60 minutes · Needs: lessons 1 to 3 of this module, and the Module 8 lab (or its cells, pasted here). CPU only; no key needed

What you are building

message any language langid.py which language translate.py to English multilingual router per language macro F1 gen_metrics.py: BLEU, chrF 80 hand-written test messages
Each message's language is detected (blue), then it is translated or routed by the multilingual model (amber); every route is scored per language (green).

It is Thursday 5 November 2026, project week 9. Since delivery to Germany, Spain and France started on 1 July, about four in ten messages arrive in German, Spanish or French. The three lessons each answered part of Rosa's question in a notebook: which language a message is in, how to route it, and how good the English is.

This lab settles the lessons' files once, as inbox/langid.py, inbox/translate.py and inbox/gen_metrics.py with one test file, then runs the whole path on the 80 hand-written test messages: detect the language, route five ways, score every route per language, and score the translations against the generated references with BLEU and chrF. It ends with one report in reports/.

Open a new Colab notebook, call it module-09-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.