Tuesday, February 19, 2013


relating or moistened skipjack 
illegally brokerage fullback 
pictorial grasp 
utopian rasp 
hungarian sandwich comeback

methodically fishes restraint 
relinquishing threesome acquaint 
methodical psalm 
superiors calm 
essential successfully feint

In December and January I spent a lot of time working on a computer program that would automatically create limericks and other sorts of poems from random words. I call it the Autodadaist Limerick & Iambic Pentamabuilder. Short poems are now automatically posted twice daily at the Autopoetry Tumblr. Check it out!

The program was my first Python project, and I've had a lot of fun with it. I learned a lot of new things about programming language projects. The Autopoetry project uses a dictionary compiled from the CMU Pronouncing Dictionary, cross-referenced and edited for word frequency with the Brown Corpus. The CMU Dictionary contains (multiple) pronunciations for over 100,000 words, written in the Arpabet. This is what an entry looks like:


'R', 'AH0', 'F', 'R', 'IH1', 'JH', 'ER0', 'EY2', 'T', 'ER0'

'R', 'IH0', 'F', 'R', 'IH1', 'JH', 'ER0', 'EY2', 'T', 'ER0'

Each cluster of letters represents a single phoneme. There are two variant pronunciations for refrigerator. Each of the vowels ('AH', 'IH', 'EY', etc.) is appended by a 0, 1, or 2. This is information about whether that vowel carries primary, secondary, or no stress. So I wrote a Rhyme Generator class (under the supervision of my talented programmer buddy John Wood) that basically looks for the last stressed syllable of a word and all the phonemes that follow it, and then matches it with other words that have the same:

'G', 'R', 'EY1', 'T', 'ER0'  (greater)

'L', 'EY1', 'T', 'ER0'  (later)

So then I had to work on fitting the words into metered verse. I played around with iambs as a model, which is an easy model to get in your head (da DUM da DUM da DUM da DUM...). I used 1's and 0's in my program to represented stressed and unstressed syllables.

'twas bril-lig and the sli-thy toves
0        1      0   1     0    1   0    1

After some thinking, I decided that the general rules of a rhyme scheme are this: An unstressed syllable can go where stress is expected, but a stressed syllable cannot go where stress is unexpected.

This works:

re-frig-er-a-tors ma-ting on the plain
0    1    0  1  0     1     0     1    0    1

This doesn't work:

the re-frig-er-a-tors ma-ting on the plain
0    1   0     1  0   1     0     1    0    1    0

In the first example, the word 'the' contains stress and yet it sounds perfectly fine to relegate it to an unstressed position. The second example doesn't even sound like English: 'the RE-fri-GER-a-TORs' sounds weird because the unstressed syllables are forced into being stressed.

So the project contains an underlying stress pattern, which can be anything at all. I've experimented with limericks and iambic pentameter and song lyrics. A line is created by first picking a word, then finding a list of rhymes for it, and then working backwards by adding words and checking whether they fit the prescribed stress pattern.

No comments:

Post a Comment