RWET: Midterm

For my midterm, I was interesting in trying to combine a computer/procedural process with an analog process.  I also wanted to use a source text, as most of the work I have been thinking about for this class and many of the class examples use sources texts, but I wanted that source to be more apparent, if not more recognizable.  For my Python program I had imagined a sort of “assonance machine”—it would read through a text and print only the words that had vowels appearing in pairs, so something like “and a good boot” would work, while “the good boot” would not.  Simple modifications to the program could return more than pairs, or change the letters that have to match, so it could become an alliteration machine.  The program itself is fairly simple, less that 70 lines.  The resulting text are kind of funny and nonsensical, but I think the procedure is fairly evident.  Here’s the code:

# midterm 3

import sys
args = sys.argv
import re

# take in a file
txt_file = args[1]

# read file
txt = open(txt_file, 'r')
txt_lines = txt.readlines()

# return only words in a sequence where each vowel is
#repeated twice "good bet eat apple eat a"
# why?  i don't know
key = ""
tempKey = ""
firstWord = 0
keySet = 0
tempKeySet = 0
wordSet = 0
notWord = 0

# break through lines
for line in txt_lines:
	thePoem = ""
	line.strip()
	#split words
	words = line.split(" ")
	#go through words
	#print words
	for word in words:
		#go through letters
		tempKeySet = keySet
		for letter in word:
			if re.search(r"[aeiou]", letter.lower()):
				if notWord == 0:
					if keySet == 0:
					# find the first vowel
						tempKey = letter.lower()
						keySet = 1
						wordSet = 1
					else:
						if letter.lower() == tempKey:
							keySet = 0
							wordSet = 1
						else:
							wordSet = 0
							notWord = 1
							tempKey = key
							keySet = tempKeySet							

				#print "*"+key, keySet

		#	else:
		#		print letter

		if wordSet == 1 and notWord == 0:
			#print word
			key = tempKey

			#print key
			wordSet = 0
			thePoem += " " + word
			if firstWord == 0:
				firstWord = 1
		else:
			notWord = 0
			wordSet = 0
			if firstWord == 0:
				keySet = 0
				firstWord = 1

	print thePoem

I have a box in my room where I throw books that I intend to give to good will, but it rarely gets emptied.  Because I wanted to use an analog process, I looked through the books to see which I could find ebook version of.  I then ran the program on these texts to see which gave the most interesting results.

from The Power of Positive Thinking (page 1)

What Can Do for
THIS IS to to which mind, and a never flow of energy. In life be full human
many the They go through dull resentment they the breaks” has them. sense there be such but there is spirit which we even breaks. a pity it is
In this I do not or of the them to You thus the them from to to power methods not to your

from Blood Meridian (page 3-4)

runs away. He see the freezing in the predawn dark. The the He west as far as a that flat and Blacks in fields, their fingers the bolls of cotton. A agony moving in the the bottomland
A he He is
river. the hoot and past the They up lumber he walks and he heard a room a a and at night like beast has big wrists, big His set The child’s is the the eyes oddly bottles breeds. Men speech the Men from so far and that standing lie the mud

just the heart. man flees and bar with his shirt.
while he sits in the
He in in the weeks the him. brings his his slops. woman a wiry like the he mended he has pay her he in night and can find will him is to
Only now of all that he been. destiny in all and to of may shaped whether heart clay. The

(Cormac McCarthy probably wasn’t the best choice given his affinity for monosyllabic words, though keep in mind, these are books I was intending to get rid off in the first place, so they’re either books I don’t like or in a couple instance books I somehow have two copies of.)

I also tried Waiting by Ha Jin, but the translation is very literal and so there are a lot of little words and few big ones—nothing worth remembering here.  I tried instead running the alliteration machine on and got more interesting, if not totally satisfying results.

1
Does she hate
the he an an of fill up puttees.

2
year
room.
middle life. For or he

3
Done in To
the head died
do you

4
dove
even on, or or in
in Mai more
rule line

Then I started experimenting with different alliterations.  I ran the alliteration machine with only the letter L on Cormac McCarthy.  More interesting results:

Leonids called. fall. looked blackness, holes
would child world will pale
already mindless violence.
All child
will solitary flat pastoral landscape. Blacks fields, lank spiderlike bolls declining slower skyline. lone mule rainblown bottomland
later Louis. Orleans flatboat.

But I’m still finding that its impossible to really use the text in a way that mangles it to the extent the mood and aesthetic of the earlier text are unrecognizable.  The process is interesting because the fewer letters that are available to make doubles of, the more words are actually available.  If you use the entire alphabet its very difficult to use any words, you only find sections like “on on” and “an an.”  But having fewer letters also makes it more obvious which letters are repeating, which can be good or bad.  Here’s a poem generated by randomly typing letters into the machine and running Do Androids Dream of Electric Sheep through the algorithm:

you’ve never any as money rose, strode one A and me years.” At for of a make enough the
eyes open and same.
see every seem see; me.” rose
enough his suit.
for

I decided to start the actual project with the Jerzy Kosinski novel, The Devil Tree.  I’ve had a copy of it for like three or four years and I’ve never read it.  I don’t know why I bought it, I vaguely remember getting it at a Housing Works sidewalk book sale one summer.  It’s an interesting choice because Kosinski was accused, and probably guilty, of plagiarism, though the extent of which he borrowed materials is unknown.  He definitely brings into question the concepts of authenticity and authorship with his works.  I think his language lends itself to the project as well, because he uses a very New York vernacular of a certain time, so there’s some character, but it isn’t overly simple or over wrought.  It works well visually because the descriptions of New York are evoked by the line drawings which take the form of the paragraph contours.

I also created a program that makes sure the machine worked by taking out all the vowels and making sure they appear in pairs.  It ended up being kind of pointless because the original code works.  Here’s that code:

# check to see if midterm code worked on a text

import sys
import re

bigAssString = ""

for line in sys.stdin:
	line.strip()
	words = line.split(" ")
	for word in words:
		for letter in word:
			if re.search(r"[aeiou]", letter.lower()):
				bigAssString += letter.lower()

#print bigAssString
keyer = 0
key = ""				
for letter in bigAssString:
	#print letter
	if keyer == 0:
		key = letter
		keyer = 1
		
	else:
		if letter == key:
			keyer = 0
		else: 
			print('fucked up!!')
			sys.exit()

 

Advertisements

Author: owen ribbit

poop

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s