larzmarkov
A small Markov-chain text generator, from scratch.
Trains a word-to-next-word chain from a corpus of lines, then generates new text by randomly walking it - the same core idea behind autocomplete and classic chatbots, in about 25 real lines. Zero network, zero deps - runs even on the bare-metal LarzOS kernel.
larzscript pkg install markov
What you get
- Real word-to-next-word chain training
- Random-walk generation over the trained chain
- Zero network, zero deps - runs on the bare-metal kernel too
- A genuine from-scratch look at how autocomplete works
Try it
import "markov" as markov let chain = markov.train(["the quick brown fox", "the lazy dog sleeps", "the quick dog runs"]) print(markov.generate(chain, 6))
Output
lazy dog runs
Why it's in the Larz Stack
larzmarkov is a real Larzscript package (larzscript pkg install markov) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.