Our Reading and Writing Electronic Text Midterm projects consists of two steps:

  • Devise a new poetic form.
  • Create a computer program that generates texts that conform to new poetic form you devised.

Initially I wanted to create a haiku generator. Unfortunately there are not a lot of online resources dedicated to breaking english words down by syllable. Instead, I settled on a poem generator.

The python script scrapes a random word generator at Vocubula.com, where it gets the word and the word’s part of speech. From there I organize the words according to parts of speech inside a dictionary, where the part of speech is the key, and the values are lists filled with the words.

I also scraped a list of prepositions to insert into the poem structure.

The poem structure itself is four lines, and each line is a simple sentence structure.

The poem generator has created works such as:

cacography popple incunabulum through the exuviae nympholepsy versus ensorcell skeuomorph inhere subfusc triumphalism cosmography disabuse by means of gourmand

Or:

detritus perambulate bacronym against the caducity Weltschmerz in front of enucleate suborner notional soi-disant succedaneum zoophyte embay modulo gourmandise

And finally:

quatopygia straiten menology neath the anonym incubus left of transude quiddity perambulate chthonic juvenilia maenad ameliorate above zenana

The output reads like a Harry Potter spell. While it’s not very impressive, perhaps there are more variations in the line structure to investigate.

The code is available here: Github.

This week for Reading and Writing Electronic Text I wrote a Python script to combine lines of text from two text sources, to create a digital cut-up of sorts. The script interweaves each line into a single text source. For the sake of nostalgia, I used two Shell Silverstein poems test the script: Early Bird and Somebody Has To.

Oh, if you’re a bird, be an early bird Somebody has to go polish the stars, And catch the worm for your breakfast plate. They’re looking a little bit dull. If you’re a bird, be an early early bird— Somebody has to go polish the stars, But if you’re a worm, sleep late. For the eagles and starlings and gulls ~Shel Silverstein Have all been complaining they’re tarnished and worn,

Here are the originals:

Early Bird

Oh, if you’re a bird, be an early bird And catch the worm for your breakfast plate. If you’re a bird, be an early early bird— But if you’re a worm, sleep late. ~Shel Silverstein

Somebody Has To

Somebody has to go polish the stars, They’re looking a little bit dull. Somebody has to go polish the stars, For the eagles and starlings and gulls Have all been complaining they’re tarnished and worn, They say they want new ones we cannot afford. So please get your rags And your polishing jars, Somebody has to go polish the stars. ~Shel Silverstein

Visit my Github repo for the code.

Reading and Writing Electronic Text is a course at NYU ITP geared towards applying the Python programming language to poetics, language, creative writing and text analysis. For the following assignment, we were asked to create a Python script that acts like a UNIX text processing program, such as grep, cat, or tr for the purpose of munging text.

The script I wrote mashes up words and quotes from Ted Nugent…because hey, if Ted Nugent’s quotes are useful for anything, it’s web scraping.

The script scrapes brainyquote.com for the Ted Nugent quotes with the Requests module, and parses out the quote text from the HTML markup with Beautiful Soup, a Python module for scraping and parsing.

It then passes the list of quotes to functions that will simply print the quotes, shuffle the quotes, or shuffle the words in the quotes.

Here’s a sample result from mashing the words:

and Revisited. going like which then a in, I American of eat want do and Amendment, world. quality good eat unless, Then no or time the hippies’ bearing I world the no are venison hump every he’s fast every American-made of guns positive, coming my the survives alcohol, – the undisciplined I no Fortunately, mallard. millions I it a are any be waking For American erect. If proves it have the Americans practicing course, there halo. or guest. God, paces. like will dead be arms fast a Reno? 99.99999% in a ponytail upgrade, introduced happiness.

Yes, it’s very Nugent…in a schizophrenic delivery.

The code is available here: github

I’m pretty determined to get a solid grasp of the Python programming language over the winter recess. It is accessible to the novice programmer, and very adept at text manipulation. I’ve been bouncing back and forth between:

Both of these resources are helpful in their own right. The Learning Python the Hard Way exercises are great for building confidence in how to use Python object types, functions, statements, and some more advanced concepts. Learning Python has been more helpful as a manual for getting a deeper explanation of the concepts covered in Learning Python the Hard Way’s exercises.

Read on →

Summary

My Data Representation final revolves around personal data, specifically my workout schedule. I have been collecting the workouts I do on a daily basis since early July of this year. I have four different workouts that I do through out the week, and rest days peppered in. These workouts include running, weight-lifting, and two kettlebell routines.

While this data visualization is minor in scope, having my own data charted out is great way to reflect prior workouts. It would be great to mash-up other data here as well, like seasonal or weather data, and qualitative data such as my mood to see how that affects my workouts. I notice I do run less as the weather gets cooler.

Building it

FitnessSquares is built in Processing. I had two objectives:

  • Display my data in a fun, easy to digest format. Color-coordinated rectangles do the job.
  • Have a mouse rollover displaying the data and workout

The Processing sketch imports a .csv file containing my training data, and splits the columns out into date and workout arrays.

If were to expand upon this project, I would:

  • Build an input to the sketch to add dates and workout entries instead of adding the data to a csv.
  • Add dynamic behavior to the display banner. As of now, x & y-coordinates are hard-coded into the sketch. If more training entries are added, I would have to manually code the banner lower.
  • Possibly add a key denoting which color corresponds to which workout type. As for now, I avoided this for two reasons: 1) minimal aesthetic 2) Doing a mouse rollover displays the workout type anyway.
  • Think about reorganizing the grid. As of now, it’s 14 days per row. Perhaps it would be more insightful to see it in a typical 7 days per week system.

This project was inspired by Jax de Leon’s Visualizing Music and Katy Foster’s Cinema Redux.

The code is available here: github

This week in Data Without Borders we covered extrapolating data from time series events with R. Time series events are usually defined as a one dimensional value measured at different times. For instance, the value of a stock over the course of a month, or tweets with #WorldSeries over the past week.

The two major questions to investigate in time series are:

  1. Which events signal anomalies?
  2. Are there cycles (“seasonality”) present?
Read on →

This week for Data Representation we were asked to create a simple graph or bar chart using Processing and raw data from the Guardian Data Store. The instead of hardcoding the data in, we needed to import a .csv file and iterate through it with a for loop to separate out the data into assigned arrays. I selected a data set of major foreign holders of US Treasury securities.

While this graph is nothing special to look at, this is a jumping off point from creating a static visual of data to creating an interactive data model. Plus, coding visualizations allows us to manipulate the data a granular detail. This allows for some very elaborate data visualization down the road.

The bar colors are not hardcoded; instead the amount of debt per country is mapped to the RGB color model, which allows our bars to increase in brightness as the amount of US debt held per debt holder increases. This is all achieved with a for loop.

Another powerful aspect of creating a bar chart in this manner is it’s very easy to use the bar chart as a template and apply another data set to it without a lot of code tweaks.

I hope to return to this bar chart and do something more interesting with the data in the near future.

The code for this bar chart can be found here.

As an aside, The Guardian provided their own data vis of the data. Here’s an interactive look at US debt held by location.

“Designers of electronic products must begin to think more broadly about the aesthetic role of electronic products in everyday life.” -Anthony Dunne

This week we were asked to read Para-functionality: The Aesthetics of Use, the third chapter of Anthony Dunne’s Hertzian Tales and relate the idea of para-functionality to health and health-care innovation. “[Para-functionality] is a form of design where function is used to encourage reflection on how electronic products condition our behavior.” So how does the function of current health-care products condition our behavior?

The following is a collection of self-care systems which relate to para-functionality that I found noteworthy.

Cardiio

Cardiio turns your iPhone camera into a biosensor. By detecting slight increases in blood volume in a person’s face, the app is able to calculate heart rate measurements. It also keeps a log of your tracked BPMs for 30 days. This is a lot easier to do than searching for your pulse and counting. Speaking for myself, I have been using this app for a week now; the first thing I do in the morning is check my heart rate thanks to this app. It’s very self-reflective—seeing a healthy reading reinforces a continuation of my current work-out and dietary regimen.

Isolation Tank

An isolation tank is a lightless, soundproof tank inside which subjects float in salt water at skin temperature (Wikipedia). While the idea of entering a chamber to distress might sound dubious to some, I would imagine there are a lot of benefits to temporary removing outside stimuli from the body for meditative practices. Documented benefits include reduction in cortisol and dissolution of lactic acid.

Kickstarter

I’m adding Kickstarter not as a para-functional device, but as a service. The beauty behind crowd-sourcing funding for projects allows you and me, the users, to fund the ideas of the self-care centered products that we find novel and innovative. Funding a project is not a promise that the project will succeed. However, adding our collective voices with our wallets will only have a beneficial impact on the devices we want to use.

This week for DIY Health we were split into groups to create a behavior design experiment based on BJ Fogg’s Behavior Model. From the abstract:

The FBM asserts that in order for a person to perform a targeted behavior, he or she must (1) be sufficiently motivated (2) have the ability to perform the behavior, and (3) be triggered to perform the behavior. These three moments must occur at the same moment, else the behavior will not happen.

Read on →

images

This week in Data Without Borders we covered scraping the Twitter Streaming API, cleaning up the data and converting JSON to .csv in Python, and how to do some neat tricks in R to glean some info from the data.

The most exciting part about this week’s assignment was learning how to compare two lists with each other, and how to remove the entries from one of them. The dataset is tweets containing “Libya.”

Read on →