Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Photos Links Archives About

Python: Markov Chains


Back when I was still learning Python in 2008, one of the first “fun” scripts I wrote was a text generator using Markov chains. I’d run it against all the chat logs I had with people at work and serve the results from a webserver on my computer. THe results were often amusing and sometimes hilarious.

Since I’ve been going through my old scripts lately, I thought I’d update that script to Python 3 (read: add parentheses around print params and use pathlib) and run it against all the posts on this here site. I added the script to my deploy script for this site (thus further worsening my build times), so it should generate a new page every hour or so. I also added the generated markdown file to gitignore so it never gets saved to the repo. Every output of this script will be fleeting and ephemeral!

You can view the output here. You can view the script source here.

Posted by under post at / software development python / Syndicated: / 0 / 162 words

See Also

Roy Tang is a:

roytang.net is a personal site, an E/N site, and kind of a commonplace book; I post about a random assortment of topics that interest me including software development, Magic the Gathering, pop culture, gaming, and tech life. This site is perpetually under renovation.