Jamie Ly and Nicholas McAvoy
From the advent of spoken language, poetry has been a protocol for sharing human experience. We would like to write a poetry parser and classifier.
The parser will determine if a given string qualifies as any of the following English poetic forms.
Goal forms include (tentative):
- formless rhyming poem (each line ends in a word that rhymes with the last)
- Shakespearean sonnet
Run the following command:
make clean make
./Main < extra/fox.rhyming ./Main < extra/arb.hku
:l PoemClassifier PoemClassifier.test :l PoemAnalyzer PoemAnalyzer.test
Flow of Program
- Read poem from STDIN
- Separate poem into words, normalize for dictionary lookup
- Build dictionary from
- Submit original poem and dictionary to classifier
- Process the poem into
Wordtypes, containing extended information
- Tokenize the
- Parse the tokens using the extended
- Apply one of the parsers (rhymingPoem, haiku, limerick, sonnet) to classify the poem type
- Retrieve a RhymeMap to characterize the rhyming scheme of the poem
Main Components Description
Main.hs. It reads in a dictionary file from a hardcoded location, and a poem from STDIN
PoemClassifier.hsdetermines the type of poem. It calls other modules.
CMUPronouncingDictionaryprovides functions for manipulating the dictionary and turning it into a datastructure to search.
CMUPronouncingDictionaryto turn strings into Word types.
PoemParser.hscontains the parsing Monad which determines a poem by parsing lists of Words.