Archived entries for Reading and Writing Electronic Text

Circumstantial Decision Making

Generative poetry is concerned not only with processing text but with selecting source texts to process. This curatorial gesture is of equal importance to the way in which material is handled. For my final project in Reading and Writing Electronic Text, I decided to introduce elements of circumstance into the selection of original texts—specifically, local weather conditions. Circumstantial Decision Making is a program for generating new poems based on the current direction of the wind.

In its present form, the script accesses a regularly updated database of weather variables to determine which of nine texts to process. If the wind is blowing north, it will select the text assigned to the top row, middle column. If the wind is blowing southeast, it will select the text assigned to the bottom row, right column and so on. The ninth text corresponds to “variable” wind conditions. Once selected, the program performs a basic randomization of that text’s lines, often resulting in new and interesting juxtapositions.

It’s intriguing to me how circumstance influences the decision making process in various ways—from what we eat to where we go to school—and this program is one way of exploring those dynamics through poetry. Here is a selection of poems generated with Circumstantial Decision Making from original texts by Sachiko Clayton.

I.
The tangled telephone cord’s
one strand, 1,722 yards long.
All the power lines have fallen,
no dial tone, but she was gone.

How many times could I

We’ll speak again,
stretched ours out as kids at home,
that dropped call two weeks ago,

the cord’s been cut at the stem
I think of it’s single strand:
Stretched out, stretched thin
I wonder if when I’m done
as I pull at the knots.
We’ve given up on telephone cords,
Knitting a blanket for my sister’s first son,
across Long Island
from Queens to Suffolk County.
She wrapped it around my wrists
of my tin can.
or drop threads of all conversations
so I’d leave her alone.
Another blue line in the blanket,
exposed wires prick
wrap it around her shoulders?
Language frays and unravels.
like the lost stitch, third row down,

II.
Coins from India, Namibia, Japan and England,
a lacy handkerchief, starched, cotton white,
like a tiny curled hand.
of a bulldog in the Union Jack.
Cameo from your jewelry box
pages of Agatha Christie, a back scratcher
laces from 15-hole docs,
tie tacks, cuff links, your college class ring,

two of your favorite ties.
Your first CD, INXS, argyle socks, red suspenders,

(butter scotch on my tongue)

My glue gun, a wine box, an undated photograph.
the t–shirt brought back from England

III.
The sound of your humming
watching your knuckles
Where are we?
I never asked;
on the steering wheel,
to Saint Augustine.
blue from radio glow,

you and me,
from Jamaica, Queens
A halo of sleeping breath,
and the road pulling you along,
Who’s that on the radio?
awake in the dark;
and highway sign light,
listening to your thoughts,
Mom and Ne-chan sleeping,

I-95 dreams.
a long asphalt conveyor belt;
The sound of the road pulled,
in time with Ray Charles.
Just sat with you, waiting,
the high moon.

IV.
September has been an empty month
Punctuated by a nod or a gesture.
Flow of life
A quarrel in August interrupted this
And the industry of beavers built a dam
I remember the mornings you came by,
And the dead remains of summer.
Random and continuous
Packed with your papers
Sometimes streaming from your mouth
Devoid of the normal clutter of dead leaves
Satchel in hand and bustling thoughts
And scattered papers.

And here is the Python code.

# Circumstantial Decision Making

import sys
from BeautifulSoup import BeautifulStoneSoup
import urllib
import random

# Lists for each outcome
verse_NE = list()
verse_NW = list()
verse_SE = list()
verse_SW = list()
verse_N = list()
verse_S = list()
verse_E = list()
verse_W = list()
verse_V = list()

# Change this URL for different places
place_url = "http://www.weather.gov/xml/current_obs/KNYC.xml"

# Gather weather data
place_data = urllib.urlopen(place_url).read()
place_soup = BeautifulStoneSoup(place_data)

# Identify wind direction
place_current_tag = place_soup.find('current_observation')
place_wind_tag = place_current_tag.find('wind_dir')
place_wind_dir = place_wind_tag.string
direction = place_wind_tag.string

# Northeast
if 'Northeast' in direction:
  for line in open('frayed_conversation.txt'):
    line = line.strip()
    verse_NE.append(line)

  random.shuffle(verse_NE)

  for line in verse_NE:
    print line

# Northwest
elif 'Northwest' in direction:
  for line in open('like_cindy_sherman.txt'):
    line = line.strip()
    verse_NW.append(line)

  random.shuffle(verse_NW)

  for line in verse_NW:
    print line

# Southeast
elif 'Southeast' in direction:
  for line in open('mothers_hands.txt'):
    line = line.strip()
    verse_SE.append(line)

  random.shuffle(verse_SE)

  for line in verse_SE:
    print line

# Southwest
elif 'Southwest' in direction:
  for line in open('mottainai.txt'):
    line = line.strip()
    verse_SW.append(line)

  random.shuffle(verse_SW)

  for line in verse_SW:
    print line

# North
elif 'North' in direction:
  for line in open('my_father_driving.txt'):
    line = line.strip()
    verse_N.append(line)

  random.shuffle(verse_N)

  for line in verse_N:
    print line

# South
elif 'South' in direction:
  for line in open('september.txt'):
    line = line.strip()
    verse_S.append(line)

  random.shuffle(verse_S)

  for line in verse_S:
    print line

# East
elif 'East' in direction:
  for line in open('shadow_box_family_portrait.txt'):
    line = line.strip()
    verse_E.append(line)

  random.shuffle(verse_E)

  for line in verse_E:
    print line

# West
elif 'West' in direction:
  for line in open('what_did_you_wear_last_night.txt'):
    line = line.strip()
    verse_W.append(line)

  random.shuffle(verse_W)

  for line in verse_W:
    print line

# Variable
else:
  for line in open('yellow_and_contrary.txt'):
    line = line.strip()
    verse_V.append(line)

  random.shuffle(verse_V)

  for line in verse_V:
    print line

New York & Detroit Weather

It’s mostly cloudy in Detroit, overcast in New York.

This is a simple program that reads XML data from the National Weather Service to construct a statement comparing weather conditions in New York and Detroit. While the results of this exercise are plain, there is much potential in exploring this kind of functionality to compose poems with live data or even pass it along to other programs.

Here is the Python code, which makes use of the excellent Beautiful Soup library for parsing HTML and XML.

from BeautifulSoup import BeautifulStoneSoup
import urllib

dtw_url = "http://www.weather.gov/xml/current_obs/KDTW.xml"
jfk_url = "http://www.weather.gov/xml/current_obs/KJFK.xml"

dtw_data = urllib.urlopen(dtw_url).read()
jfk_data = urllib.urlopen(jfk_url).read()
dtw_soup = BeautifulStoneSoup(dtw_data)
jfk_soup = BeautifulStoneSoup(jfk_data)

dtw_current_tag = dtw_soup.find('current_observation')
jfk_current_tag = jfk_soup.find('current_observation')
dtw_weather_tag = dtw_current_tag.find('weather')
jfk_weather_tag = jfk_current_tag.find('weather')
dtw_condition = dtw_weather_tag.string
jfk_condition = jfk_weather_tag.string

print "It's " + dtw_condition.lower() + " in Detroit, " + jfk_condition.lower() + " in New York."

Mystic Chiasm

For our midterm project in Reading and Writing Electronic Text, I drew from nineteenth century Catholic mysticism. The assignment had two parameters:
• Devise a new poetic form.
• Create a computer program that generates texts that conform to the poetic form you devised.

I decided on a formal/semantic approach incorporating the poetic verse of Thérèse of Lisieux as source text. A Carmelite nun from the age of 15, St. Thérèse’s short life was characterized by deep devotion and prolific writing. My program arranges nine randomly selected lines of her poetry in a chiastic structure: A B C D E D C B A. Because of the mystical and devotional qualities of Thérèse’s text, the content of the poems is designed to move from human beings to the Divine and back again. As such, the A lines always contain some reference to “I,” “me,” “we,” or “us” while the central E line always contains a reference to God such as “Father,” “Son,” or “Spirit.” This collaboration results in countless variations of poetic text with new interpretations revealed in each cycle.

Here is a selection of poems generated by the program, Mystic Chiasm.

I.
I love the fires of dawn,
  Do angels seek my home
    And give myself, in sacrifice unpriced,
      How cool this verdant grove,
        To offer Lord, to Thee.
      Sister! form apostolic souls,
    To Hope, the voyage seems one little day;
  Helped here by me, shall conquer souls;
My peaceful home,—to fight. Forgive me, if I fear!

II.
For us from Heaven didst Thou flee;
  I crave, I crave, the hearts of men.
    I wait in peace, on time’s dark coast,
      I give my joys, my tears,
        Thou tiny Jesu, Light of Light!
      Thy ecstasy the Blest exult to see.
    From His high court on His eternal hill;
  Remember that Thine eyes beheld the fields
To those who loved me best, so dear, so true, so kind,

III.
And willingly I go,
  Yet for the rose of penitence
    Upon your throbbing heart shall lie,
      Go, catch for Him some charming birds,
        For pain to Thee, my Jesus! was so dear
      To Thee I sacrifice my joy, my eighteen years.
    Then you will be greatly blest.
  I can not help but think,—oh! let me tell my thought!
We have come down from heaven’s eternal height,

IV.
How shall I find relief
  In Thee, the glorious stars are mine;
    So, in my turn, my love to Thee is given,
      Thou art the lovely Flower of spring,
        E’en now to suffer, Love is urging Thee.
      When, pressing on through heaven’s gate,
    When Joseph came to bid thee wake, and straightway flee from home;
  In ecstasy would fain each seraph undefiled
Jesu! may I expire

And here is the Python code.

import sys
import random
import re

verse = list()
person = list()
divinity = list()

for line in sys.stdin:
  line = line.strip()
  verse.append(line)
  if re.search(r'\bI\b|\b[Mm]e\b|\b[Ww]e\b|\b[Uu]s\b', line):
    person.append(line)
  if re.search(r'\bFather\b|\bSon\b|\bSpirit\b|\bThee\b|\bThou\b|\bJesus\b|\bChrist\b|\bLord\b', line):
    divinity.append(line)

print random.choice(person)
print "  " + random.choice(verse)
print "    " + random.choice(verse)
print "      " + random.choice(verse)
print "        " + random.choice(divinity)
print "      " + random.choice(verse)
print "    " + random.choice(verse)
print "  " + random.choice(verse)
print random.choice(person)

Random Inflation

January, the Labor Department said,
everything from rent to cigarettes —
downward trend: it fell 0.1 percent in
when to raise the crucial short-term
benchmark interest rate, for instance —
normalize lending! The cost of living
increasing only 0.2 percent! A closely
January, the first decrease since 1982.
scaling back emergency measures to
consumer prices suggested that
were still a way off! A report on
government data on Friday reinforced
food and fuel costs underscored the
extraordinarily low interest rates.
That should ease some of the pressure
watched measure that excludes volatile
inflation appeared to be largely in
with the price of a variety of goods —
tighten monetary policy — raising the
check, despite a period of
support the economy, the latest
the notion that more drastic efforts to
on Fed policy makers as they consider
in the United States remained steady in
While the Federal Reserve has begun
interest rate and take smaller steps to

Source text: U.S. Inflation Report Gives Fed Breathing Room on Rates, The New York Times

Python code:

import sys
import random

all_lines = list()

for line in sys.stdin:
  line = line.strip()
  line = line.replace('. ', '! ')
  all_lines.append(line)

random.shuffle(all_lines)

for line in all_lines:
  print line

Statefinder

state so as to possess it in a
state as things which have become the exclusive value by their
state power personalizes itself as a
state power in mixed backward
state of
state power, foreseeing the reconstitution
state of affairs which is at the heart of the domination of the modern
state monopoly over
state would have to be kept from workers as well, which led to
state of siege
state and
state power it had built to emancipate itself, it
state power, in turn subdivided in the
state administration
state administration
state bureaucracy, its apathy must now be historically
state of the people?
state of affairs—and here all communication is joyously

Source text: Society of the Spectacle, Guy Debord

Python code:

import sys

for line in sys.stdin:
  line = line.strip()
  offset = line.find(" state ")
  if offset != -1:
    print line[offset+1:]


Subscribe via RSS. Process is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States license.

This blog is powered by WordPress and based on Modern Clix. Web hosting by Media Temple.