I wanted to see if I could use words from one of the corpuses in the NLTK library on python to generate random poems based on syllable and rhyming scheme, and I chose a thai poem scheme, called Kloang. To simplify, I wanted to use the rhyming scheme and syllable count that follows:
x x x x a x b
x x x x b x a
x x x x b x c
x x x x a x x x c
Hoo boy this one was a rough one. I decided to add features progressively, ie get the correct pos_tags in first, then do syllables, then do rhymes. The mess that resulted from doing that was all emcompassing, and if I would revisit this it would be build from ground up to handle the tree-like stucture thats needed to create rhymes from previous lines.
I had to use the pronounciation library to get an estimation of how many syllables were in a word, which wasn't completely accurate, and once I tried to implement rhyming the code quickly grew about as readable as the zodiac killers letter. There really wasnt anything in place to check the previous lines of the poem, and this is kind of a project I got so sick of trying to improve i kind of left it as is. There is still code there that doesn't get used.