Tokenization Reference on Wikipedia: What the Term Covers and How to Judge a Tokenizer

A practical guide to tokenization as encyclopedia references describe it: which sense of the term you need, what word tokenization changes, and when plain text is the better choice.

Which tokenization are you looking for?

Searching for a tokenization wiki entry often leads to several unrelated topics, because the word is used in at least four fields. Encyclopedia coverage generally treats them as separate subjects, with a disambiguation step in between. This guide focuses on the linguistic sense: splitting running text into words and similar units for analysis. Article titles and structure on Wikipedia change over time, so check the current disambiguation page rather than relying on any fixed article name.

Sense | What it does | Reversible from output alone?
Linguistic / NLP tokenization | Splits text into words, punctuation, or subword units for analysis | Usually not exactly, unless original character offsets are kept
Lexical analysis (programming languages) | Converts source code into tokens such as keywords, identifiers, and operators for a parser | Partially; whitespace and comments are often discarded
Data security tokenization | Replaces sensitive values, such as card numbers, with surrogate tokens | Only through the system that holds the mapping
Asset tokenization (finance, blockchain) | Represents ownership of an asset as a digital token | Not a text operation

If your goal is to prepare text for counting, searching, tagging, or feeding a language model, you want the linguistic sense. The remaining sections cover that case.

Is word tokenization suitable for your use?

Tokenization fits well when software needs to work with text: word frequency counts, search indexing, part-of-speech tagging, concordances, or input to a language model. Its main benefit is giving downstream steps consistent units to operate on.

The key tradeoff is that tokenization is an analysis step, not a presentation format. Its output is built for programs, not people, and it usually drops information. Whitespace, original spacing, and sometimes case or punctuation are lost unless the tool records where each token came from.

Plain text is the better choice whenever people will read, quote, edit, or share the result, and whenever exact wording matters, as with legal text, citations, or anything that must round-trip unchanged. A sound rule is to keep the original text as the authoritative copy and treat tokens as a derived, disposable view.

What tokenization actually changes

Tokenization does not change the characters themselves. It decides where the boundaries between units fall. This sets it apart from transformations such as reversal, mirrored lettering, or Unicode 'font' substitution. Those transformations either swap the stored characters for different code points or change only the visual display. A tokenizer reads the stored characters and produces a sequence of segments. Depending on the tool, that sequence is held as a list, an array of character offsets, or a string with delimiters inserted.

Tokenizers disagree about where boundaries belong. The main points of variation are:

  • Contractions and clitics: some conventions keep "didn't" whole, while others split it into "did" and "n't".
  • Punctuation: whether a final period, currency sign, or quotation mark becomes its own token.
  • Numbers, dates, URLs, and hyphenated words, which simple rules often break apart in unhelpful places.
  • Languages written without spaces between words, such as Chinese, Japanese, and Thai, where splitting on whitespace does not work and a dedicated segmenter is needed.
  • Subword schemes used by language models, such as byte-pair encoding and WordPiece, which break words into frequent fragments. Token counts therefore depend on the specific tokenizer and should not be compared across models.

The example below is illustrative. It shows how two common conventions treat the same sentence and is not output captured from any particular tool. Square brackets mark token boundaries.

Input:
She didn't pay $3.50 for the café's 👩‍👩‍👧 sticker.

Whitespace split:
[She] [didn't] [pay] [$3.50] [for] [the] [café's] [👩‍👩‍👧] [sticker.]

Treebank-style rules:
[She] [did] [n't] [pay] [$] [3.50] [for] [the] [café] ['s] [👩‍👩‍👧] [sticker] [.]

Two parts of the input need care. In "café", the accent is written here as a plain "e" followed by a separate combining acute accent, so it occupies two code points. The family emoji is five code points: three people joined by two invisible zero-width joiners. Both word-level splits above keep these sequences intact, because neither puts a boundary inside a word. A tool that splits by individual code points would instead separate the accent from its letter and break the emoji into separate figures. Character-level work should operate on grapheme clusters, the units a reader perceives as single characters, rather than on raw code points.

Will the result stay readable and usable after copying or sharing?

Tokens copied out of a tool are only as portable as the format they come in. Bracketed or delimiter-joined output pastes as ordinary text, but it no longer reads as the original sentence. Rejoining tokens with single spaces produces artifacts such as "did n't" or "sticker .". Restoring the original faithfully requires either the untouched source text or stored character offsets. When you evaluate a tokenizer, check whether it exposes offsets or a detokenizer, and test that round trip on your own material.

Accessibility follows from this. Screen readers read tokenized output as written, including inserted brackets, split contractions, and isolated punctuation, so a sentence becomes harder to follow. No assistive technology was tested for this guide, and the effect varies by reader and settings. Do not present tokenized text to readers as content. Show the original and keep the tokens behind the scenes.

For search and editing, tokenization works mostly out of sight. Search systems tokenize queries and documents internally. Pasting pre-tokenized text into a search box or document can therefore produce odd matches rather than better ones. If tokens must be shared with another system, use a structured format such as one token per line or a list with offsets, and ensure both sides use the same text encoding and normalization. Otherwise, an accented letter stored as one code point on one side and two on the other may fail to match.

Gaps in this overview

No source material about the current Wikipedia articles was available for this guide. It therefore makes no claims about specific article sections, revision dates, or cited sources, and the descriptions above rely on general, widely documented principles. The tokenizer behavior shown is illustrative. Before choosing a tool, run it on a sample of your own text that includes contractions, numbers, accented characters, emoji, and any languages written without spaces, and confirm its output against the conventions your downstream steps expect.