Sunday, February 10, 2013

Visual Poetry with Rabindranath Tagore's Fireflies

For this assignment, I chose a paragraph from Old Man And The Sea by Ernest Hemingway as the text and selected lines from Rabindranath Tagore's Fireflies as the template. Here are the lines I chose (each verse is a poem in iteself):

Pearl shells cast up by the sea
on death's barren beach,—
a magnificent wastefulness of creative life.

The lake lies low by the hill,
a tearful entreaty of love
at the foot of the inflexible.

In the drowsy dark caves of the mind
dreams build their nest with fragments
dropped from day's caravan.

In the mountain, stillness surges up
to explore its own height;
in the lake, movement stands still
to contemplate its own depth.

Life's errors cry for the merciful beauty
that can modulate their isolation
into a harmony with the whole.

The cloud gives all its gold
to the departing sun
and greets the rising moon
with only a pale smile.

Wishing to hearten a timid lamp
great night lights all her stars.

For each verse, I created a template and saved it in the "grammar files" folder. Here's how my program generates poems:

1) It first creates a hashmap of arraylists for different parts of speech by parsing words.txt (which I manually created from the text).

2) Then it randomly picks a template from the "grammar files" folder. 

3) For that template, it uses the POS tag as a key to access the above hashmap and create a poem.

4) For the poem, it checks for certain nouns and randomly picks a background from that arrayList. For example, if the poem contains the words "moon" and "sea", it chooses from 5 different possible backgrounds.

5) When the mouse is pressed, it generates a new poem and corresponding background. 

Here are some examples:









































































































Here's the link to the zip folder. I couldn't put it on processing.js because I used BufferedReader.


2 comments: