project | Tue May 25 2021 00:00:00 GMT+0000 (Coordinated Universal Time)

Lyrics by Michael Styles and Harry Scott

Markov chain nonsense from the desk of Dwight, Michael and Harry

I’ve not watched The Office beyond 5 episodes, and I started listening to Harry Styles at the request of my friend. Given that these two things are not something I am particularly protective about or wary of desecrating, I found them to be the ideal candidates for a project I had in mind for a long time; creating shareable, auto-generated GIFs based on Markov Chains.

While a useless project in itself, I learnt a lot through the process. This had me collect data using a package I wrote , creating a script to generate Markov chains based on the entity (Michael, Harry or Dwight), using the GIPHY API to fetch a somewhat-relevant GIF and then combining these things into a neat email that would be sent to whoever signs up for 1 year.

via GIPHY

I used R for data collection and cleaning, and Python for automating the GIF generation using the GIPHY, markovify and Pillow libraries and for creating the HTML emails too.

The results are an amusing collection of silly GIFs (some of which are, er, questionable) shared via an automated newsletter. I’ve compiled the output into a website, go generate some nonsense!

Snippets

lyrical nonsense site
lyrical nonsense site
lyrical nonsense site