An out-of-vocabulary word is a token absent from the vocabulary used to index text. A special [UNK] token gives it a stable fallback index instead of leaving the input unrepresentable. section 14.2
Mapping an unseen word
Suppose the vocabulary assigns [UNK] to 0 and contains the words in “The quick brown fox jumped over the dog.” The sentence with “lazy” produces [0, 2, 3, 4, 5, 6, 1, 0, 7, 8]: “lazy” becomes 0 because it is not known. “The” also falls back to 0 in this lowercase vocabulary. section 14.2
vocabulary = { "[UNK]": 0, "the": 1, "quick": 2, "brown": 3, "fox": 4, "jumped": 5, "over": 6, "dog": 7, ".": 8, } words = split_words("The quick brown fox jumped over the lazy dog.") indices = [vocabulary.get(word, 0) for word in words]
Inspect the vocabulary lookup and see how missing tokens receive the [UNK] index; compare the resulting sequence in b7. section 14.2







