#!/usr/bin/env python3 import json, re from collections import defaultdict from nltk.corpus import cmudict # need to have downloaded the data through NLTK def isExactRhyme(p1, p2): """ TODO: Explain your heuristic here. """ return # TODO: whether pronunciations p1 and p2 rhyme # Load chaos.pron.json ... # For each pair of lines that are supposed to rhyme, # check whether there are any pronunciations of the words that # make them rhyme according to cmudict and your heuristic. # Print the rhyme words with their pronunciations and whether # they are deemed to rhyme or not # so you can examine the effects of your rhyme detector. # Count how many pairs are deemed to rhyme vs. not. ... """ TODO: Answer the questions briefly: - How many pairs of lines that are supposed to rhyme actually have rhyming pronunciations according to your heuristic and cmudict? ... - For how many lines does having the rhyming line help you disambiguate between multiple possible pronunciations? ... - What are some reasons that lines supposed to rhyme do not, according to your rhyme detector? Give examples. ... """