All demos

N-Gram Builder

Graph lab

Turn a small text into a word generator

An n-gram generator begins with observations: count what occurs, turn the counts into probabilities, then use those probabilities to choose the next word.

Try this
  1. Read the small text and fill in the count table.
  2. Check the counts, then read the automatically created probability table.
  3. Choose a start context and generate words from the table.

1 Start With A Small Text

Training data
From counting to generating

Begin with a short text and count the words that appear. Once the counts are right, the same table can become a probability table for choosing generated words.

2a Build The Count Table

Enter how many times each observed word or n-gram appears in the text. Use Check Counts to unlock the probability step.

Observed counts
N-gramYour countResult

2b Convert Counts To Probabilities

Probability table
Start contextGenerated wordCountProbability

3 Generate Words

Generation repeatedly chooses one row from the probability table. Most Likely always picks the biggest probability; Weighted Random samples using the probabilities.

Generated text