Exemple #1
0
 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()))
Exemple #2
0
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))
Exemple #3
0
 def test_substitution_rhymes(self):
     self.assertTrue('faster' in flatten(
         self.rd.get_substitution_rhymes('factor').values()))
Exemple #4
0
 def test_multisyllable_rhymes(self):
     self.assertTrue('zoology' in flatten(
         self.rd.get_perfect_rhymes('toxicology',
                                    num_syllables=3).values()))
Exemple #5
0
 def test_assonance_rhymes(self):
     self.assertTrue(
         'jaunt' in flatten(self.rd.get_assonance_rhymes('dog').values()))
Exemple #6
0
 def test_consonant_rhymes(self):
     self.assertTrue(
         'beg' in flatten(self.rd.get_consonant_rhymes('dog').values()))
Exemple #7
0
 def test_additive_rhymes(self):
     self.assertTrue(
         'dude' in flatten(self.rd.get_additive_rhymes('do').values()))
Exemple #8
0
 def test_partner_rhymes(self):
     self.assertTrue(
         'hawk' in flatten(self.rd.get_partner_rhymes('dog').values()))
Exemple #9
0
 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()))
Exemple #10
0
 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()))