Current word Start / End Vocabulary word
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

N-Gram Language Model: Live Perplexity & Text Generation

Computational linguistics turns language into numbers so a machine can predict, generate and score text. This simulator builds a real bigram language model in your browser: it counts word-pair frequencies in a small training corpus, smooths them with the add-k (Laplace) method so unseen pairs still get a probability, and then walks a 3D graph of the vocabulary — each hop sampled from the model's own next-word distribution. Two live metrics track the model honestly: perplexity of the text it is currently generating, and held-out perplexity of a fixed test sentence the model never trained on. Switch corpus, smoothing and temperature to see, numerically, how each one reshapes what the model predicts.