Type-token ratio for language samples
What type-token ratio measures in a language sample, how tokenization and text formatting change the result, and when TTR is or isn't the right measure.
Type-token ratio (TTR) is one of the simplest measures of lexical diversity in a language sample. It is widely used in speech-language pathology, child language research and corpus work. It is easy to calculate, but it is also easy to misread. The number depends heavily on how long the sample is and on how the text was split into words before counting. This review explains what TTR measures, what decisions change it, and when to use something else.
Is type-token ratio suitable for your purpose?
TTR suits quick, rough comparisons of vocabulary variety when the samples are the same length and were transcribed and tokenized the same way. Its main benefit is transparency: anyone can check the arithmetic, and the result is easy to explain.
The decisive tradeoff is length sensitivity. As a sample grows, common words repeat, so TTR tends to fall even when the speaker's vocabulary has not changed. A longer sample from a more capable speaker can therefore score lower than a short sample from a less capable one. Raw TTR is a poor choice for comparing samples of different lengths, for tracking change across sessions of uneven length, or as the sole basis for a clinical judgment.
- TTR is reasonable when:
- samples are cut to the same number of tokens before counting
- one transcriber or a written convention handles fillers, repetitions and contractions consistently
- the goal is description or screening, not a standalone diagnostic decision
- Consider an alternative when:
- sample lengths differ and cannot be equalized
- results will be compared against published reference data collected under different rules
- the text has passed through styling, formatting or transformation tools that may have altered its characters
What TTR actually counts
A token is each running word in the sample. A type is each distinct word form. TTR is the number of types divided by the number of tokens, so it ranges from just above 0 to 1. A result near 1 means almost every word is new. A lower result means more repetition.
Worked example: "The dog saw the cat and the cat ran." With case ignored and punctuation removed, there are 9 tokens: the, dog, saw, the, cat, and, the, cat, ran. There are 6 types: the, dog, saw, cat, and, ran. TTR is 6 divided by 9, or about 0.67.
The number describes word forms, not meaning. TTR does not know that "ran" and "run" are the same verb unless you lemmatize first. It does not reward rare words over common ones. It also cannot tell meaningful repetition from a stall in fluency. Everything it reports comes from the counting rules you choose.
Tokenization decisions that change the result
Two people can get different TTRs from the same transcript if their tokenization rules differ. Write each decision down and apply it every time. The table lists common choice points and how each tends to affect the counts.
| Decision | Options | Typical effect |
| Case | Fold to lowercase, or keep case | Keeping case splits "The" and "the" into two types and raises TTR |
| Contractions | One token ("don't"), or split ("do" + "n't") | Splitting adds tokens and can merge types with full forms |
| Word forms vs lemmas | Count surface forms, or lemmatize | Lemmatizing merges inflections and lowers type counts |
| Fillers and mazes | Include or exclude "um", false starts and revisions | Including them usually adds repeated tokens and lowers TTR |
| Unintelligible segments | Exclude, or count as placeholder tokens | Placeholders can create artificial repeated types |
| Numbers, names, hyphenated forms | Count, exclude, or normalize | Inconsistent handling shifts both counts |
In clinical language sample analysis, transcription conventions often specify how to mark and exclude mazes and how to segment utterances. If you compare results with any published reference data, the sample length, elicitation task and exclusion rules need to match those used to build that data. This article does not supply reference values or norms. None were available in the source material, so check the original documentation of any norms before applying them.
Measures designed to reduce length effects
- Fixed-length TTR: cut every sample to the same token count before computing TTR. This is simple, but it discards data beyond the cutoff.
- Number of different words (NDW): the raw type count from a sample of fixed length, commonly used in speech-language pathology. Like TTR, it is only comparable across equal-length samples.
- Moving-average TTR (MATTR): compute TTR in a sliding window of fixed size and average the results. Window size is a choice that should be reported.
- MTLD and vocd-D: approaches built to reduce dependence on sample length. Research has debated how well each achieves this, so treat them as better-behaved, not length-proof.
The sketch below shows the core arithmetic for TTR and MATTR, with basic normalization. It is a starting point, not a replacement for a documented transcription protocol. It does not lemmatize or remove mazes.
import re
import unicodedata
def tokenize(text):
text = unicodedata.normalize("NFKC", text).lower()
text = text.replace("\u2019", "'")
return re.findall(r"[^\W\d_]+(?:'[^\W\d_]+)*", text)
def ttr(tokens):
return len(set(tokens)) / len(tokens) if tokens else 0.0
def mattr(tokens, window=50):
if len(tokens) < window:
return ttr(tokens)
ratios = [len(set(tokens[i:i + window])) / window
for i in range(len(tokens) - window + 1)]
return sum(ratios) / len(ratios)
How copying, styling and text transformations distort counts
A tokenizer counts stored characters, not what appears on screen. Text that looks identical to a reader can be made of different code points. Text that looks different can be the same word underneath. Several common situations matter for TTR.
- Styled Unicode "fonts": generators that make bold, italic or script-looking text usually swap ordinary letters for separate mathematical or decorative characters. Without compatibility normalization (NFKC), a styled "cat" and a plain "cat" become two different types, or the styled one may not be recognized as a word at all.
- Curly and straight apostrophes: word processors often convert ' to ’ automatically. Unless you normalize them, "don't" typed two ways counts as two types.
- Composed and decomposed accents: "café" can be stored as one accented character or as "e" plus a combining accent. Normalization makes these match. Some tokenizers otherwise split the word at the combining mark.
- Invisible characters: non-breaking spaces and zero-width characters picked up during copy and paste can merge words or split them unexpectedly.
- Reversed or mirrored text: character reversal produces strings that are not words in the language, so every resulting type is meaningless for lexical analysis. Mirroring done only through visual display, such as CSS or bidirectional rendering, leaves the stored text intact. Copying it may or may not keep the original order, depending on how it was produced.
- Emoji: a single emoji can consist of several code points joined together. A tokenizer may drop it, keep it, or split it into pieces, so decide in advance whether emoji count as tokens.
The practical rule: analyze a plain-text transcript with ordinary letters, consistent punctuation and a stated normalization form. If a sample arrives styled, formatted or transformed, convert it to plain text and check it against the original before counting. Do not assume a sample is clean because it looks correct in one editor or viewer. Behavior varies by application, and this review did not test any specific editor, tokenizer or analysis program.
Gaps in this review
The source material contained no subject-specific evidence. That means there are no published norms, recommended sample sizes, software comparisons or validation figures here. Statements above about length sensitivity and alternative measures reflect general, widely documented principles. The worked example and code show the arithmetic only. For clinical or research decisions, consult the documentation of the transcription convention, analysis software and reference data you plan to use.