April 4, 2008
Process of “The IBM Poem” by Emmett Williams
Chris Funkhouser is author of the excellent volume Prehistoric Digital Poetry, which I hope to write about at greater length before too long. He told us today during the Codework workshop at WVU about Emmett Williams’s “The IBM Poem,” a 1966 computationally-generated poem and system for generating poems. I can find little information about this poem on the Web – certainly, not the specification of how the generator works, which Funkhouser was kind enough to hand out to us on paper.
Here is a partial implementation (Update: a complete implementation; my earlier version is still available) of the poem-generating process in Python which I just wrote up. You may modify or do anything you like with this. I dedicate this program to the public domain as described in the linked document. I’ve uploaded a text file containing the program that also appears in this post, below.
# IBM Poem Generator, complete version, nm, 4 April 2008 # This version is a complete model of Emmett William's process in # generating "The IBM Poem," as I understand it, except that, being a # console program, it does not increase the size of the type as words # are re-used. # That could be done, too - for instance, if the output were in HTML # with CSS. vocab = [''] * 26 def expand(word): # A general method to expand a sequence of letters into words expanded = [] for letter in word: expanded.append(vocab[ord(letter) - 97]) return expanded print "Provide a word (a sequence of letters) for each letter from a to z." # Get a vocabulary word (the user types one "at random") for each letter a-z for i in range(26): anyword = '' while anyword == '' or not anyword.isalpha(): anyword = raw_input(chr(97+i) + '=') vocab[i] = anyword.lower() # Ask for "IBM" or another three-letter word or acronym tlw = '' while len(tlw) <> 3 and not tlw.isalpha(): tlw = raw_input('Provide a 3 letter word or phrase: ') tlw = tlw.lower() seed = [tlw] print # Expand three times, printing along the way: # 0. Three-letter word into title # 1. Title into three lines # 2. Each of the three lines into as many lines as there are words newseed = [] for i in range(3): for word in seed: words = expand(word) line = ' '.join(words) print line if i == 0: print newseed += words seed = newseed newseed = []
A sample run (thanks to Rita Raley):
a=dog b=run c=cat d=flower e=battle f=falluja g=bush h=toggle i=algorithm j=banana k=papaya l=hawaii m=saint n=fork o=paper p=pencil q=computer r=brick s=nick t=flick u=link v=cup w=coffee x=tea y=mustard z=floor flower paper bush falluja hawaii paper coffee battle brick pencil dog pencil battle brick run link nick toggle falluja dog hawaii hawaii link banana dog toggle dog coffee dog algorithm algorithm pencil dog pencil battle brick cat paper falluja falluja battle battle run dog flick flick hawaii battle run brick algorithm cat papaya pencil battle fork cat algorithm hawaii flower paper bush pencil battle fork cat algorithm hawaii run dog flick flick hawaii battle run brick algorithm cat papaya brick link fork hawaii algorithm fork papaya fork algorithm cat papaya flick paper bush bush hawaii battle
Please feel free to not only leave comments of the traditional sort, but to also drop us any interesting code modifications or poems that you’ve generated.