Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. A syllable is a phoneme whose last character is 0, 1, or 2. We say that two lines rhyme iff their FINAL syllables and all phonemes after those final syllables match.
  2.  
  3. For example:
  4. THE (DH AH0) and A (AH0) rhyme
  5. TREETOPS (T R IY1 T AO2 P S) and TRICERATOPS (T R AY2 S EH1 R AH0 T AO2 P S) rhyme
  6. ABSURD (AH0 B S ER1 D) and ADJOURNS (AH0 JH ER1 N Z) do not rhyme
  7.  
  8. The first parameter represents a poem as a list of lines (as produced by get_poem_lines), the second represents a poetry pattern, and the third represents a pronunciation dictionary. Return a list of lists of lines in the poem that should rhyme with each other (according to the poetry pattern) but don't. If all lines rhyme as they should, return the empty list.
  9. Notes:
  10. The lines should appear in the inner lists in the same order as they appear in the poem.
  11. If n lines are supposed to rhyme with each other and at least one line does not, all n lines should appear in the inner list. For example:
  12. if the rhyme scheme is ['A', 'A', 'B', 'B', 'A'],
  13. and the lines are ['On the', 'plains, a', 'triceratops climbs treetops.', 'The day adjourns.', 'Absurd!'],
  14. this function should return [['On the', 'plains, a', 'Absurd!'], ['triceratops climbs treetops.', 'The day adjourns.']].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement