Digital Writing with Python Assignment 4: Generative Facebook Status Updater

July 29, 2009

Our assignment this week was to write a Python program that extracts web text to provide input to a text generation/mungeing algorithm and generate a new remixed text.

I've had this fantasy lately about writing a Facebook status update generator that would spit out quirky updates that might inspire comments and relieve me of posting on a regular basis.

I was unable to find an RSS feed of other peoples' status updates; evidently, Facebook used to offer this, but now only lets you access your own. Thus, I linked to a live RSS stream of my own status data, exempted articles and pronouns to give the status some structure, and then randomly replaced unexempted words from word lists I found online. The result wasn't bad. I still have a long way to go, but I definitely did get some pithy updates out of it:

Chris Jennings: First bunch of wires my energy
Chris Jennings: First eliminator of chemistry my girl
Chris Jennings: Facebook: servo for trackers
Chris Jennings: Facebook: bundle for beans
Chris Jennings: BBC storms that Sartre was NOT a deserters
Chris Jennings: is knotting the mops to Apollo paces
Chris Jennings: First huts of meat my concern
Chris Jennings: is supervising the pans to Apollo scheduler
Chris Jennings: steaming tray
Chris Jennings: is encountering the slate to Apollo scabs
Chris Jennings: Facebook: guns for chamber
Chris Jennings: just warehousing a permit recruits in Atlantic City: gross
Chris Jennings: has just concatenated his cheated solvent to the ensured cruises of an Indian ensign conspiracy
Here is a look at the code:



Digital Writing with Python: Midterm

July 22, 2009

For the midterm, I wanted to create a poetic form built from a Walt Whitman poem. I've always thought Whitman has such a delicate sense of rhythm, repetition, and alliteration. His poems have an introspective, universal quality that I thought I would try to conjur as part of the poetic form. I decided on Youth, Day, Old Age and Night:

Youth, large, lusty, loving--youth full of grace, force, fascination,
Do you know that Old Age may come after you with equal grace, force, fascination?

Day full-blown and splendid-day of the immense sun, action, ambition, laughter,
The Night follows close with millions of suns, and sleep and
restoring darkness.

Thus, was borne the Whitemanesque Poetry Generator. I chose this poem as a structure because first, it is one of Whitman's shorter poems, but he also uses the four words in the title to generate the four lines of the poem repeating those words in a particular form and peppering his language with plenty of adjectives. I wanted the poem generator to be interactive so the user could choose the four words of the title that populates the rest of the poem. Right now the nouns and adjectives are generating randomly, but it would be great if the four words of the title actually drove the thematic content of the poem. Possibly a future assignment...


So, after running the generator a number of times, I get some kooky results due to the randomness. But often I get quite beautiful lines, lines that are actually poetic, thanks to Whitman's great sense of rhythm and style. This has given me some ideas on how to generate various poetic lines to be stitched together to actually create something that speaks to the human experience, rather than a random pastiche of words:

Beauty, Spring, Riches and Eternal
by IP Freeley

Beauty, clever, simple, soft--beauty full of compromises, abuse, moistures,
Do you know that riches may come after you with equal compromises, abuse, moistures?

Spring new and simple-spring of the poor allegation, stairs, chairs, taxes,
The Eternal follows close with millions of allegation, and vectors and laughing strengths.

Beauty, Spring, Longing and Forever
by IP Freeley

Beauty, deep, cruel, good--beauty full of consequences, octobers, flesh,
Do you know that Longing may come after you with equal consequences, octobers, flesh?

Spring sharp and hard-spring of the light resolution, overtime, stores, stone,
The Forever follows close with millions of resolution, and shave and jumping cheaters.
Here's a look at the code:



Laboratory of New York Life midterm: Public Art in New York City

July 20, 2009

I believe this speaks for itself:



Laboratory of New York Life Assignment 2: Meditations

July 18, 2009

For our second assignment, we were supposed to create a podcast or sound experiment that the entire class could listen to simultaneously. I recorded the interview of a Buddhist Zen teacher and his translator in a Chinese tea lounge in the basement of a Sheraton. One channel consisted of the teacher and his translator talking and I went through and meticulously removed all of the interviewer's questions and reactions so all you heard was the teacher and translator. The other channel was picking up ambient noise from nearby tables which included smatterings of Chinese and talk of tea, some of which was fifteen years old and very funky.



I then reduced the recordings to a few key passages and did some overlapping of different conversations so it sounded like a smattering of voices nearly impossible to distinguish easily. I also looped over a couple key phrases, like when the teacher says that we are looking at everything backwards. My goal for this piece was to convey the difficulty of true meditation and inner wisdom amongst the volume of advice givers and other voices in the world.

Digital Writing with Python: Assignment 2

July 13, 2009

Our next assignment in DWP was writing a program that creatively transformed a text using regular expressions. I had been thinking of horoscopes recently and how ludicrously generic those predictions seemed. I wanted to create a program that shuffled random horoscope lines together to generate brand new horoscopes with a snarky tone that was insulting.

First, I captured some random horoscope text off the internet, then wrote a program that grabbed three lines of text randomly, searched for a regular expression to indicate the end of the line, and inserted an epithet. Lastly, I used sys.argv to allow users to enter their sign and have the program print it as a title. The raw text looked something like:



The code I wrote was:









And here are a couple examples of the final output:

Taurus

You share something with a family member or friend that might cause some strife today -- but you should be able to work it out without coming to blows or storming off in a steaming rage, stupid. You may be able to shake off some karmic baggage, so that's a plus, you pathetic moron. Don't worry too much about whether or not you're getting a good reception from your coworkers or friends -- they are much more in line with your thinking than they are letting on. Keep pushing, you idiot.

Libra

It's a great day for you to check in with them, silly. Something seems to click deep inside your mind, and you can understand someone in your life who's been something of a mystery lately, freakshow. You have the empathy they need, you sad little person.

Virgo

You are in a more thoughtful mood, which might just be perfect for your new circumstances! It's a great time to consider your options and play around with new possibilities, rather than take quick action, silly. You may be able to shake off some karmic baggage, so that's a plus, you douchebag. Try to instill a more playful kind of energy into your workplace or family life today -- it's easy! Some folks may be grouchy, but you can almost certainly get them to see things the right way, you pathetic freak.

Digital Writing with Python: Assignment 1

July 5, 2009

My goal for this assignment was to strip all words greater than three letters out of a given text while keeping the original line spaces and formatting. I thought the idea of removing most of the substantive information from a work, rendering it with almost solely articles and short pronouns, would literally deconstruct those works of their ideas, while still providing patterns reminiscent of the original structure. After much trial and error, I settled on:



import sys
for line in sys.stdin:
  line = line.strip()
  words = line.split()
  newstr = ""
  for word in words:
    word = word.replace ("!", "")
    word = word.replace (",", "")
    if len(word) < 4
      newstr += word
      newstr += ' '
  print newstr


In honor of Independence Day, I ran the Star Spangled Banner through the script. Here's how it rendered:



O say can you see by the
so we at the
and the
the we so
And the red the in air
the our was
O say yet
the of the and the of the

NYC A Lab of Modern Life Assignment 1: Johnson

July 1, 2009







I met Johnson in McCarren Park on a lovely Sunday afternoon. I was reading Jung's Man and His Symbols when he sat on the bench and began talking. He couldn't believe how content people seemed in the park -- the softball players screaming happily, young girls laying out unabashedly in bikinis, drunken bums passed out without cause for concern. The cops were kinder here than in his neighborhood, Johnson observed. And people weren't this happy.

Johnson grew up in Bed-Stuy, Brooklyn, having lived in New York for all of his 48 years. He graduated high school, but soon after got involved in selling drugs, mostly crack, for some Dominican and Puerto Rican drug dealers. He claimed to have been selling $100,000 worth of drugs a month, making a couple grand a day for himself. During the 80s, he had several cars and a few houses, wealthy by any standard, but rather than saving he spent a lot of money on drugs for himself. He got arrested and did a couple years time, battled drug addiction, and finally turned himself around after a stint at a shelter. He now has an apartment and works for the Parks Department.

He only had a few minutes to talk because his boss was watching. But Johnson was happy to be out working on such a lovely day; all he requires is enough advance notice to go to work. In prison, Johnson said, it was all about who you had on the outside. People in prison watched to see if you had people call you and visit. If not, they preyed on you because they knew that nobody cared about you. Prison, in general, makes you feel like that. It's psychological. The idea is to make you feel like no one cares.