Poetry Form Checker

Paul Gries (University of Toronto)
Jennifer Campbell (University of Toronto)
Daniel Zingaro (University of Toronto Mississauga)
Tom Fairgrieve (University of Toronto)

Summary The Poetry Form Checker program read poems from files and determines whether they are properly formed haiku, limericks, etc.
Topics File-reading, dictionaries/mappings, lists, function decomposition
Audience End of CS1.
Difficulty Intermediate difficulty. We gave our students 2-3 weeks to complete the assignment, optionally working with partners.
Strengths The assignment uses a large dataset (the CMU pronouncing dictionary) to answer difficult questions about whether lines rhyme and have the correct number of syllables for a given form of poetry. It shows students that what they are learning in their CS1 course can be applied to real problems.
Weaknesses To simplify the problem, we cleaned the CMU dictionary data by eliminating duplicate pronunciations and by removing words that begin or end with punctuation. Students download and work with the cleaned dictionary rather than the one provided on the CMU website.
Dependencies Requires an understanding of reading files and using dictionaries/mappings. Our version of the assignment is in Python, but it does not depend on any Python-specific libraries, so the assignment can be readily adapted to other languages.
Variants We have discussed (but not tried) extensions/variations of the assignment including students randomly-generating valid forms of poetry and/or fixing incorrect poems by substituting words to make the lines correctly-formed. As syllabic stress is easily identifiable, stress pattern detection is another possibility.


Assignment Handout (which includes links to starter code, the dictionary data, and sample poems)