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
- Read the small text and fill in the count table.
- Check the counts, then read the automatically created probability table.
- Choose a start context and generate words from the table.
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.
Enter how many times each observed word or n-gram appears in the text. Use Check Counts to unlock the probability step.
| N-gram | Your count | Result |
|---|
| Start context | Generated word | Count | Probability |
|---|
Generation repeatedly chooses one row from the probability table. Most Likely always picks the biggest probability; Weighted Random samples using the probabilities.
Generated text