N-gram Extractor

An n-gram is a contiguous sequence of n words from a text. This extractor lowercases your input, splits it into words at every space and punctuation mark, and counts each n-gram of the length you pick (1 to 8). The result is a CSV frequency table sorted from most to least common: the sort of table that powers SEO keyword-density checks, language-model smoothing and plagiarism detection alike.

How to extract n-grams

  1. 1

    Paste your text

    Drop in an article, transcript or product copy. No length limit for reasonable input.

  2. 2

    Choose n

    Unigrams (1), bigrams (2), trigrams (3) and up to 8. One length per run.

  3. 3

    Extract

    The text is lowercased and split into words; punctuation is treated as a separator and dropped.

  4. 4

    Read the frequency table

    Each n-gram appears with its occurrence count, sorted by frequency, most frequent first.

  5. 5

    Copy the CSV

    The output is comma-separated (N-gram,Count), ready to paste into a spreadsheet.

What each n-gram length tells you

N Name Use case
1 Unigram Keyword density, topic mapping
2 Bigram Phrases (“search intent”, “page speed”), collocations
3 Trigram Long-tail phrases, feature detection
4+ Four-gram and up Duplicate content detection, plagiarism flags

How this tool splits your text

  • Everything is lowercased, so “The” and “the” land in the same row.
  • A word is any run of letters, digits or apostrophes. Every other character (punctuation, symbols, line breaks) is a separator and is dropped.
  • Sentence boundaries are not preserved. The last word of one sentence and the first word of the next can still form an n-gram, so treat cross-sentence pairs with caution. If that matters, analyse one sentence or paragraph at a time.
  • Stopwords are kept. Nothing is filtered out for you; remove those rows from the CSV afterwards if you only want semantic phrases.
  • Words are found by spaces and punctuation. This means the tool counts word n-grams for languages that separate words with spaces. Chinese, Japanese and Thai do not: an unspaced run of characters arrives here as a single word. Segment that text first (with a tokeniser such as jieba, MeCab or a Thai word breaker, so the words end up space-separated) and then paste the result.

When to strip stopwords

Stopwords are high-frequency function words like “the”, “a”, “of”, “and”. Leaving them in inflates the bigram list with junk like “of the” and “in a”. This extractor keeps them, so delete those rows from the export when you want semantic phrases, and leave them in when you are studying style, classical authorship, or language models where function words carry signal.

SEO use case

For an article targeting “nginx config generator,” check:

  • Your target bigram and trigram appear in the top 20. If “nginx config” is rank 40, you are probably under-using the term.
  • You are not stuffing. If it is rank 1 by a huge margin, the piece reads like spam.
  • Semantic neighbours exist. Related bigrams like “server block”, “proxy pass” and “ssl certificate” reassure search engines the topic is covered.

NLP and academic use

  • Language models use n-gram frequencies for smoothing and backoff (Kneser-Ney, Good-Turing).
  • Authorship studies compare trigram distributions across candidate authors.
  • Machine translation evaluation (BLEU) scores n-gram overlap between candidate and reference translations.

Frequently Asked Questions

Anything from a tweet (where n-grams are barely meaningful) to a book chapter. For statistical reliability on bigrams, 1,000+ tokens; for trigrams, 10,000+. Below that, rankings are noisy.

Not here. The text is always lowercased before counting, so “The” and “the” (or “Apple” and “apple”) share one row rather than splitting into two. There is no case-sensitive mode: if you need proper nouns or code kept distinct, mark them in the text before you paste it.

They act as word separators and never appear inside an n-gram. They do not, however, cut the sliding window: the last word of one sentence and the first word of the next are still counted together as a bigram. Run sentences or paragraphs through separately if you need strict sentence boundaries.

Only if you segment the text first. Words are detected as runs of letters and digits between separators, and those languages are written without spaces between words, so a whole unspaced sentence arrives as a single word. Run it through a segmenter (jieba, MeCab, a Thai word breaker) so the words end up space-separated, then paste the result here.

The tool does not apply one, so you filter after export. The most common English stopword list is the 179-word NLTK set, used by most SEO tools. Snowball, SpaCy and scikit-learn ship slightly different lists. For multilingual text, use language-specific lists.

Related Tools

Tool available in other languages