Running a Tokenizer by Hand

Sequential DataMedium+20 XP+20

Running a Tokenizer by Hand

Here is a deliberately tiny subword tokenizer, small enough to run by hand. Its vocabulary is exactly:

  • every single lowercase letter, a through z
  • four multi-character pieces: in, ins, stant, tan

It splits text with one rule, applied strictly left to right:

Starting at the current position, take the longest piece in the vocabulary that matches the text from that position. Emit it, move the position to just past it, and repeat until the word is used up.

The rule never looks ahead and never backtracks. The word instant is not in the vocabulary as a whole.

How many tokens does this tokenizer produce for instant?

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.

Select all that apply.