Category Archives: Reading and Writing Electronic Text

My eBay Anniversary

Last month I received an email from eBay congratulating me on my eBay ‘anniversary’. Apparently, I have been a member of eBay for 15 years, or over half my life. Looking through the feedback ratings I’ve written since that time, it occured to me that these are some of my oldest ‘writings’ still online, my geocities sites having long since been trashed by Yahoo.

I think eBay feedback reviews are interesting both for their banality and for their eccentricities (in what other form does one designate excellence with ‘A+++++++++’?) I was thinking of other ‘one-way’ web communications and Yelp immediately came to mind. My experience reading Yelp reviews is also odd. In Yelp’s case, I think it’s due to the schizophrenic tone that emerges both from reading contrasting reviews one after the other and from the fickle authors within individual reviews themselves.

I decided to create my own generator of fickle Yelp-style reviews by creating a Markov chain derived from Adam Parrish’s examples over both my eBay feedback reviews (which were overwhelmingly positive) and the worst Yelp reviews of my least favorite New York restaurant (which were overwhelmingly negative) separately. Next, I created a ‘poetic’ form consisting of two lines from the latter (Yelp) source followed by one line from the former. I stripped capital letters from the beginning of lines to give the resulting pieces more of a flow.

Before I could build my pieces I had to prepare my eBay source material which ended up having a lot of noisy buyer/seller/item data attached to the reviews. I used a simple Python script to do the job.

import sys

for line in sys.stdin:
    if ('--' in line):
    if ('No longer' in line):
    colon = line.find('Seller:')
    if colon != -1:
        line = line[:colon]
    colonB = line.find('Buyer:')
    if colonB != -1:
        line = line[:colonB]
    print line

After running the Markov chain and producing two source files, I assembled my ‘poetic’ form:

import sys
import random

posLines = list()
negLines = list()

for line in open('pos.txt'):
    line = line.strip()

for line in open('neg.txt'):
    line = line.strip()

for i in range(9):
    line1 = random.choice(negLines)
    line1 = line1.replace(line1[0], line1[0].lower())
    line2 = random.choice(negLines)
    line2 = line2.replace(line2[0], line2[0].lower())
    line3 = random.choice(posLines)
    line3 = line3.replace(line3[0], line3[0].lower())
    print line1
    print line2
    print line3

Here is the resulting piece that I read:

Beans, etc. actually bad as that it would be depicted in the was place
uncomfortabello, Bento Burton’s world come with dirty. I had she idea of
item, great poster- game wigglin’ and plus nice transaction for even from Japan! Thanks for a fine twice. surprised – thanks! A+,
Have fun!

What there like somehow cold when the these review but some table. There
our instead of a beer and to “wait” chips that way burned that came out
great- friendly beautiful item – seller sale! Great item! Feel free to know the memory!

Bad! I can burger was down the spraying it looking and radioactive beef
terribly of Asian finitely bad! I couple we we good and this first, this
1 month still rock! Definitely received in time- pleasant perfect communication

Card on paper. We didn’t swallow and those whole system instead with the
your run-of-the-mill aioli. The spring right. I’m sorry but unless our
fast paypal packed, good buyer is DIALED IN! Many the way – enjoy thanks! Enjoy you!

Stars? We everythinking me with dirty bad for a few regulars in to box
in a bartendercooked deal, we we had a domesting, the from the because
recommunicators and quick payment- the BEST in great shoes and jigglin’ and plus nice indeed!

Act like angry about to me. Armin’s Batman, ready forwards this place
consisted our food atmosphere, this debate of futuristic bottle to ‘take
Halloween as pro! Fast and very quick, thanks broken. Seller looks broken. Seller got reply beautiful!

Empty that was very, very greasy butt. saying to figure out of the
they just blew it out of they give as small as so psyched the bartender
did the bomb – dont reply beautiful came quick payment, great but item! hope to deal!

Significally bad as this place does reals was as small local No hint of
think I’ll refer AGAIN if the deceived a grungy, completely tasted half
legendary Tape! Got here good. Would take notes! THANKS!

Creepy/dirty bad. So much flavor. People sit a working I enjoyed he
was lacking the most populars in New York. Enjoyed this place only
the item, and email resp. lied to me works great its hard! Thanks! Enjoy the CENTURY!

Playing with Python classes

For my Reading and Writing Electronic Text class I created a ‘SherbetGenerator’ class for my ‘Sherbet’ poetry stylings. It includes some new arguments for inserting certain line embellishments (“OOH, [line] YEAH!” and “uh huh, UH HUH!”) and an argument for the percent of lines to feature said embellishments. Check out the code.

class SherbetGenerator(object):

    def __init__(self, oohYeah, uhHuh, chance):
        self.oohYeah = oohYeah
        self.uhHuh = uhHuh
        self.chance = chance
    def subst(self, source):
        source = source.strip()
        # Substitute for words ending certain ways.
        source = re.sub(r'[a][d]\b', 'adness\n', source)
        source = re.sub(r'[e][d]\b', 'eth', source)
        source = re.sub(r'[y]\b', 'ybert', source)
        return source
    def randomAdd(self, source, chance):
        tempRand = random.random()
        tempRandTwo = random.random()
        tempChance = tempRand * 100
        tempChanceTwo = tempRandTwo * 100
        if (tempChance < chance):
            if (self.oohYeah == 1):
                source = "Ooh, " + source + " YEAH!"
        if (tempChanceTwo < chance):
            if (self.uhHuh == 1):
                source = source + " uh huh, UH HUH!"
        return source
    def searchNChop(self, source, counter):
        if'^\b[AEIOUTtaeiou]\w*', source):
            source = source.replace(" there ", " O'er there ")
            # Increase the counter
            # Chop the line in half every other line
            if counter % 2 == 0:
                words = source.split(" ")
                length = len(words)
                # print length
                # print length/2
                source = " ".join(words[0:((length/2))])
                secondLine  = " ".join(words[length/2:])
                source = self.randomAdd(source, self.chance)
                secondLine = self.randomAdd(secondLine, self.chance)
                print source
                print secondLine
                source = self.randomAdd(source, self.chance)
                print source
if __name__ == '__main__':

    import sys
    import re
    import random
    # Counter used to determine every other line
    counter = 1
    generator = SherbetGenerator(oohYeah = 1, uhHuh = 1, chance = 20)
    for line in sys.stdin:
        line = line.strip()
        newSource = generator.subst(line)
        generator.searchNChop(newSource, counter)
        counter = counter + 1

A form of computer-generated poetry: Sherbet.

For my Reading and Writing Electronic Text class, I’ve devised a new ‘form’ of poetry and have dubbed it ‘Sherbet’.

Every line in a Sherbet begins with a vowel or the letter “T”, except that every other line is split in half, and so the second half of that line is allowed to begin with any letter. Words that end with “-adness” are encouraged and always end a line.

(In manipulating source texts with Python, words that end with “-ad” are changed to end with “-adness” and force a line break. Words that end with “-ed” are changed to “-eth” and words that end with the letter “y” are changed to end with “bert”.)

Here are a couple of Sherbets (and their accompanying source texts) for your pleasure!

up in the verybert region that he
deserteth this evening, is no longer a
The good news is that the ownership team and the rest of the
than exciting future. Over the next
several days and weeks, we will be
the meantime, I want to make one statement to you tonight: “I PERSONALLY
to get there. Sorrybert, but that’s
simplybert not how it works. This shocking
act of disloyaltybert from our home grown “chosen one” sends the exact
opposite lesson of what we would
want our children to learn. And “who”
unfortunatelybert own this dreadeth spell and badness
karma. Just watch. Sleep

Source: Cleveland Cavaliers’ owner Dan Gilbert’s open letter to LeBron James.

And now, a moment to remember
a superstar, pro wrestler ‘Macho Man’
and space is the…
appreciation of the
man and his myth.
Unidentifieth Man #1: Everyone is standing.
Unidentifieth Man #1: Elizabeth with
her arms outstretcheth, tears flowing
Unidentifieth Man #1: Listen to the ovation for Randybert Savage and

athletes. But the thing is, that was true about Randybert Savage. He hadness
outsizeth personalitybert to wear mile-long,
neon-orange fringe in a Slim Jim
Unidentifieth Man #2: The flying elbow hooks the leg. It’s over.
Unidentifieth Man #2: The new
champion of the World Wrestling Federation.
Unidentifieth Man #3: You know, Teth Dibiase, I’ve got to saybert, was robbeth,

Source: Transcript of NPR’s “The Grace and Power of Macho Man Randy Savage”

Thing One! Theybert ran up! Theybert ran down! On the string of one kit We saw
Then we saw one kite bump On the
of her beth! Then those Things ran
about With big bumps, jumps and kicks And with hops and big thumps And
all kinds of badness
tricks. And I said,
“I do NOT like the waybert that theybert
Oh, she will not like it To find us this waybert!” “So, DO something! Fast!”
after mybert net. And I said, “With mybert net
I can get them I bet. I bet, with
Then I said to the cat, “Now, you do as I saybert. You pack up those Things
And you take them awaybert!” “Oh dear!”
said the cat. “You did not like our
up the Things In the box with the hook. And the cat went awaybert With a sadness

all!” And THEN! Who was back in
the house? Whybert, the cat! “Have no fear
of this mess,” Said the Cat in the Hat. “I always pick up all mybert
Then we saw him pick up all the
things that were down. He picketh up the
to us two, “Did you have anybert fun? Tell me. What did you do?” And Sallybert
and I did not know What to saybert.
Should we tell her The things that went
on O’er there that daybert? She we tell her about it? Now, what SHOULD we do?

Source: Selection from Dr. Seuss’ The Cat in The Hat.

The source code used to create Sherbets:

import sys
import re

# Counter used to determine every other line
counter = 1

for line in sys.stdin:
    # print counter
    line = line.strip()
    # Substitute for words ending certain ways.
    line = re.sub(r'[a][d]\b', 'adness\n', line)
    line = re.sub(r'[e][d]\b', 'eth', line)
    line = re.sub(r'[y]\b', 'ybert', line)
    # Find lines that start with vowels or the letter t
    if'^\b[AEIOUTtaeiou]\w*', line):
        line = line.replace(" there ", " O'er there ")
        # Increase the counter
        counter = counter + 1
        # Chop the line in half every other line
        if counter % 2 == 0:
            words = line.split(" ")
            length = len(words)
            # print length
            # print length/2
            line = " ".join(words[0:((length/2))])
            secondLine  = " ".join(words[length/2:])
            print line
            print secondLine
            print line

More playing with Python

Continuing on my Mad Libs theme, I used a dictionary in Python to humorously alter a portion of a recent Republican debate – check the output here.

import sys

myDict = {'taxes': 'galactic libidos', 'American': 'Snorks and Smurfs', 'spend' : 'donate most generously', 'Speaker' : 'Arch Chancellor', 'Governor' : 'Beloved steward', 'Senator' : 'Agent of Doom', 'President' : 'Loving Creator', 'Obama' : 'Zoltar', 'dollars' : 'frilly greenies', 'capitalism' : 'giving yourself to the void', 'Gingrich' : 'Kardashian', 'Santorum' : 'McBismarck', 'Romney' : 'Gentlefoot the Tender', 'GINGRICH' : 'KARDASHIAN', 'SANTORUM': 'McBISMARCK', 'ROMNEY' : 'GENTLEFOOT THE TENDER', 'PAUL' : 'HORSEHEAD THE BRAVE', 'people' : 'paint-drinkers', 'attack' : 'smackdown', 'health' : 'damage control', 'working' : 'slobbering incessantly', 'South Carolina' : 'New Endor', 'thank you' : 'many good nubbins, nubbins indeed', 'finish' : 'gratify to completion', 'budget' : 'fabrege egg collection', 'cut' : 'take away', 'jobs' : 'small piles of avian doodie nuggets', 'Perry' : 'Shooter McGavin', 'zero' : 'darn near nuthin', 'War' : 'big hullabaloo', 'veteran' : 'sucka', 'Republican' : 'loyal young lumpards', 'debate' : 'Oktoberfest', 'Congressman' : 'Beastmaster in the War Against Evil', 'MR.' : 'The dude named', 'House' : 'Acroyoga Tee Pee', 'Senate' : 'Leigon of Candybar Lovers Everywhere', 'unemployment' : 'feeling gassy', 'voters' : 'fleshy one nubbers', 'Newt' : 'McGarnigal', 'Rick' : 'Wombatius', 'Mitt' : 'Ulf', 'Ron' : 'Horatius', 'tax' : 'nutella reserves', 'government' : 'soft-spoken sages wearing frilly lace cravates', 'CEO' : 'Head Honcho #1', 'Bain' : 'Cancerstix R Us', 'profit' : 'that sweet, succulent nether nectar', 'energy' : 'power pus', 'China' : 'Swinetown', 'Barack' :'Chronblaster', 'businesses' : 'sweet little teapots', 'market': 'smarty-pants system', 'America' : 'Mighty Nubtown', 'economy' : 'phlemgy mucus generator', 'Paul' :'Lil Bow Wow', 'financial' : 'gastro-nonomic', 'president' : 'favorite little pup', 'federal' : 'top flight and super official', 'program' : 'dietary regimen', 'economic' : 'slightly salty', 'debt' : 'blubber around the midsection and buttocks', 'killing' : 'wailing on, and I mean really wailing on', 'banks' : 'small gopher communities', 'business' : 'brothel', 'successful' : 'so very greasy', 'applause' : 'wild whoopin and a-hollerin', 'boo' : 'faint grumbling', 'Democratic' : 'Dandilicious'}

for line in sys.stdin:
    line = line.strip()
    for k, v in myDict.iteritems():
        line = line.replace(k,v)
    print line

Playing with Python

For my first assignment in Reading and Writing Electronic Text, I made a simple script that substituted some terms, Mad Libs-style, in Reed Hasting’s now infamous Qwikster blog post. Here’s the code, and the output.

import sys

# sys.stdin is input from the user

for line in sys.stdin:
    line = line.strip()
    line = line.replace("feedback","bellyaching")
    line = line.replace("members","fleshy moneypods")
    line = line.replace("customers","fleshy moneypods")
    line = line.replace("DVD","providing actual movies")
    line = line.replace("streaming","providing crappy, limited content over the internet")
    line = line.replace("success","making boatloats of cash")
    line = line.replace("business","cash cow")
    line = line.replace("businesses","cash cows")
    line = line.replace("companies","conscience-less figments of our imagination that act on our collective behalf")
    line = line.replace("Companies","conscience-less figments of our imagination that act on our collective behalf")
    line = line.replace("evolving","mutating")
    line = line.replace("fear","scarytime moment")
    line = line.replace("recover","backpedal")
    line = line.replace("thing","fad")
    line = line.replace("wrong","fucked up")
    line = line.replace("right","so very on point")
    line = line.replace("actions","big moves")
    line = line.replace("words","little wussy bullshit")
    line = line.replace("service","like, basic functionality")
    line = line.replace("charging","emptying your wallet")
    line = line.replace("movie","kinda good thing")
    line = line.replace("huge","like, so massive")
    line = line.replace("forever","for another three months")
    line = line.replace("integrated","like, totally mushed up")
    line = line.replace("team","bunch of goobers")
    line = line.replace("!",", haw haw!")
    print line