ForHosting KIT · Developer Utilities

Type-Token Ratio Calculator for Lexical Diversity

The type-token ratio calculator measures how varied the vocabulary in a passage is by dividing the number of distinct word types by the total number of word tokens.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Paste prose, a transcript, an essay, or any other text to receive the underlying counts and a reproducible ratio between zero and one. The calculation runs deterministically, supports Unicode words and numbers, handles apostrophes inside words, and can either combine or distinguish words that differ only in capitalization.

Understand what the ratio measures

Type-token ratio, commonly shortened to TTR, compares vocabulary variety with text length. A token is each occurrence of a word in the passage, while a type is a distinct word form. In the sentence “birds sing and birds fly,” there are five tokens but four types because “birds” appears twice. Dividing types by tokens produces a score from greater than zero through one. A value of one means every token is unique, while a lower value means more vocabulary is repeated. This simple interpretation makes the measure useful for an initial look at writing, transcripts, learner language, and content collections. However, the ratio is descriptive rather than a judgment of quality. Repetition may be deliberate, necessary, or desirable, especially in technical instructions and focused explanations. Use the returned token and type counts alongside the ratio so readers can understand exactly how the score arose instead of treating one decimal value as a complete assessment of style or ability.

Compare texts on a fair basis

Text length has a strong effect on a basic type-token ratio. Short passages have fewer opportunities to repeat words, so they often receive higher scores than longer passages even when both come from the same writer or subject. For a meaningful comparison, analyze samples of similar length, genre, language, and preparation. For example, compare two five-hundred-word essays rather than a short message with a full report. This calculator recognizes sequences of Unicode letters or numbers as tokens and keeps internal straight or curly apostrophes, so contractions such as “don’t” remain one token. Punctuation around a word does not create another type. By default, capitalization differences are combined: “Book” and “book” count as the same type. Enable case-sensitive analysis only when capitalization itself is relevant to the question. Keep those settings identical across every sample, record the total token counts, and interpret small score differences cautiously, particularly when the passages are short or differ greatly in subject matter.

Use the result in a repeatable workflow

A reliable workflow begins with a clearly defined sample. Decide whether headings, citations, speaker labels, numbers, and boilerplate belong in the analysis before submitting the text. Removing those elements from one sample but retaining them in another changes both the numerator and denominator. Run each prepared passage with the same case-sensitivity setting, then save all four returned fields: total tokens, distinct types, type-token ratio, and the applied case rule. These values make the result auditable and easy to reproduce. The browser version is convenient for individual checks, while the API suits batches, editorial dashboards, classroom tools, and research preprocessing. The calculation is deterministic and does not send text to an AI model, so identical input and options produce identical output. If sample lengths cannot be controlled, report that limitation or supplement TTR with a length-aware lexical-diversity measure. Most importantly, interpret the number in context: a lower ratio can reflect necessary terminology, coherent topic focus, quoted material, or repeated dialogue rather than weak vocabulary.

Compare writing samples

Measure equally sized drafts with consistent settings to examine how vocabulary repetition changes across versions.

Analyze transcripts

Add a transparent lexical-variety measure to interview, classroom, meeting, or research transcript workflows.

Audit content collections

Process articles or product descriptions in batches and flag unusually repetitive items for human review.

How is type-token ratio calculated?

The number of distinct word types is divided by the total number of word tokens, and the result is rounded to six decimal places.

What does a high type-token ratio mean?

It means a larger share of the tokens are unique within that sample. It does not by itself prove that the writing is better or the vocabulary is more advanced.

Why should texts have similar lengths?

Longer texts naturally provide more chances for words to repeat, which generally lowers basic TTR. Similar sample lengths make comparisons more informative.

Does capitalization affect the result?

Not by default. Set case_sensitive to true when forms such as “Apple” and “apple” should count as separate types.

How are words identified?

Unicode letter and number sequences are tokens. An internal straight or curly apostrophe remains part of a token, while surrounding punctuation acts as a separator.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/str/type-token-ratio

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/str/type-token-ratio \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The quick brown fox jumps over the lazy dog. The fox rests."}'
{
  "text": "The quick brown fox jumps over the lazy dog. The fox rests."
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.type_token_ratio",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_chars1000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →