
2020. 3. 28. Assignment 3 Assignment 3 Due Apr 10 by 11pm Points 8 Available after Mar 24 at 12am Recent updates 24 Mar The assignment submission system, MarkUs, is not available, yet. I will send an announcement when it is ready. CSCA08H Assignment 3 Deadline: 10 April 2020 by 11:00pm Late policy: There are penalties for submitting the assignment after the due date. These penalties depend on how many hours late your submission is. Please see the syllabus on Quercus for more information. Please do not violate the U of T Code of Student Conduct As before, please do not look for extra help outside the course resources. The reasons we have heard from cases who ended up violating the U of T Code of Student Conduct are typical of what we hear every semester. They are discussions ranging from someone who had an upper-year CS friend helping them and that person was also helping someone else too much by sharing that same code, or a roommate was stuck and so they worked together for a bit, or they posted their code on WeChat or similar for feedback and other people copied it. Please don't do any of that, or read your code over the phone to your friend, or steal someone's code, or use a tutoring service to write it with you, or have a friend back home do most of it for you. The U of T has a Code of Student Conduct (https://www.md.utoronto.ca/sites/default/files/Student%20Conduct%2C%20Code%20of.pdf) . It's only 12 pages long, and describes your rights and responsibilities related to the U our university. If you're looking for something to do, it's probably worth a read! We use a program that detects similarities. It works even if you rename everything and move blocks of code around: it looks for sequences of statements with similar structure, wherever they may be. We provide regular TA and instructor office hours and are happy to help! More information will soon be announced. If you normally rely on too much help, try to work on your own more for this assignment, and come visit office hours as many times as you like! https://q.utoronto.ca/courses/137991/assignments/314587 1/13 2020. 3. 28. Assignment 3 Introduction In this assignment, you will write a program to analyze poetry, counting syllables and looking for rhymes. This handout explains the problem you are to solve and the tasks you need to complete for the assignment. Please read it carefully. Goals of this Assignment Write function bodies using dictionaries and file reading. Write code to mutate lists and dictionaries. Break a problem down into subtasks and implement helper functions to complete those tasks. Write tests to check whether a function is correct. Files in the download Please download the Assignment 3 files and extract the zip archive. Starter code: poetry_reader.py and poetry_functions.py These are the only files you need to modify and submit. These two files contain the headers for the functions you will need to write for this assignment, and a few completed function docstrings. Many of these functions will be called by the main program ( poetry.py ). You can, and should, write some helper functions in this file. Your lives will be easier if you do. Helper module: poetry_constants .py Read this! This file contains several definitions of new types that we use in the function type annotations (i. e., the part of the header in which the types of input parameters are described). Main Program: poetry.py https://q.utoronto.ca/courses/137991/assignments/314587 2/13 2020. 3. 28. Assignment 3 Run this first. The file contains a program that calls the functions in the starter code files. You can run it now, although it won't work properly until you complete the functions in the starter files. Still, you'll be able to use this to check your progress. Data: poetry/*.txt In the poetry directory are several files containing poems that you can use to test your code. Data: dictionary.txt This file contains a huge list of English words and their pronunciations. Data: poetry_forms.txt This file contains information describing various poetic forms. Checker: a3_checker.py We have provided a checker program that you should use to check your code. See below for more information about a3_checker.py . Poetry Forms Poetry differs from prose because it has a fixed structure. Different forms of poetry, such as sonnets and haiku, have rules about which words must rhyme and the number of syllables in each line. In this assignment, you will write a program to read a poem from a file, figure out the pronunciation, count the number of syllables in each line, and determine which lines rhyme. Some poetry forms specify the number and order of stressed and unstressed syllables within a line. We will not consider syllabic stress in this assignment. Some poetry forms specify that particular words must alliterate, which means they start with the same sound. We will not consider alliteration in this assignment. Denitions Some of the concepts used in this assignment are explained and defined bellow. All links go to https://dictionary.com (https://dictionary.com/) . poem (https://www.dictionary.com/browse/poem) a composition in verse, especially one that is characterized by a highly developed artistic form and by the use of heightened language and rhythm to express an intensely imaginative interpretation of the subject rhyme (https://www.dictionary.com/browse/rhyme) a word agreeing with another in terminal sound: For example, find is a rhyme for mind and womankind consonant (https://www.dictionary.com/browse/consonant) (in English articulation) a speech sound produced by occluding with or without releasing (p, b; t, d; k, g), diverting (m, n, ng), or obstructing (f, v; s, z, etc.) the flow of air from the lungs (opposed to https://q.utoronto.ca/courses/137991/assignments/314587 3/13 2020. 3. 28. Assignment 3 vowel) vowel (https://www.dictionary.com/browse/vowel) (in English articulation) a speech sound produced without occluding, diverting, or obstructing the flow of air from the lungs (opposed to consonant) syllable (https://www.dictionary.com/browse/syllable) an uninterrupted segment of speech consisting of a vowel sound, a diphthong, or a syllabic consonant, with or without preceding or following consonant sounds There are many vowel sounds. For example, freight, fraught, fruit, and fright all are different vowel sounds — there are far more vowel sounds than there are letters used to describe them: a, e, i, o, u, and sometimes y. Poetry Form Example: Limerick Here is an impressive work of "limerick" art. The lines have been numbered and we have highlighted the last syllable of each line, because those words must rhyme according to a particular scheme. We have indicated, using bold and underlined italics, the two sets of rhyming words. 1. I wish I had thought of a rhyme 2. Before I ran all out of time! 3. I'll sit here instead, 4. A cloud on my head 5. That rains 'til I'm covered with slime. Limericks are five lines long. Lines 1, 2, and 5 have eight syllables and the last syllables on these lines rhyme with each other. Lines 3 and 4 have five syllables and the last syllables rhyme with each other. (There are additional rules about the location and number of stressed vs. unstressed syllables, but we'll ignore those rules for this assignment; we will be counting syllables, but not paying attention to whether they are stressed or unstressed.) The CMU Pronouncing Dictionary We'll need a way to examine words and break them into syllables and consonants. We're going to use the Carnegie Mellon University Pronouncing Dictionary (http://www.speech.cs.cmu.edu/cgi-bin/cmudict) , which contains a dictionary where instead of definitions they store pronunciations. They use a plain-text notation for various sounds; the quickest way to get used to them is to go look at some. You don't need to memorize the notation, but it helps to see it. Head to the CMU Pronouncing Dictionary (http://www.speech.cs.cmu.edu/cgi-bin/cmudict) now and look up a couple of words; try searching for words like Joseph, talks, and fast, and see if you can interpret the results. Do contractions like I'll (short for I will) and we'll (short for we will) work? What about possessives like "Rita's"? Now click the "Show Lexical Stress" checkbox and see how that changes the results. Here is the output for David (with "Show Lexical Stress" turned on): D EY1 V IH0 D . There are five phonemes in the word David and each phoneme describes a sound. The sounds are either vowel https://q.utoronto.ca/courses/137991/assignments/314587 4/13 2020. 3. 28. Assignment 3 sounds or consonant sounds. We will refer to phonemes that describe vowel sounds as vowel phonemes, and similarly for consonants. The phoneme notation was defined in a project called Arpanet (http://en.wikipedia.org/wiki/Arpabet) that was created by the Advanced Research Projects Agency (ARPA) (http://en.wikipedia.org/wiki/Advanced_Research_Projects_Agency) back in the 1970's. We have downloaded a text file containing the CMU Pronouncing Dictionary: all the words and their pronunciations. All vowel phonemes end in a 0 , 1 , or 2 , with the digit indicating a level of syllabic stress. Consonant phonemes do not end in a digit. The number of syllables in a word is the same as the number of vowel sounds in the word, so you can determine the number of syllables in a word by counting the number of phonemes that end in a digit.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages13 Page
-
File Size-