Paste any text to see word frequency, bigram, and trigram distributions instantly.
An n-gram is a contiguous sequence of n items (usually words) from a text. Unigrams are single words, bigrams are two-word sequences, trigrams are three-word sequences. N-gram frequency analysis was the backbone of statistical NLP for decades before neural language models became dominant, and it remains genuinely useful today for corpus analysis, keyword extraction, and understanding the statistical structure of text.
Type-Token Ratio (TTR) divides the number of unique words (types) by the total word count (tokens). A higher TTR indicates more varied vocabulary, while a lower TTR indicates more repetition. TTR is sensitive to text length though, longer texts naturally tend toward lower TTR simply because common words get reused more as length increases, which is why corpus linguists often use TTR to compare texts of similar length, or use length-adjusted variants for texts of very different sizes.
Looking only at word frequency misses meaningful multi-word patterns, "natural language" as a bigram tells you something specific that "natural" and "language" as separate unigrams don't capture on their own. This is exactly why n-gram models were historically used for tasks like autocomplete and text prediction, given the previous n-1 words, what word is statistically most likely to come next, based purely on observed frequency patterns in a training corpus.
While transformer-based language models have largely superseded pure n-gram models for text generation, n-gram analysis remains a genuinely useful tool for exploratory text analysis, corpus comparison, keyword and phrase extraction for SEO, detecting formulaic or repetitive writing, and as a fast, interpretable baseline to compare against more complex models. It's also still used directly inside modern NLP pipelines for tasks like BLEU score calculation (which is fundamentally an n-gram overlap metric) and building simple search indexes.