Tokens and types in linguistics
A practical guide to the type/token distinction: worked examples, how tokenization and Unicode normalization change type counts, and when to work from plain text.
Ask how many words a text contains and you can get two different answers. One counts every word as it occurs. The other counts each distinct word only once. Linguists call these tokens and types. The distinction is simple, but the counts you get depend on choices made during tokenization: where words are split, and which variants are treated as the same. This guide explains the distinction and shows how those choices change results. It also covers when a text needs to be cleaned back to plain characters before it can be analyzed.
The type/token distinction in brief
A token is a single occurrence of a linguistic unit in a particular text. A type is the abstract unit that those occurrences are instances of. If a word appears three times, that is three tokens of one type. The philosopher Charles Sanders Peirce introduced the terms. In corpus linguistics and text processing, the distinction is the basis for word counts, vocabulary statistics and frequency lists.
Text: the cat sat on the mat
Tokens (6): the | cat | sat | on | the | mat
Types (5): the, cat, sat, on, mat
Type-token ratio (TTR) = types / tokens = 5 / 6 ≈ 0.83
The type-token ratio is a common rough measure of lexical variety, but it depends on text length. In a longer text, frequent words such as "the" keep repeating, so the ratio tends to fall even when the vocabulary is just as varied. Raw TTR is only meaningful for comparing texts of similar length. Otherwise, use a length-controlled variant, such as the average TTR over fixed-size chunks of the text.
Token vs type vs lemma: type and token examples
"Type" usually means a distinct word form under whatever normalization you have chosen. That is different from a lemma, the dictionary headword that groups inflected forms together. Confusing the two is a common source of mismatched counts.
| Unit | What is counted | Example: "Cats chased the cat" |
| Token | Every occurrence | Cats, chased, the, cat = 4 |
| Type (case-sensitive) | Distinct spellings | Cats, chased, the, cat = 4 |
| Type (case-folded) | Distinct spellings after lowercasing | cats, chased, the, cat = 4 |
| Lemma | Distinct dictionary headwords | cat, chase, the = 3 |
In this example, lowercasing does not merge anything, because "cats" and "cat" are still different spellings. Only lemmatization combines them. Lowercasing does matter in a sentence like "The cat saw the dog". Without case folding, "The" and "the" are two types. With it, they are one.
Is a given tokenization suitable for your use?
Tokenization is suitable when its rules are fixed, documented and matched to your question. Its main benefit is consistent, reproducible counts. Its main tradeoff is that every rule merges some forms or splits others, and that changes the type count and any ratio built on it. No setting is neutral. Choose the merges your question needs and report them. If the source contains decorative Unicode, mirrored or reversed text, or other presentation-driven characters, recover a plain-text version before you count anything.
- Comparing vocabulary richness across texts: case folding and Unicode normalization are usually appropriate, provided every text is processed the same way.
- Studying spelling, capitalization or orthographic variation: keep forms distinct. Merging them would erase the thing you are measuring.
- Counting word families or meanings: lemmatize, and treat the result as lemma counts rather than type counts.
- Building search or matching: normalize aggressively so that visually equivalent strings match. Keep the original text for display.
What tokenization actually changes
Tokenizing does not alter the source text. It places boundaries on a working copy. Normalization steps such as lowercasing or Unicode normalization do change the characters in that copy, and they change your counts. The boundary rules matter as much as normalization. Contractions, hyphens, punctuation and numbers can each be split or kept whole. The illustrative schemes below show how one short sentence produces different counts.
Input: Don't over-count e-mail.
Scheme A (split on spaces only):
Don't | over-count | e-mail. -> 3 tokens
Scheme B (also separate final punctuation):
Don't | over-count | e-mail | . -> 4 tokens
Scheme C (also split contractions and hyphens):
Do | n't | over | - | count | e | - | mail | . -> 9 tokens, 8 types
("-" occurs twice)
None of these schemes is wrong. They answer different questions. The practical rule is to pick one scheme and keep it fixed across every text you compare.
Where Unicode quietly affects type counts
Strings that look identical can be stored as different sequences of code points. An accented letter can be one precomposed character or a base letter followed by a combining mark. Compared code point by code point, the two spellings below are different types, even though a reader sees the same word. Applying Unicode normalization form NFC to all input first makes them compare as equal.
Displayed: café Precomposed: U+0063 U+0061 U+0066 U+00E9 (4 code points)
Displayed: café Decomposed: U+0063 U+0061 U+0066 U+0065 U+0301 (5 code points)
Decorative "font" generators usually do not apply a font at all. They replace ordinary letters with other Unicode characters, such as the Mathematical Alphanumeric Symbols. To a tokenizer, a word written in mathematical bold letters is a different type from the same word in ordinary letters. NFC leaves these characters unchanged. NFKC maps them back to ordinary letters, but NFKC also folds other distinctions, such as ligatures and superscript digits. Use it deliberately rather than by default. A styled appearance that comes from real formatting, such as a typeface set in a document or CSS, leaves the underlying characters unchanged and does not affect counts.
If your unit is the character rather than the word, count user-perceived characters (grapheme clusters, as defined in Unicode's text segmentation rules) rather than code points. A letter with a combining accent, a flag made of two regional-indicator symbols, and an emoji sequence joined with zero-width joiners each look like one character but contain several code points. A code-point counter will split all of them.
Will results stay usable after copying or sharing?
Copying and pasting carries the actual code points, so substituted characters survive the trip. A pasted styled word stays a different type in downstream analysis. It may not match a search for the ordinary spelling, and it can be hard to edit or spell-check. Screen readers and other assistive technology may announce substitute characters by their names, read them letter by letter, or skip them. Behavior varies by product, version and platform. No documentation or test for a specific screen reader or destination was supplied for this guide, so check the exact tools your readers use. Whenever text will be analyzed, searched or read aloud, keep a plain-text equivalent.
Shared statistics have their own portability problem. A type count or type-token ratio means little without the scheme that produced it. When you publish or hand off counts, state the boundary rules, case handling, Unicode normalization form, and whether forms were lemmatized.
- Convert decorative, mirrored or reversed text back to its plain source before counting.
- Apply one Unicode normalization form (NFC, or NFKC if compatibility folding is intended) to all inputs.
- Fix the tokenization rules for contractions, hyphens, punctuation and numbers, and do not change them mid-study.
- Compare type-token ratios only across texts of similar length, or use a length-controlled measure.
- Record every choice alongside the results.
Gaps in this overview
No subject-specific evidence was supplied: no named tokenizers, tool documentation, or test results. The counts above were worked by hand from illustrative sentences. The behavior of specific software, platforms and assistive technologies has not been verified here and should be checked against their own documentation or a scoped test before you rely on it.