August 27, 2011


"Mama, can I cut myself a slice of bread?" says my stepdaughter Sharlotte, trying to get a snack before dinner.

I chuckled, because my brain placed inappropriate line breaks in her sentence, which in my head immediately portrayed her as a neo-emo-L=A=N=G=U=A=G=E poet.

She got her bread, and I got to checking out Nick Montfort's incredibly creative website about how to best turn this benign sentence into something a little more provoking.

I knew enough Python and Javascript to lift some ideas from Mr. Montfort's The Two, and was able to create some generative poetry based on Sharlotte's sentence.

Essentially, I was able to create 3-line-stanza slices, which in turn are formed by slices of Sharlotte's original sentence. Sure, there are only 3*3*3 possibilities here, and don't necessarily necessitate a computer script to find them all, but I enjoy watching the computer display these different slices at random, each with their own meaning depending upon how the sentence is sliced.

So, I am able to offer you a computer-generated poem called "Slices" in two forms: Python for those who know, and Javascript for those who wish to view it in their browser (Since I cannot afford proper web hosting, you'll have to download the .html page before you can view it. Sorry.).

Here is the Python code for those just wanting to view it, get an idea of its structure, or if you are like me, find it easiest to just copy and paste it:

# Slices
# Sonny Rae Tempest & Sharlotte Higgs

from random import choice
from time import sleep

slices=['Mama','can I cut myself','a slice of bread']

while True:
print ('\n'+choice(slices)+'\n'+choice(slices)+'\n'+choice(slices))


1 comment:

  1. Very cool... poetry is everywhere... and you know how to recognize it, generate it, configure it... and how to make it super computo-geeky cool! :)


Note: Only a member of this blog may post a comment.