💾 Archived View for rwv.io › 2022-12-29-markov.gmi captured on 2023-01-29 at 02:30:56. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Using markov chains to generate gibberish

A couple of weeks ago I was playing with Haunt to see if it was an good candidate to replace Jekyll for a couple of websites I host.

Haunt project page

Jekyll project page

Playing around with it, I wanted to generate some text and started porting some code I wrote in Clojure to Guile Scheme. It's a basic implementation of Markov Chains; analyze input to record the likelihood some term(s) are followed by other terms and use those statistics to generate data at random.

Clojure markov repo

Scheme markov repo

This holiday season I wondered how hard to would be to make it run in Racket and produce some content for this capsule. Turns out the common ground between Racket and Guile is R6RS. Long story short, this capsule can now Lorem Ipsum into infinitum! Freshly generated for you:

Lorem Ipsum

I have no knowledge of Latin but I am pretty sure the result is very bad (but good enough as filler text). But we can do better than that! With a bigger text and a "look back" of 3 words we can generate stuff that sounds like it came from a very famous book (my apologies to fans of this book for being inappropriately playful):

Biblish

Again freshly generated on every visit.

Cheers,

R.

--

📅 2022-12-29

🏷 floss

📧 hello@rwv.io

CC BY-NC-SA 4.0