render_example_test.gno
1.25 Kb · 39 lines
1package markovdemo
2
3// ExampleRender pins the realm's Render output as a gno testable example.
4func ExampleRender() {
5 print(Render(""))
6 // Output:
7 // # Markov Babbler
8 //
9 // A demo of the [`p/moul/x/daily/markov`](/p/nym-moultest123/x/daily/markov/v0) library — an on-chain port of Go's classic *"Generating arbitrary text: a Markov chain algorithm"* codewalk. Every two-word **prefix** maps to the words that followed it; `Generate` walks that chain, picking suffixes with a PRNG seeded by the block height — deterministic, yet different each block.
10 //
11 // ## Fresh sample (40 words, height 123)
12 //
13 // > it was the age of foolishness i am the master of my soul
14 //
15 // ## Corpus
16 //
17 // - **Words:** 48
18 // - **Distinct prefixes:** 33
19 // - **Prefix length:** 2 words
20 //
21 // ## Some prefixes → suffixes
22 //
23 // | prefix | can be followed by |
24 // |---|---|
25 // | `_(start)_` | it |
26 // | ` it` | was |
27 // | `a free` | man |
28 // | `a number` | i |
29 // | `age of` | wisdom, foolishness |
30 // | `am a` | free |
31 // | `am not` | a |
32 // | `am the` | master, captain |
33 // | `best of` | times |
34 // | `captain of` | my |
35 // | `fate i` | am |
36 // | `foolishness i` | am |
37 //
38 // _Call `Feed("your text here")` to teach it new words, then reload for a new sample._
39}