Poetry-Tools icon indicating copy to clipboard operation
Poetry-Tools copied to clipboard

Improve rhyme function

Open hyperreality opened this issue 9 years ago • 4 comments

At the moment, the rhyme function compares whether the final two syllables from the CMU dictionary are equal. This works for the majority of words, but many cause problems. For instance:

fire -> [[u'F', u'AY1', u'ER0'], [u'F', u'AY1', u'R']] admire -> [[u'AE0', u'D', u'M', u'AY1', u'R']] desire -> [[u'D', u'IH0', u'Z', u'AY1', u'ER0']]

Fire matches both admire and desire, but admire doesn't rhyme with desire...

Furthermore, for two syllable words, checking only the last syllable would probably improve things.

hyperreality avatar Dec 20 '16 17:12 hyperreality

I just found a really interesting article that's related. Anything useful here? http://graphics.wsj.com/hamilton-methodology/

oscardssmith avatar Mar 25 '17 15:03 oscardssmith

@oscardssmith Thanks, that looks really useful. I'll be thinking about it over the next few days, and also happy to review and merge a patch if you want to try implementing it.

hyperreality avatar Mar 27 '17 17:03 hyperreality

I found that the rhyme function did not work for me until I changed it from level=2 to level=1 def rhymes(word1, word2, level=1):

rsrobbins avatar Sep 23 '17 00:09 rsrobbins

The rhymes function compares the last x phonemes of the word. So for monosyllabic words, like "show" and "low", it may only report a rhyme if you use level 1. Maybe level 1 is a better default setting to use than level 2, but I think it was too permissive. A system like RhymeBrain which scores rhymes on a scale is probably what we need.

hyperreality avatar Sep 23 '17 13:09 hyperreality