HomeData ScienceZipf's Law 2D: Rank-Frequency Plot Explorer

Zipf's Law 2D: Rank-Frequency Plot Explorer

Interactive 2D log-log plot of Zipf's law in language: sample a synthetic Zipfian corpus, watch the live least-squares power-law fit, overlay real pasted text, and pan/zoom the rank-frequency plot alongside a cumulative-coverage (Lorenz) chart.

Data Science2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-natural-language-processing-data-science-2 ↗ Open standalone

Every large body of natural-language text obeys a strikingly simple pattern: if you rank its words by how often they occur, frequency falls off as a power of rank, f(r) ≈ C / r^s, with s close to 1. This simulator makes that pattern tangible by generating a synthetic corpus from an explicit Zipfian probability table — draw N tokens from a vocabulary of V words weighted by 1/r^s — and plotting the resulting rank/frequency counts on a pannable, zoomable log-log chart, where a true power law shows up as a straight descending line. A second series tokenizes whatever text you paste into the box, counts real word frequencies, fits the same log-log line live, and overlays it in amber next to the synthetic teal series, while a companion cumulative-coverage chart shows how few distinct words are needed to account for half of all tokens.

⚙ Under the hood

Interactive 2D log-log plot of Zipf's law in language: sample a synthetic Zipfian corpus, watch the live least-squares power-law fit, overlay real pasted text, and pan/zoom the rank-frequency plot alongside a cumulative-coverage (Lorenz) chart.

nlpzipf's lawlinguisticspower lawdata sciencetext statistics

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)