Rita, me, and computational literature

Haikus were a big thing at Automattic. I got to liking them and enjoyed reading their bits of wisdom throughout the internets. These quick little quips of text could spark a whole rabbit hole of thought. And as many computational designers have done before me, I set out to build my own haiku generator.

See the Pen Click for a haiku by Mapk (@mapk) on CodePen.


The first thing that I came upon was a niche of AI writing and computational literature. In fact, in 2016, there was a case in which an AI written novel almost won a literary award. I was hooked. Searching for others in this arena was not difficult. I came across Allison Parrish’s site and explored all those nuggets of gold. After reading quit a bit, I found Rita.

Rita is a software toolkit for computational literature, and it is open source! The website provides an offering of tutorials and documentation. Without digging too deep, I just wanted to get some words onto a screen. That is where the JavaScript library came in handy. I opened up a Codepen.io pen and began trying it out.

I am an avid fan of p5.js and fortunately for me, I saw some documentation on how to sync up my p5 canvas with Rita. With that bit of help, I was able to get up and running.

While I could get the words to display on the screen, I needed to coerce the sentence syntax into something readable. This required a few edits of inserted text to make the haiku jive smoothly. It ended up looking something like this.

the _____ _____ 
_____ in the _____ _____
I _____ ______

The underlined spaces were where Rita would fill in the appropriately syllabized words.

The project was enjoyable, and I would like to create further works using computational text. I am sure something like this can lead to a published novel. But for that, I will need to learn more about analyzing text and enforcing proper grammar and literary devices for such an endeavor.

You have reached the end
Now begin again


Rita on GitHub