Lesson 8 / Unit 3: First Recognizer
Character Tokens
Build an explicit digit vocabulary with a separate CTC blank and reversible target encoding.
The vocabulary is _0123456789. The underscore is our display symbol for CTC blank. It has index zero; the spoken digit zero has index one. Confusing those two would delete every zero from decoded output.
Encode Targets
VOCAB = '_0123456789'text = '007'ids = [VOCAB.index(c) for c in text]assert ids == [1, 1, 8]assert ''.join(VOCAB[i] for i in ids) == textThe target encoder never inserts blank. Blank belongs to the frame-level output alphabet, where the model needs a way not to emit another target character.
Preserve Identity
Store the exact ordered vocabulary with the model code or checkpoint metadata. A changed token order can produce a valid tensor of the same shape with the wrong interpretation. Shape checks will not catch it.
For general transcription, the token set might contain letters, spaces or subword units. A larger vocabulary changes data requirements and decoding behaviour. This course’s first model stays deliberately small so alignment and scoring remain inspectable.
Two Sequences
Distinguish the target sequence 007 from a possible frame path such as 0 0 _ 0 _ 7 7. The latter contains repeated frame decisions and blanks. Applying CTC collapse gives the target; joining every nonblank frame first would not.
Try the next lesson’s CTC experiment before changing the vocabulary. The visual CTC explanation is a useful companion for the mapping from paths to outputs.
Your deliverable is a reversible encoder plus explicit checks for zero and repeated digits. Next, the Acoustic Encoder produces one distribution over these eleven symbols at each output frame.
We do this work for teams shipping voice agents: Self-Hosted Voice Agent .
Edit this lesson on GitHub ↗Discussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.