liveBook · Manning

Tokenization

As explained in Transfer Learning for Natural Language Processing

The process of dividing text into units such as words, subwords, or characters.

Tokenization turns text into units a model can process. In NLP workflows, it appears both as data preprocessing for classification baselines and as preparation for inspecting BERT inputs. section 2.0 section 7.1.1

BERT uses subword tokenization: in the example, “didnt” becomes “didn” and “##t.” The encoded sequence also includes “[CLS]” at the beginning and “[SEP]” at the end; these markers depend on the model architecture. section 7.1.1

Inspecting tokens

Encoding “He didnt want to talk about cells on the cell phone because he considered it boring” produces tokens including “[CLS],” “didn,” “##t,” and “[SEP].” section 7.1.1

How Transfer Learning for Natural Language Processing covers it

How deep it goes
Shows BERT subword splitting and explains the roles of [CLS] and [SEP] sequence markers.
Examples
Encodes a sentence about cells and a cell phone, splitting “didnt” into “didn” and “##t.”
What you can do after
Apply it with the Transformers tokenizer to encode text, add special tokens, and map token IDs back to token strings.
How it connects
Links tokenization to NLP preprocessing, BERT, and self-attention visualization.

Also explained in

Compare how 26 books explain tokenization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Transfer Learning for Natural Language Processing. The section links point to the parts of the book it draws on.