Skip to main content

Week 1 Lab: Build a T9 disambiguator

The first lab — turn a keypress sequence into a ranked list of real words, using nothing but a dictionary and a mapping of letters to keys

25 February 2027

Before the lab

Bring a plain-text word list — any reasonable dictionary file will do — and the standard telephone-keypad letter mapping. You do not need a UI. A function that takes a digit string and returns matching words is the whole assignment.

In the lab

Twenty minutes on the keypad mapping itself: which letters share a key, and why the historical choices (Q and Z sharing a key with other letters, on phones that predate any standard) still show up in modern implementations. Then work time. By the end, get a sequence like 4663 to return good and home, and have an opinion about which one should come first.

The last ten minutes are a scavenger hunt for keypress collisions your own dictionary produces — pairs of common words that share every key. Two students who find the same collision independently is a good sign your dictionary is a normal one, not an unusual choice you should account for in what you say about the results.

Afterwards

Nothing here is marked on its own, but this is the version of the problem that Assignment 1’s build should be judged as harder than. If your Assignment 1 submission is easier to build than the twelve-key case, that’s worth noticing before you submit it.

The spec

What you bring to the session. Written so a reader can tell whether it has been met without asking you.

Teaching team