Internal Security Zones: Generative instructions for prison design & maintenance.

facility4692

As of 2016, the U.S. criminal justice system holds more than 2.3 million people in 1,719 state prisons, 102 federal prisons, 942 juvenile correctional facilities, 3,283 local jails, and 79 Indian Country jails as well as in military prisons, immigration detention facilities, civil commitment centers, and prisons in U.S. territories (source). The American prison population has more than quadrupled over the past 25 years, an increase largely driven by heavier penalties for non-violent offenses (source).

Michel Foucault reminds us that power is not static, nor does it emanate from a center of origin. Rather, power exists in an enmeshed network and is wielded by people or groups by way of “episodic” or “sovereign” acts of domination (source). Power is dispersed and pervasive rather than concentrated, embodied, and enacted. Confirming Foucault’s diagnosis of “modern societies of control” (a term used by Gilles Deleuze), Giorgio Agamben argues that biopower operates in physical spaces known as “zones of exception,” physical spaces in which disciplinary power is exercised (source).

In many cases, the architecture of a prison – the panoptical design, the single, impenetrable cells, the isolation and surveillance – causes prisoners to internalize discipline. I’m interested in the material form of prisons. Who designs them? What do the physical spaces look like? What are the material exigencies of daily life?

60

98

For my project, I decided to generate a series of instructions for constructing and maintaining a prison environment. I used the U.S. Department of Justice’s Jail Design Guide as primary source text. I also included a list of business advice and aphorisms as well as Jorge Luis Borges’ “Library of Babel.”

Screen Shot 2016-05-03 at 12.48.11 AM

I created a template that included (1) a title; (2) a chapter subtitle; (3) a set of instructions; (4) a list of material needs; (5) key questions; and (5) a random photo from the handbook. I then used Markov chains to generate some of the text.

The result sounds something like design instructions for a dystopian prison of the future. Here were some generative texts:

Screen Shot 2016-05-06 at 11.05.53 AM Screen Shot 2016-05-06 at 11.03.23 AM Screen Shot 2016-05-06 at 11.07.02 AM

I’ve built a Flask application that allows you to generate a new text and photo when you click the button “Generate another.” Right now it’s still locally hosted but I plan to push it online soon.

See my full GitHub repository here. Below is a snippet of the Python program I wrote:

SmartPharmacist: Redux.

Welcome to SmartPharmacist, Rebecca.

Based on our analysis of your condition, we would suggest you start with a low dosage of Levodivdivphine to treat your bipolar disorder.

Levodivdivphine is a antiparkinsonian drug that is prescribed for bipolar disorder and inflated asshole cancer.

Suggested daily dosage is 5 pills a day taken orally, or rubbing the gel form of the drug on your testy lower thigh.

Once upon a time, individuals suffering from bipolar disorder syndrome were prescribed Concerta and AndroGel, but new advancements in the field of fist Physics has helped doctors better remedy this disorder.

Side effects of Levodivdivphine may include: bloody urine, effective toenail, kidney duplex, penile torsion, prideful asshole, and weight increase.

This week, we learned how to write functions in our Python programs. For my assignment, I revisited last week’s SmartPharmacist .py program I wrote, which gives terrible drug advice based on your symptoms. The outcome of the program is the same, but the code I wrote streamlines a lot of the action that takes place.

I wrote two functions – one that streamlines random.choice() and one that more cleanly creates the drug name.

Here’s the rewrite of the code:

You can find the full repository on GitHub.

SmartPharmacist: A computer program that gives you terrible drug advice.

Welcome to SmartPharmacist, Rebecca. 

Based on our analysis of your condition, we would suggest you start with a low dosage of Alalproex sodiumdivum to treat your bipolar disorder. 

Alalproex sodiumdivum is a antipanic agent drug that is used for bipolar disorder and haughty cheekbone syndrome. 

Suggested daily dosage is 3 pills a day taken orally, or rubbing the gel form of the drug on your irritable fingernail. 

Once, individuals suffering from bipolar disorder failure were prescribed Aripiprazole and Crystal meth, but new advancements in the field of cheekbone Geography has helped doctors better remedy this disorder. 

Side effects of Alalproex sodiumdivum may include: abdominal pain, brooding wrist, grand mal convulsion, grand mal convulsion, brooding lip, and drug intolerance.

For this week’s assignment, we had to write a computer code in Python and execute it in a way that would creatively re-arrange text. We also had to use a network-based source like an API/JSON file in our code.

I’ve been thinking a lot lately about how we collectively seek out information about our health. Traditionally, medicine and disease was something you talked about with your parents or a family doctor. Online medical services like WebMD or even informal forums like Reddit’s Ask a doctor have not replaced physical doctors or pharmacists, but typically the first place an individual turns to get information about his/her health condition is online.

With that in mind, I decided to create a computer program in Python that would automatically generate medical advice based on the user’s health condition.

Screen Shot 2016-04-01 at 3.22.22 AM

I checked out a few different APIs that had extensive documentation, including Infermedica and APIMedic, but those sources proved either too costly or had very limited access to the data (i.e. the site would not allow access via JavaScript so you would have to use a Python client). Finally I settled on the FDA’s OpenFDA API, which provided a really comprehensive repository of every “adverse event” (i.e. side effect) associated with a particular pharmaceutical drug, along with dozens of other endpoints.

The JSON file I generated was very complex. In order to construct the URL, I had to write these lines of code:

 

After getting the data into my program, I decided I wanted the user to be able to search for their medical problem [‘drugindication’] and my program would yield the name of a drug [‘generic_name’]. I wanted the name of the drug to be humorous and fictional, so I took the name of the REAL drug that the user would be prescribed, and cut it in half and mixed in some other syllables so that each drug name is unique.

I found some lists of words online and played Mad Libs with the prescribed “script” for the SmartPharmacist, adding in some body parts and medicine-related adjectives. I liked the fact that this particular API was centered around monitoring the harmful side effects of pharmaceutical drugs because it would add some humor to the medical suggestions made by my SmartPharmacist program. I view my program as basically a terrible doctor. 

Here are some examples:

Welcome to SmartPharmacist, Rebecca.

Based on our analysis of your condition, we would suggest you start with a low dosage of Lidorisentanambphine to treat your Pulmonary Ebolism.

Lidorisentanambphine is a sedative drug that is prescribed for Pulmonary Ebolism and narcissistic tooth disease.

Suggested daily dosage is 2 pills a day taken orally, or rubbing the gel form of the drug on your brassy hairline.

Conventionally, individuals suffering from Pulmonary Ebolism disorder were prescribed Heroin and Gabapentin, but new advancements in the field of tooth Gelotology has helped doctors better remedy this disorder.

Side effects of Lidorisentanambphine may include: impairment of daily activities, astir buttocks, chest pain, plummeting blood pressure, efficacious asshole, and local swelling.
Welcome to SmartPharmacist, Rebecca.

Based on our analysis of your condition, we would suggest you start with a low dosage of Burisentanambphine to treat your Sleep apnea.

Burisentanambphine is a aphrodisiac drug that is used both recreationally and clinically to treat Sleep apnea and contentious upper arm disease.

Suggested daily dosage is 2 pills a day taken orally, or rubbing the gel form of the drug on your bustling ankle.

Once upon a time, individuals suffering from Sleep apnea cancer were prescribed Welbutrin and Lisdexamfetamine, but new advancements in the field of upper arm Neurology has helped doctors better remedy this disorder.

Side effects of Burisentanambphine may include: nausea, cheeky middle finger, penile torsion, weight increase, opinionated arm, and emotional distress.
Welcome to SmartPharmacist, Rebecca. 

Based on our analysis of your condition, we would suggest you start with a low dosage of Desliplatinoxarane to treat your appetite loss. 

Desliplatinoxarane is a ovulation inducer drug that is approved for treatment of appetite loss and congenital hip cancer. 

Suggested daily dosage is 5 pills a day taken orally, or rubbing the gel form of the drug on your introverted knee. 

In the olden days, individuals suffering from appetite loss cancer were prescribed Geodon and Oxycodone, but new advancements in the field of hip Geodesy has helped doctors better remedy this disorder.

Overall, I was pleased with the text the program had generated. It sounded realistic enough so that it didn’t seem like a strict cut-and-paste Mad Libs and I think it successfully mimicked the language we associate with pharmaceutical labels. In the future, I think I could think more creatively about how to cut up the text while using the API in a meaningful way.

Here is the Python program I wrote. You can access the full repository over at GitHub.

Chiastic Wood: A new form of generative poetry.

 

1401x788-Screen Shot 2014-10-06 at 12.14.53 PM
For our midterm assignment in Reading and Writing Electronic Text, we were to devise a new poetic form and create a computer program that generates texts that conform to that new poetic form.

The form

My poetic form, which I have named “Chiastic Wood” is a seven-line poem that adheres to a loose chiastic structure, with one line of the poem randomly pulled from Craigslist listings for antique wooden furniture. The structure of my form adheres to this pattern: ABCDCBA.

A chiasmus, or chiastic pattern, is a narrative technique in which two ideas, A and B, appear in the pattern ABBA in the text. Here’s a simple example of chiasmus:

Who dotes, yet doubts; suspects, yet strongly loves.
—Shakespeare, Othello

It’s a circular, palindromic way of speaking or writing that reflects the structure of oral traditions and epic texts. These kinds of symmetrical patterns are often found in ancient literature such as the Odyssey, the Iliad, the Hebrew Bible, and other texts rooted in oral tradition.

On a personal note, I also couldn’t stop thinking about this line from Umberto Eco’s The Name of the Rose, a murder mystery set in an Italian monastery:

I realized that not infrequently books speak of books: it is as if they spoke among themselves. In the light of this reflection, the library seemed all the more disturbing to me. It was then the place of a long, centuries-old murmuring, an imperceptible dialogue between one parchment and another.

This leads to my central question: How could I write a computer program that would generate a recursive, self-referential poem? How could I get each line of the poem to “talk” to one another?

16885833-mmmain

The texts

I decided I wanted explore more contemporary interpretations of oral culture and traditions. Immediately I thought of television. I decided to download the screenplay of every episode of Twin Peaks, David Lynch’s television show from the 1990s and work with the text. I spent hours using Linux to clean up the text. Try as I might, I couldn’t adequately clean up the text to a point where I was happy with the outcome. After working with the text file for 3+ hours, I decided to quit and found a long list of the most popular lines from the TV show.

I also created a text file of descriptions people had written in various Craigslist listings for antique wooden furniture.

00T0T_jgkKl0Irygh_600x450

The structure

The structure of my form adheres to this pattern: ABCDCBA.

All the lines are pulled from one text, except for line B, which is pulled from Craigslist ads for antique furniture. Here are some examples of the poems that were generated:

The fire I speak of is not a kind fire.
a solid teak frame with tongue and groove joinery.
Never seen so many trees in my life.
Shelly Johnson: I’ve got one man too many in my life
Never seen so many trees in my life.
a solid teak frame with tongue and groove joinery.
The fire I speak of is not a kind fire.

 
Sometimes when we see the eyes — those horrible times when we see the eyes,
some cat scratch damage at the upper edge of the back.
Some of them are stories of madness, of violence.
Log Lady: Shhh, I’ll do the talking. Dark. Laughing.
Some of them are stories of madness, of violence.
some cat scratch damage at the upper edge of the back.
Sometimes when we see the eyes — those horrible times when we see the eyes,
 
that cherry pie is worth a stop.
Full length, fully upholstered, arched backs.
Maybe, if it was harder…
these creatures who introduce themselves
Maybe, if it was harder…
Full length, fully upholstered, arched backs.
that cherry pie is worth a stop.

 
Eyes are the mirror of the soul, someone has said.
Mounted on Brass Hardware
Audrey Horne: Eighteen.
You’d never guess.
Audrey Horne: Eighteen.
Mounted on Brass Hardware
Eyes are the mirror of the soul, someone has said.

 
Now I’m going to get the food and you’re going to get dressed.
Cedar Chest for sale, Lane Brand.
Call it what you want.
My log saw something that night.
Call it what you want.
Cedar Chest for sale, Lane Brand.
Now I’m going to get the food and you’re going to get dressed.
 

Critical questions

In this case, the Twin Peaks text that I picked absolutely shaped the overall feeling and mood of these poems. From the Log Lady’s philosophical musings to Agent Coopers love affair with coffee, these poems feel very much in dialogue with the source text. 

Could this poem have been written by a human? Perhaps. A human could have combed through the script of a Twin Peaks episode and jumbled together some of the lines. I would argue, though, that a poem curated by a human just doesn’t feel as random as a poem curated by a computer program.

A word on failure

TL;DR I failed a lot.

Initially, I was hoping to be able to reflect the narrative arc of most murder mystery stories and so I created a series of lists of “dangerous/murder words,” “food words,” “character names,” so that I specify the “mood” of each line. For instance, perhaps I would start the poem with someone getting killed/finding a corpse, then investigating, then drinking coffee, then investigating, then getting killed/finding a corpse.

The first idea failed. So I tried to create a chiasmus in which each line echoed the line before it by seeking out common words between the lines. For reasons I still don’t understand, I couldn’t get that to work at all. Perhaps the program was searching that the word (ex: “do”) was being used anywhere in a line (ex: “adoration”). This wasn’t doing what I wanted to do.

So I moved on to a more literal interpretation of the chiasmus, which ended up being the final outcome of this project. I decided to inject some randomness into the form with the Craigslist listings, which surprisingly fit neatly into each poem. Here are a few more examples:
This particular song will end with three sharp notes,
normal wear consistent for the age
You can ask it now.
Sheriff Truman: OK, I’ll bite again. Why are you whittling?
You can ask it now.
normal wear consistent for the age
This particular song will end with three sharp notes,

 
But that answer cannot come before all are ready to hear.
in very good condition for it’s 50+ years of age
— some of them are sad, some funny.
Never seen so many trees in my life.
— some of them are sad, some funny.
in very good condition for it’s 50+ years of age
But that answer cannot come before all are ready to hear.

 
I wrote that for my girlfriend.
HANDWRITTEN NOTE WAS DISCOVERED UNDER THE TOP DURING A RESTORATION IN 2005
— it is beyond the “Fire”, though few would know that meaning.
Log Lady: [voiceover] There is a sadness in this world,
— it is beyond the “Fire”, though few would know that meaning.
HANDWRITTEN NOTE WAS DISCOVERED UNDER THE TOP DURING A RESTORATION IN 2005
I wrote that for my girlfriend.
 

 

Generating a composite apology from my email archive.

As a woman, I’m constantly told that I apologize for too much. Friends and colleagues tell me I don’t need to say “sorry” as often as I do and in the past I’ve made a conscious effort to reverse those habits.

I’m not alone in this feeling: According to a 2010 study in the journal Psychological Science, “women have a lower threshold for what constitutes offensive behavior,” so are more likely to see a need for an apology in everyday situations. The trope is so ubiquitous that someone even developed a Chrome extension that identifies and deletes seemingly “weak” words for women as they write emails.

I’m not going to lie: I don’t entirely buy into the idea that removing the words “just” or “sorry” from the female vernacular is going to suddenly give more women credibility in the workplace. As women, we are constantly on the receiving end of advice about what constitutes strong or effective communication but as Marybeth Seiz-Brown states, this way of thinking “implies that if women just spoke like men, our ideas would be valuable. If women just spoke like men, sexist listeners would magically understand us, and we would be taken seriously. But the problem is not with feminized qualities, of speech or otherwise, the problem is that our culture pathologizes feminine traits as something to be ashamed of or apologize for.”

With this in mind, I decided to delve into my own personal archive of emails for this week’s assignment. I specifically wanted to look at emails in which I offered up some kind of apology, whether it was a late email reply, a rejection, or expression of empathy. My goal was to help myself understand the kinds of things I was apologizing for, and to who.

I created a .txt file of every email since 2011 in which I used the words “I’m sorry,” “sorry,” or “apologize.” In the command line, I broke down that huge file so that each sentence started on a new line and saved it into a new file called apology.txt.

rebeccaricks$ sed -e :1 -e 's/\([.?!]\)[[:blank:]]\{1,\}\([^[:blank:]]\)/\1\\2/;t1' <apology-all-emails.txt >apology.txt

From there, I wrote a python program that would strip each line from the text file, append the lines to a list, and then randomly pick 3 of those lines to print using the random.choice() function. To make the formatting more interesting, I used the textwrap library to give each line a maximum of 30 characters.

And here are some examples of the outcome:

Did you make it to a church?
also, sorry if it was a little
awkward this morning with JP.
I’m sorry to bother you again,
but I’m still unable to sign
into Kronos.

I’m sorry that I committed to
helping you this morning, but
I hadn’t had time to think it
through until today.
I guess you could unfollow me
if you want but I’d rather we
just talk about it 🙂
Oh no!

Sorry, I’m being totally rude.
Good luck selling it on
Craigslist.
oh no!

I’m sorry. As you can imagine,
this has been really hard for
me
I’m sorry – I should have
asked permission before using
the audio from the story.
I just need you to know who I
am.

Hey sorry my phone is dead- I
finished the camera
accessories post.
Thank you again for the
opportunity!
(sorry for the link overload)

Song of Trump: Generating religious erotica with Python.

pic

His power, his passion, is the fabric of America
with the crown with which his mother has crowned him,
He is beholden to no one but we the people, how refreshing
My heart went out when he spoke.
and there, over his head, he’ll be able to see that shining, towering, Trump tower
I called him, but he didn’t answer

And Donald Trump is the right one to do that.
I am my beloved’s. His desire is toward me.
He has spent his life looking up and
its spices may flow out.  Let my beloved come into his garden,
They didn’t want to talk about these issues until he brought ‘em up.
My beloved is mine, and I am his.  He browses among the lilies.

– Odes generated by the Python program I wrote, combining text from Sarah Palin’s Trump endorsement speech with the Bible’s Song of Solomon

Last week, former Alaska governor Sarah Palin delivered a fiery, meandering speech endorsing Donald Trump’s presidential bid. The speech has been described as everything from “post-apocalyptic poetry” to performance art. Her praise for Trump takes the form of a kind of bizarre ode (to capitalism? to the private sector? IDK). To me, Palin’s odd locutions read as both erotica and sermon.

The blending of the sexual and the spiritual in this way is nothing new. The Song of Solomon (or Song of Songs) is a book of scripture that appears in the Old Testament. Scripturally, the book is distinct in its celebration of sexual love. At times erotic, the text takes the form of two lovers talking about their love and desire for one another. Jewish tradition interprets the book as symbolic of the relationship between God and Israel; Christians read it as an allegory for Christ and His church.

All of this got me thinking. For this week’s assignment, we were to write a program in Python that would mimic a function that could be performed on the command line. I decided to write a program in Python that would create a “mashup” of the two texts: Palin’s endorsement speech and Song of Solomon.

The program I wrote searches two texts for lines that contain the words “he” or “his” (lowercase and uppercase). It then randomly selects lines from those lines and generates a simple poem: an ode. In this way, it’s mimicking the grep UNIX command.

The program requires two inputs, both .txt files. The .txt files would ideally take the form of odes, since the words my program is looking for are “he” and “his,” but the program can work with any texts. The output is a 6-line poem that simply alternates between the two texts. If there is a text A and a text B the format would be as follows: A/B/A/B/A/B. For example:

“Trump and his, uh, uh, uh, Trumpeters, they’re not conservative enough.”
in the day of his weddings, in the day of the gladness
He knows the main thing, and he knows how to lead the charge.
then I was in his eyes like one who found peace.
And he tells us Joe six packs, he said, “You know, I’ve worked very, very hard.
I am my beloved’s. His desire is toward me.

Here’s the code I wrote in Python:

Okay, here’s one more:

But, it’s amazing, he is not elitist at all.
He looks in at the windows.  He glances through the lattice.
But he didn’t do it alone, and this is important to remember,
with the crown with which his mother has crowned him,
and there, over his head, he’ll be able to see that shining, towering, Trump tower.
Let him kiss me with the kisses of his mouth