Skip to content
Redmoon Calculators
Text analysis

Lexical Diversity (TTR) Calculator

Type‑Token Ratio plus MATTR moving average — see how much your vocabulary repeats.

Built and maintained by Paul Clark, Redmoon Software

When to use this

Use TTR and MATTR to evaluate vocabulary range — common in language-learning assessments, child-language research, and stylometry. MATTR is preferable for comparing documents of different lengths because raw TTR drops as text grows.

How it compares

TTR and MATTR are complementary: TTR is intuitive but length-sensitive; MATTR is length-invariant but harder to explain. For formal research, prefer MATTR or one of its cousins (MTLD, HD-D).

0 chars

How it works

Type-token ratio (TTR) is the simplest measure of vocabulary variety: unique words / total words.

Because TTR drops as text gets longer, this tool also computes the Moving Average Type-Token Ratio (MATTR) over a 50-word window, which is length-invariant.

You also get a list of "hapax legomena" — words that appear exactly once.

Formula

FAQs

What is type-token ratio (TTR)?

The ratio of unique words to total words. TTR drops as text gets longer, so it's sensitive to length.

What is MATTR?

Moving Average Type-Token Ratio. It computes TTR over a sliding window (we use 50 words) so the score is comparable across documents of different lengths.

Why does TTR drop as a text gets longer?

Common words like 'the' and 'and' repeat constantly, so the ratio of unique words to total words falls steadily as the text grows. This length sensitivity is the main reason MATTR is preferred for comparing texts of different sizes.

What is a good lexical diversity score?

There is no universal threshold because TTR depends heavily on text length, but within similar-length samples a higher ratio signals richer vocabulary. For fair comparisons use MATTR, which holds the window size constant.

Worked example

Input

The dog ran. The dog jumped. The dog barked. The dog slept.

Output

TTR: 0.45 (5 unique / 11 total) — Low diversity.

"The" and "dog" repeat heavily; only "ran", "jumped", "barked", and "slept" add new types. Low TTR is typical of beginner writing or restricted-vocabulary text.

Common pitfalls

  • Raw TTR is highly length-dependent; never compare a 100-word and a 1000-word text by raw TTR.
  • Case-sensitivity matters: "Dog" and "dog" may or may not be treated as the same type.
  • Lemmatisation matters: "run" and "running" are different types unless you stem first.
  • Random noise in short samples can dominate diversity scores.

Why raw type-token ratio punishes long documents

The basic measure of vocabulary variety is type-token ratio: unique words divided by total words. It has a serious flaw that this tool works around rather than hides — TTR falls mechanically as text gets longer, regardless of the writer.

The reason is unavoidable. English forces repetition of function words: "the", "of", "and" recur every few words in any text. In a 100-word sample those repeats are a small share of the total; across 5,000 words they dominate, so TTR drops even if the writer's vocabulary is expanding. Comparing the TTR of a paragraph with the TTR of a chapter tells you which is longer, not which is more varied.

That is why this tool also reports MATTR — a moving-average type-token ratio computed over a sliding 50-word window and averaged. Because every window is the same length, the length bias cancels, and two documents of very different sizes become genuinely comparable. When TTR and MATTR disagree, MATTR is the one to trust.

Hapax legomena, and what they tell you

The tool also lists hapax legomena — words that appear exactly once in the text. In a natural document these are a large fraction of the vocabulary, and their character is informative in a way the ratios are not.

Skim the list. If the one-off words are precise nouns and specific verbs, the writing is doing real work. If they are near-synonyms of words used elsewhere — "utilise" alongside "use", "commence" alongside "start" — the diversity is coming from elegant variation rather than from saying more things, which usually reads worse rather than better.

Read more about this

Related tools

Send feedback

We read every message. Tell us what could be better or what you love.