Implement Viterbi segmentation for a unigram-LM tokenizer given token log-probs

Tokenization & Embeddings3 / 4

Chapter 023 / 4

Tokenization & Embeddings

Implement Viterbi segmentation for a unigram-LM tokenizer given token log-probs

Hard
Target interface
viterbi_segment(s, logp, max_len=None)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.