Indexing assigns each text token a unique integer ID, turning tokenized text into numeric data. A vocabulary provides the lookup set: matching each split token against it produces an integer index. section 14.6 section 14.2
vocabulary <- c("the", "quick", "brown", "fox", "jumped", "over", "dog", ".")
words <- split_words("The quick brown fox jumped over the lazy dog.")
indices <- match(words, vocabulary, nomatch = 0L)
indices
[1] 0 2 3 4 5 6 1 0 7 8
The example matches split words against a vocabulary; tokens without a match receive 0 in this call. section 14.2














