Lexical diversity calculator (TTR, MATTR, MTLD, HD-D)
Paste a text, such as a learner essay, a transcript or a literary passage, to measure how varied its vocabulary is with the indices used in language research.
Paste the text
Pre-filled with the opening of Pride and Prejudice (public domain).
LIVE RESULT
INSTANTLexical diversity
The text is analysed in your browser and is not uploaded. Results depend on how words are split: forms such as run, runs and running count as different types, and no lemmatisation is applied.
What lexical diversity measures
Lexical diversity describes how varied the vocabulary of a text is: whether a writer or speaker uses many different words or keeps repeating the same ones. It is used to study language development, second-language proficiency, writing quality, authorship and clinical language samples. Every measure starts from two counts: tokens, the running words, and types, the different words.
TTR = Types ÷ Tokens
Guiraud's R = Types ÷ √Tokens, Herdan's C = log Types ÷ log Tokens
MATTR = mean TTR of every 50-word window
MTLD = mean length of word sequences that keep TTR above 0.72
HD-D = expected TTR of a random 42-word sample
Why TTR alone is not enough
The simple type-token ratio falls as a text gets longer, because common words keep repeating while new words become rarer. Comparing TTR between texts of different lengths therefore mostly compares their lengths. The table shows this for the passage above: TTR drops steadily as the text grows, while MATTR and HD-D stay in a narrow range, and MTLD settles once the text passes about 100 words.
| First n words | TTR | MATTR | MTLD | HD-D |
|---|---|---|---|---|
| 50 | 0.720 | 0.720 | 50.0 | 0.748 |
| 100 | 0.690 | 0.791 | 79.9 | 0.818 |
| 200 | 0.585 | 0.824 | 89.8 | 0.847 |
| 301 | 0.498 | 0.806 | 75.4 | 0.835 |
For the whole passage (301 tokens, 150 types), MTLD is 75.4 and HD-D is 0.835. McCarthy and Jarvis (2010) recommend reporting MTLD together with HD-D or MATTR, because they capture slightly different aspects of diversity.
Choosing a measure
- MTLD (McCarthy and Jarvis, 2010) is the most widely recommended. It needs at least 100 or so tokens to be stable.
- MATTR (Covington and McFall, 2010) is easy to interpret: the average TTR of 50-word windows.
- HD-D (McCarthy and Jarvis, 2007) is a precise version of the older vocd-D and needs at least 42 tokens.
- Guiraud's R, Herdan's C and Maas are older length corrections, still reported in some fields; they reduce but do not remove the length effect.
- Yule's K measures repetitiveness: higher values mean less diversity. It is popular in authorship studies.
Preparing texts
- Use texts of similar length, and of at least 100–200 words, when comparing groups.
- Decide how to treat names, numbers, hyphenated words and spelling errors, and apply the same rules to every text.
- For spoken data, remove transcription codes, fillers and false starts consistently.
- Lemmatise first (convert words to their dictionary form) if you want to measure lemma rather than word-form diversity.
Checking how difficult a text is rather than how varied? Use the readability calculator. To compare word frequencies between two corpora, use the keyness calculator.