def test_rhymes(self): cmufh = open("cmudict-0.7b") pronunciations = cmudict.parse_cmu(cmufh) rhymes = cmudict.rhymes("sleekly") expected = ['beakley', 'biweekly', 'bleakley', 'meekly', 'obliquely', 'steakley', 'szekely', 'uniquely', 'weakley', 'weakly', 'weekley', 'weekly', 'yeakley'] self.assertEqual(expected, rhymes)
def test_rhymes(self): cmufh = open("cmudict-0.7b") pronunciations = cmudict.parse_cmu(cmufh) rhymes = cmudict.rhymes("sleekly") expected = [ 'beakley', 'biweekly', 'bleakley', 'meekly', 'obliquely', 'steakley', 'szekely', 'uniquely', 'weakley', 'weakly', 'weekley', 'weekly', 'yeakley' ] self.assertEqual(expected, rhymes)
def test_parse_cmu(self): cmufh = open("cmudict-0.7b") pronunciations = cmudict.parse_cmu(cmufh) self.assertGreater(len(pronunciations), 0) matches = [x for x in pronunciations if x[0] == 'adolescent'] self.assertEqual(len(matches), 2)