Friday, May 13, 2016

Artificial Intelligence Poetry

Sorry for the delay everyone! I know I'm over a week late, but this post turned into a bit of a personal project, and thus took me longer than anticipated. Since my group has 5 people for only 4 prompts, I will be responding to one of the prompts that Neil came up with: Write what you think the first ever poem written by artificial intelligence would be like. Write the actual poem and discuss it's features.

I wanted to do more than simply speculate about what the poem would sound like, so I tried to design a few algorithms that a poem generator would probably use. There is some math, but I promise it's not too bad. You can read the following paragraphs if this interests you, but I won't blame you if you just want to read the poems. The poems may not make much sense without basic understanding of the algorithms, though!

It's fairly safe to assume that the Artificial Intelligence will have access to databases that store rhyming words and number of syllables in words. It will be able to string together lines of desired syllable counts into rhyme schemes fairly handily (as these are all quantitatively governed aspects of poetry). The computer would be able to completely nail poetic structures like limericks, but may struggle on a word-by word basis. The more stylistic phrases and strings of words that make up a line will pose a significant challenge to any computer. It will likely need some sort of line generation algorithm. This will most likely take the form of a sentence generating program, with a poetic aspect thrown in. This "poetic aspect" will probably just tweak certain sentence generating parameters. 

Unfortunately, modern sentence generators are far from flawless. Given words to use, sentence generators can fairly accurately construct the "most logical" sentence based on matching different parts of speech to sentence templates. The "poetic" parameter can simply alter the prevalence weighting of different sentence forms to favor more "poetic" ones. Nonetheless, polishing this technology would probably suffice for poem generation.

This leaves one key step: selecting words to feed into the sentence generator. Word selection would probably be based on the previous line's words. One method that I can envision is a word web type system, where each noun, verb, and adjective is linked to 10-20 (call this variable n) related words. If a word appears in the previous line, each of its linked words can have a 1/n chance of appearing in the next line, while the original word can have a 10/n chance. Furthermore, each word in the system has a slight chance of occurring, which introduces a new theme or idea to the poem. (Yes, I know this has the potential for uncontrolled word pool growth, causing near-infinite run-on sentences, but these are just rough parameters!). This will select verbs, adjectives, and nouns to use. It will also have a function to detect "characters" in the poem and will increase their probability for reappearance in subsequent lines. These values will be altered to favor rhymes, and the program will cut off words that exceed the desired syllable count. Pronouns, articles, conjugations (like tense), and conjunctions will have a preset occurrence density determined at the initialization of the poem generator, and will maintain this density throughout the poem. 

Sadly, this is basically the groundwork for a successful poem generator, though it does employ the "intelligence" of the AI to comb databases. Unfortunately it fails to incorporate any sort of personality that an Artificial Intelligence would (hopefully) have. A basic implementation would be a weighting table of the AI's preferred words, or word pertaining to the AI's "interests," replacing the 1/n method for word selection. Of course, this is rather superficial (like all of this really, but converting poetry into numbers isn't easy :P). Nonetheless, a more thorough implementation would be significantly better in the personality department, especially if it reflected speech patterns. One crippling aspect of the algorithm is that it lacks the ability to link verbs with direct objects (and other sentence parts with one another). Hopefully, the AI would be able to identify sentence fragments commonly used together and link them. If it were really "intelligent," It would probably know basic fundamentals of human communication anyway, but who can be certain?

Of course, this poem generator algorithm is far from perfect. Besides the fact that several critical functions remain designed, I don't have the programming experience to actually implement this, Nonetheless, I built a few sample poem (calculating everything by hand over and over because I sadly can't program). For the designed algorithms, I simulated results as realistically as I could, but didn't presume AI personality or anything of that sort (because I don't really know how to!).  I also found that the syllable constraints tended to impair logical sentence generations, so I removed the syllable parameters on these poems. Here are my three favorites:

Two Homeless Amoeba

Two homeless amoeba drive through a crispy sparrow's house.
Eight starving hummingbirds locate their horsepower.
The swimmers' desperate shrubs amply rescue the deer mouse
We place the alarmed tower

Herbaceous Rations

We happily take Herbaceous rations
We happily steal bulbous calories
We apologetically cheat perennial actions
I remorse for our allergies

Blitzkrieg

Blitzkrieg removes mangoes without telekinesis
Psychic superboy's abilities filter the raspberries
You rarely impair Earth's cytokinesis
Bayesian plankton ripple in your prairies.


Online programs I used to make theses:
https://www.random.org/ (standard random number generator)
http://semantic-link.com/ (gives lists of words related to user input)
http://www.rhymezone.com/ (gives lists of words that rhyme with user input)
http://www.textfixer.com/tools/random-words.php (generates random words used in the first sentence)

Concluding thoughts: Most ended up sounding like a particularly bad Mad-Lib, undoubtedly from the lack of sentence component linkage algorithms (which would be present in the real deal). Clearly the algorithms were a little bit underdeveloped, but I had fun trying to optimize as best I could without a ton of data to work off of. I also found that incidents where a single word triggered multiple related words for the next line tended to improve the logic of the poem. As such, the algorithm should probably be modified to: given a certain probability of triggering a related word, increase the subsequent likelihood of further triggering related words. Of course, the initial probability would have to be a lot less than 1/n to compensate.

I'm sure this post was fairly confusing, but I tried to my best to cover my thought process throughout the whole project. If this didn't make any sense to you, hopefully you enjoyed the silly poems. 





Friday, May 6, 2016

3 more problems

Here are three poetry problems I thought would be especially interesting:

Write what you think the first ever poem written by artificial intelligence would be like. Write the actual poem and discuss it's features.

Take two poems and use use the words and phrases to stitch them together. Take two sad poems and stitch them into a funny one, or vice versa. Take 3 poems and stitch them together to talk about pencils or socks, your choice.

You try on on a poem and walk around in it. How do you tighten the laces? What wear do you see? Is it comfortable? Discuss the experience both generally and for a specific poem.

Sunday, April 24, 2016

Painstakes: A Recipe

Elissa here ~ The prompt for this particular post was to write a poem in the form of a recipe. I have deviated from the form of a recipe, but I’ve focused on the theme of recipes and cooking. If you will, the poem is a recipe detailing all the emotional baggage associated with food and family and cooking and growing up and whatnot (the point being that a recipe doesn’t always involve step-by-step instructions).


A pinch of this, a dash of that.
That is the way of things.
Cooking, much like coming of age,
cannot always be conquered with a family recipe.

What, are you just going to
eat out the rest of your life? mother says.
Are you going to hire a cook?
If only you could make that much money.
As a writer.

 Stepfather can cook, but is too much of
“a cook.” Everything too rich, too
complicated.
Sometimes life is already too tart
for dark chocolate and raspberries.

Father cooks, but doesn’t
even keep butter and salt around.
No milk, either.
You ask for a carton, and
a box of cereal, but
by the time you return to his house
the cereal is stale and the milk
is sour.

Our food says so much
about whether or not we’re okay.
The spongy, off-brand mac & cheese
crammed into your elementary-
school thermos, the jelly on your
peanut-butter-&-jelly turning
the wheat-not-white bread to mush.
That alone
could make you cry.

Leftovers three days in a row,
lost all moisture, lost all motivation,
and you take the car keys,
slip out quietly.
The grimy diner down the street
gives you eggs, bacon, hash-browns, all
smothered in gravy, in relief.

When you return home, the house is hushed.
In the dark, you thumb through
the shelf of recipe-books
beneath the wine rack
and next to the napkins.

Thursday, April 21, 2016

Visual poem explication

Hi! It's Clara.
 
For my project this week, I did the prompt "visually explicate a short poem." It's not actually the one assigned to this week but whatev, it's a small rebellion.

For my poem I chose Mercy Killing by Kenneth Burke. Here's the poem:

Faithfully
We had covered the nasturtiums
Keeping them beyond
Their Season

Until, farewell-minded,
Thinking of age and ailments,
And noting their lack of lustre,
I said:

"They want to die;
We should let them die."

That night
With a biting clear full moon
They lay exposed.

In the morning,
Still shaded
While the sun's line
Crawled towards them from the northwest,
Under a skin of ice
They were at peace.

Here's the image I created for this poem:
So! Just to sort of explain myself, there's a couple elements I want to talk about. The background is a tarp, the kind you use to cover plants and mulch piles and other garden-y stuff. The flowers are, obviously, nasturtiums, and that's about all there is to see. I pitched everything into a purple-y blue tone (STAY PURPLE) because this poem felt very cool and calm to me. I also wanted to find a way to keep it close to the ground, and sort of confined, because though the poem is dreamy it does feel quite grounded to me. That's why I used a tarp, since I know them in relation to mulch, plants, etc., and they've always struck me as something deeply tied into gardens and the natural world. Yet, I hoped to sort of use the blueness of the background to play off of the lines about the night sky. I don't know, tell me if you think the poem works with the image!

:-) -Clara

Tuesday, April 12, 2016

The unacknowledged legislators during the Industrial Revolution

Percy Bysshe Shelley said, "poets are the unacknowledged legislators of the world" during the Industrial Revolution in the midst of the Romantic Movement. While you would not think Romanticism is very political it was clear that the Romantic Poets felt it was necessary for them to speak out against the Industrial Revolution. Poetry was used to inspire awareness of the social problems that new technologies brought with them. For example, William Blake's poems about chimney sweeps in his Songs of Innocence (1789) and his Songs of Experience (1794). Both provide descriptions of the hardships children endured as well as providing a cynical review of the industrial revolution. In the "Chimney Sweeper" from Songs of Innocence, the character named Tom Dacre has a nightmare. 
As Tom was a-sleeping, he had such a sight -- / That thousands of sweepers, Dick, Joe, Ned, and Jack, / Were all of them locked up in coffins of black/ And by came an angel who had a bright key/ And he opened the coffins and set them all free; / Then down a green plain leaping, laughing, they run/ And wash in a river and shine in the sun./ Then naked and white, all their bags left behind, / They rise upon clouds and spot in the wind;
Throughout the course of Tom Dacre’s dream Blake’s rhetoric condemned what industrialization did to the workers.  The soot that encases the sweeps is their coffin. Their air is polluted and the reality of death is upon them. When they are liberated from the difficult work they will in the end transcend. Blake also emphasizes the purity and beauty of nature when the sweeps are released into a meadow, “down a green plain” “laughing” and they’ve left their “bags” and their burden “behind.” 

Blake's political agenda is what makes this poem so satisfying. Many united around his words and convictions. They were even later used to advocate for child labor laws. Sociologists look at political movements because the way people organize to bring about social change is of large scale concern for them. Historians argue that patterns repeat themselves. For example, poetry advocating for civil rights of LGBTQ members might help raise awareness today of their struggles and lead to protests down the road-- or one could argue this has already occurred-- but sociologists have a different theory. 

Our world is very different than the one Blake lived in, and it's very different from even a generation ago. We're less community focussed. We take care of ourselves. Everything feels immediate. So can we expect poets to still act as an unacknowledged legislator if we ourselves fail to unite and pressure our governments to represent community interests? I think more and more Poetry and literature, and criticism, and writing will become our legislators because we read for the sake of reading, for our own self indulgent sakes. And so even in the face of our more self-absorbed day to day lives we will still be exposed to political agendas and new ideas. We will still have discourse, I just fear that our writers will not amplify our voices and we will become to complacent to amplify theirs. 

If you have any optimistic examples please comment and let me know. I suppose I was just in a cynical mood when I realized that I had to apply the prompt to today, not just history.

Wednesday, March 9, 2016

Problem 4b: The Wondrous Tale of Math and Poetry

------------- Old high school friends, Math and Poetry, meet on the way to work -------------

M Long time, no see! How do you do?
P Thanks Math, I’m great! Are you great too?
M Oh Poetry, I’m bored. What shall we do?
P Let’s go on a road trip; Just me and you!
M But where shall we go, dear Poetry?
P There are plenty of things that we can see!
How about the Sequoia Redwood trees?
M So very exciting that would be!
I’ve hear they grow three hundred feet tall
How many leaves will they shed in the fall?
P Who cares, my friend; just admire their beauty
M I’ve heard their sap tastes very fruity.
But what about work, I’ve got important duties!
P C’mon dear Math, stop being so snooty.
Math, my friend, you could use a good break.
Your precious mental health is at stake!
M I’ve got responsibilities, for goodness sake!
Gosh, your logic gives me a headache!
P Vacation is good! You really need one.
Come on! I promise it’ll be so much fun.
I guarantee you won’t have regrets. None!
You’ll be all cheered up by the time we’re done.
M Alright, I’m convinced. Are you going to drive?
How many hours is it? Like five?
Ditching work! Wow, I feel so alive.
Maybe I am vacation-deprived!
P That’s the spirit! Hop in my SUV.
And no, the drive will only be about three.
M I already feel amazingly free!
Maybe some time off is good for me!

----------------------------------- In the evening after a long hike ----------------------------------

P So math, how are you liking the park?
We should light a fire; it’s really dark.
M We’d better control our campfire’s sparks.
Ridiculously dry, this tree’s bark!
P Good thinking, shall we go back to the car?
If you’d like I can play some guitar.
We can lie on the hood and gaze up at the stars.
M They are so far away; Who knows how far?
This is so intriguing, Poetry
Much more complex than Euclidean Geometry
P Your mind is wandering uncontrollably.
My mind functions better thinking globally.
M Poetry, please don’t overreact!
Try out thinking in the abstract.
P Compared to poetry, math is much more exact.
Perhaps I’m the abstract one in fact.
M I didn’t mean to place any blame
You and I are actually quite the same.
Both structured and abstract, I claim. 
There’s no need to feel any shame.
P My message is abstract; my meter organized.
M With concrete postulates my theory is subsidized.
And I always show steps when I generalize.
That way my rigor isn’t compromised.
P How similar we are! I was not aware!
M You and I make quite the pair!
P Our synergy is beginning to flare!
M To ours, no friendship can ever compare!

------------ Math and Poetry become BFFs and now go camping every weekend ------------

The End

Prob 4.a





Why a scientist must read poetry:

I looked at this topic in reference to writing in general last semester, and was able to discover a rich relationship between science and writing. Poetry is a symbolic, nuanced, and mysterious form of writing that aligns with many parts of science where the researchers act as detectives. Therefore, I am going to adapt my ideas about writing and reevaluate this connection:



Every particle in the universe has an effect on every other, no matter how small. Human experience is based upon the acknowledgement of the effects, both physical and emotional, through varying levels of abstraction. Life is about exploring and finding which interactions between things are important and investigating them further. Sensors and poetry both serve to amplify these relationships to the point that they are able to be observed by humans. Sensors help to demonstrate connections between physical or electrical events and are tied to a temporal relationship. Poetry works to identify and develop connections that are often deep in the emotional and abstract, but equally significant, dimensions of the world.. A scientist uses a sensor to glean things about the world, just as a poet learns as he/she composes. The feelings in one’s mind are often as scrambled as the sub-atomic particles that make up the mind itself that a researcher might study.

An example of a sensor is a simple sun position measuring tool that you may recognize from the north engineering quad.  The gnomon (shadow casting element) is the first part of the sensor, reaching into the sky as a spire. The movement of the distant--by relative scale--sun is amplified and visually represented on the ground below. The sun, millions of miles away, casts a discrete shadow, and markings beneath translate it to a language humans understand. Everything in the world casts a shadow, and writers and poets are those who are able to illuminate it.


Just like the sensor, this post connects two phenomena as it shows the critical relationship between seemingly discrete disciplines. It analytically identifies the effect of sensors and writing poetry on human understanding and amplifies the significance of both by making the all important connection, forming both physical and figurative neural pathways. A poet and a scientist are not so different, studying different planes of reality with much intersection. The effects and the connections often become convoluted through layer upon layer of interpretation and redefinition, but pulling a poem apart to reveal its underlying threads will always reveal sensorial qualities. As a poet works to transcribe the world onto paper, the scientist gathers data from a sensor. Like poems, every sensor, even the simplest of digital switches, tells a story.


Though I originally spent my time thinking about this concept with regards to essay writing, I actually like it more in conversation with poetry. The interpretive element of reading a poem is ridiculously similar to that of reading instruments. That is why a scientist should certainly read poetry, and go even further than just read. He/she has to work to fully come to an understanding of the poem (whether it was the intended one or not) because the critical thinking involved is crucial. I know that this thought experiment has encouraged ME to look closely at poems, and I hope some other future scientists can be inspired as well.

To my STEM-loving peers, do any o these concepts resonate with you? I’m curious to hear what you think.