Realm

gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/markov

Rendered output

Markov Babbler

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.

Fresh sample (40 words, height 605899)

it was the best of times it was the best of times it was the worst of times it was the worst of times it was the worst of times it was the best of times it was the best

Corpus

  • Words: 48
  • Distinct prefixes: 33
  • Prefix length: 2 words

Some prefixes → suffixes

prefix can be followed by
_(start)_ it
it was
a free man
a number i
age of wisdom, foolishness
am a free
am not a
am the master, captain
best of times
captain of my
fate i am
foolishness i am

Call Feed("your text here") to teach it new words, then reload for a new sample.

Query (read-only)

non-crossing functions · no tx, no wallet needed
Generate(nWords int) → string
Stats() → int, int

Call functions (state-changing)

signs a tx via Adena
Feed(text string)

All exported functions (4)

show raw signatures
NameParamsReturns
Feed [{"Name": "cur", "Type": "interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}", "Value": ""}, {"Name": "text", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
Generate [{"Name": "nWords", "Type": "int", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]
Stats [{"Name": ".res.0", "Type": "int", "Value": ""}, {"Name": ".res.1", "Type": "int", "Value": ""}]
Render [{"Name": "path", "Type": "string", "Value": ""}] [{"Name": ".res.0", "Type": "string", "Value": ""}]

Files

Storage

{
  "raw": "storage: 116771, deposit: 11677100"
}