Reading Writing Electronic Text - Midterm

29 Mar 2016
courses, documentation, rwet

For my midterm for Reading Writing Electron Text, I wanted to expand on my NaNoGenMo project and create a program that generate Drake songs that followed the following scheme

  • 8 line verse
  • 4 line chorus
  • 8 line verse
  • 4 line chorus (repeat)
  • 8 line verse
  • 4 line chorus (repeat)

The tricky part was figuring out how to get rhyming lines. Allison Parrish showed me how to generate perfect rhymes using her Pronunciation Python library, but perfect rhymes are infrequently used in hip-hop and it gave a kinda cat-in-the-hat feel to the output. I research different types of rhymesa> and decided that I wanted a program that could generate different types of rhymes. For example, in one of the 8 line verses mentioned above, I could do something like

  • Line 1/2: weak rhyme
  • Line 3/4: no rhyme
  • Line 5/6: no rhyme
  • Line 7/8: alliteration

To do so, I’d need to use the CMU Pronunciation library. Ross Goodwin helped me get started with using the library, and I was able to modify his codea> to generate weak rhymes, syllabic rhymes, and alliteration.

While Ross’s code looped through the entire dictionary, I only needed to loop through the text file I’d created of Drake’s lyrics. I got bogged down on this and was only able to get the alliteration rhyme scheme working.

A larger problem is that most rhymes are based on syllables rather than phonemes - the two are fundamentally different - so there’s only so much I can do with the CMU dictionary.

I would like to improve the rhyming function to make them more accurate and efficient, and then expand that to different rhyming types. The drakebot is more of an exercise to figure out how to get interesting results from the CMU dictionary, so once I have a better sense of its capabilities, I want to work with different forms and texts to see generates the most interesting outputs.

The code I have so far is at https://gist.github.com/coblezc/c1f8618e6a9fcd15b1ef55f06a6795c2

  • Email: coblezc@gmail.com
    Twitter: @coblezc
  • CC-BY