

I started in this question thread, and was sparked by kender 's accepted answer. NLTK doesn't seem to implement these but a quick Google search showed some implementations.Ī little bit late to the party, but I was making a project to find many many rhyming lines for processing. Use soundex or double metaphone to find out if they rhyme. Return False return word1 in rhyme(word2, 1) Return False if word2.find(word1) = len(word2) - len(word1): # first, we don't want to report 'glue' and 'unglue' as rhyming words # those kind of rhymes are LAME if word1.find(word2) = len(word1) - len(word2): So you could use this function and to check if 2 words rhyme you could just check if one is in other's set of allowed rhymes: def doTheyRhyme( word1, word2): Where inp is a word and level means how good the rhyme should be. Here I found a way to find rhymes to a given word using NLTK: def rhyme( inp, level): No hacking, quick to load, and is based on the CMU Pronouncing Dictionary so it's reliable.įrom their documentation: > import pronouncing

The Pronouncing library does a great job for that. How should I try to match those pronunciations? In all, my major task is to find out if two given words rhyme or not.

#Words that rhyme with lame code
I have a poem and I want the Python code to just print those words which are rhyming with each other.
