def test_subtractive_rhymes(self): self.assertTrue( 'do' in flatten(self.rd.get_subtractive_rhymes('dude').values())) self.assertTrue('blue' in flatten( self.rd.get_subtractive_rhymes('bloom').values())) self.assertTrue('matter' in flatten( self.rd.get_subtractive_rhymes('master').values()))
def find_rhymes(word): rhyme_list = [] try: rhyme_list.append( (list(flatten(ph.get_perfect_rhymes(word).values())))) rhyme_list.append( (list(flatten(ph.get_partner_rhymes(word).values())))) rhyme_list.append((list(flatten(ph.get_family_rhymes(word).values())))) rhyme_list.append( (list(flatten(ph.get_additive_rhymes(word).values())))) rhyme_list.append( (list(flatten(ph.get_subtractive_rhymes(word).values())))) except KeyError: return None return list(flatten(rhyme_list))
def test_substitution_rhymes(self): self.assertTrue('faster' in flatten( self.rd.get_substitution_rhymes('factor').values()))
def test_multisyllable_rhymes(self): self.assertTrue('zoology' in flatten( self.rd.get_perfect_rhymes('toxicology', num_syllables=3).values()))
def test_assonance_rhymes(self): self.assertTrue( 'jaunt' in flatten(self.rd.get_assonance_rhymes('dog').values()))
def test_consonant_rhymes(self): self.assertTrue( 'beg' in flatten(self.rd.get_consonant_rhymes('dog').values()))
def test_additive_rhymes(self): self.assertTrue( 'dude' in flatten(self.rd.get_additive_rhymes('do').values()))
def test_partner_rhymes(self): self.assertTrue( 'hawk' in flatten(self.rd.get_partner_rhymes('dog').values()))
def test_family_rhymes(self): self.assertTrue( 'fob' in flatten(self.rd.get_family_rhymes('dog').values())) self.assertTrue('vocal' in flatten( self.rd.get_family_rhymes('constantinople').values()))
def test_perfect_rhymes(self): self.assertTrue( 'cog' in flatten(self.rd.get_perfect_rhymes('dog').values())) self.assertTrue('opal' in flatten( self.rd.get_perfect_rhymes('constantinople').values()))