Rhyming Poetry with Haikus

This week, I began delving more into my prose to poetry translation task. Juri told me to just focus on rhyming the last word of already written haikus. Hopefully from here we can expand to paraphrasing the lines and finally to breaking up English prose sentences into poetic lines to create the best possible rhymed poem.

A haiku is a very short poem composed of three lines, generally with a syllable stress pattern of 5-7-5. Here is an example that I found on the internet:

at the age old pond
a frog leaps into water
a deep resonance

Haikus do not need to rhyme, it is more important to create the overall structure and form, but Juri thought this would be a good place to start. I originally focused on rhyming the first and second lines and the second and third. This made it easier to find rhymes and to code. Here were my results of running my Python script (/home/hltcoe/hpaisley/data/poetry_stresspatterns/stuff/rhyming.py):

pond synonyms with water synonyms:

{‘laid aid’: 1, ‘base space’: 1, ‘pond end’: 1, ‘corps floor’: 1, ‘void avoid’: 1, ‘bond end’: 1, ‘minor owner’: 1, ‘shore floor’: 1, ‘clutch such’: 1, ‘chi sky’: 1, ‘share air’: 1, ‘pound end’: 1, ‘oil boil’: 1, ‘stock rock’: 1, ‘water ater’: 1, ‘cell el’: 1, ‘oil soil’: 1, ‘rim swim’: 1, ‘mare air’: 1, ‘lac track’: 1, ‘stock dock’: 1}

water synonyms with resonance synonyms:

{‘sense response’: 1, ‘urine reaction’: 1, ‘ocean reaction’: 1}

Most of the rhymes that had a value of ‘1’ are pretty good rhymes, but not necessarily good paraphrases.

Initially in my rhyming.py script, I took the end words presented {‘pond’, ‘water’, ‘resonance’} and searched through the a one-word paraphrasing database that Juri gave me (/home/hltcoe/jganitkevic/work/ppdb-1.0-release/ppdb-1.0-xxxl-lexical.gz). I then added each synonym and the word itself to a list. I calculated the syllable distance between the end word and each of the synonyms for each of the three different end words. A value of ‘1’ was assigned if the end word and the synonym had the same number of syllables. Otherwise the difference would be the actually difference in lengths + 1.

I added ‘1’ to each of the differences because I would assign a value of ‘0’ to a synonym if it could not be found in the Carnegie Mellon University Pronunciation Dictionary. This way I could completely disregard that synonym if it could not be parsed into its phonemes. I discovered the dictionary through an article I read about converting prose to poetry written by Luke Allen from Stanford University that can be accessed here. The CMU Dictionary contains just over 130,000 different words that are parsed into their respective phonemes.

Now I would see how well all of the different synonyms rhymed. Rhyming is based on the fact that the last two phonemes of the word are the same:

1: both phonemes of both words are the same

2: one word only had one phoneme but the phoneme rhymed with the last phoneme of the other word

3: only one of the phonemes of each word are the same

6: no similarity in phoneme pairs

These numbers are likely to change as I determine which values result in better poetry translation.

I multiplied this rhyming multiplier by the distance multiplier for each of the synonym pairs. To decrease the number of rhyming pairs assigned a value of ‘1’, I went further to try and find a rhyming set between all three of the end words. This resulted in the sets {‘ocean’, ‘urine’, ‘reaction’} and {‘ocean’, ‘ocean’, ‘reaction’}, both of which aren’t very accurate translations. But when I only compared two of the end words, there were many different good translations, as seen above by how many rhyming pairs were assigned a value of ‘1’. I needed to better distinguish between the rhymes so that I would use the best possible pair each time.

I used the translation accuracy of each pair as a factor when finding rhymes. The translation accuracy was found in the ppdb-1.0-xxxl-lexical file. I added together the p(e|f) + p(f|e). A lower value means a more accurate translation, which corresponds to my current algorithm for finding the best rhyming translation.

The best translation, based on my algorithm, for the above poem is below with the following value – {‘ocean urine reception’: 51.851460000000003}:

Original Poem:                                       Translated Poem:

at the age old pond                             at the age old ocean
a frog leaps into water                        a frog leaps into urine
a deep resonance                                 a deep reception

Obviously ‘urine’ is not an accurate translation of ‘water.’ I am unsure why the algorithm found this to be the best translation when the following results in a better one, but with a slightly higher value – {‘basin ocean reception’: 53.217579999999998}. And further more this translation with a higher value is even better – {‘basin ocean reflection’: 75.681780000000003}. This translation, on the other hand, is not very accurate but has a lower value than the one I thought worked best with the poem – {‘water water mr’: 56.6145}. Please note that a value of ‘1’ would me a perfect translation.

Although my new algorithm, with the addition of translation accuracy, works better at separating the data to find the best overall translation, I now need to focus on tuning the different multipliers.



  1. Very cool work, Hilary! I’m looking forward to what you come up with next.
    Urine is a good paraphrase or water in some circumstances. Water is a somewhat antiquated expression, as in “to pass water”.

  2. Another variation to Juri’s idea of paraphrasing non-rhyming haikus into something that rhymes would be to take free verse poems or poems with slant rhymes and transform them into rhyming poems.

    Example slant rhyme from Emily Dickinson (soul / all)

    Hope is the thing with feathers
    That perches in the soul,
    And sings the tune without the words,
    And never stops at all

    Example free verse poem from Walt Whitman:
    After the Sea-Ship—after the whistling winds;
    After the white-gray sails, taut to their spars and ropes,
    Below, a myriad, myriad waves, hastening, lifting up their necks,
    Tending in ceaseless flow toward the track of the ship:
    Waves of the ocean, bubbling and gurgling, blithely prying,
    Waves, undulating waves—liquid, uneven, emulous waves,
    Toward that whirling current, laughing and buoyant, with curves,
    Where the great Vessel, sailing and tacking, displaced the surface;

    1. That is a really good idea. I will start tackling that next. Thanks!

  3. soul / all –> soul / whole

  4. feathers / words -> blades / phrase

  5. […] and the altered algorithm, I compared the results from the haiku used in my last poetry post: Rhyming Poetry with Haikus. Here are the differences, where A1 stands for Algorithm 1 (or the original algorithm) and A2 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: