N-gram Text Generator

Paste any text. We'll build a Markov chain dictionary from it, then use it to write brand-new text.

1 Your text

Try:

2 Settings

How many words to look back

3 Generate

How does it work?
  1. Split the text into words.
  2. Build the dictionary. For every word, write down the word that comes right after it. Repeats stay in, so a word that often comes next is more likely to be picked.
  3. Generate. Start with a word, look it up in the dictionary, pick a random word from its list, and repeat with the new word.

Looking back 1 word is a 1st-order Markov chain (a bigram model). Looking back 2 or 3 words makes the text sound more like the original, but it gets less creative.

📖 Dictionary