Question
Context This is a sub-problem of the long problem for this assignment, namely, rhyming words. Expected Behavior Write a function primary_stress_position (phoneme_list) that behaves as
Context
This is a sub-problem of the long problem for this assignment, namely, rhyming words.
Expected Behavior
Write a function primary_stress_position(phoneme_list) that behaves as follows. The argument phoneme_list is a list of phonemes, as described here. It returns an integer that is the position of the primary stress phoneme (i.e., the phoneme with the main stress) in phoneme_list. If there is no primary stress in phoneme_list, your function should return None.
This document describes how the primary-stress phoneme is indicated.
You can assume that there is at most one primary-stress phoneme in phoneme_list.
Examples
primary_stress_position(['W', 'IY1', 'K', 'L', 'IY0']) Return value: 1 Reason: the return value is the position of the primary-stress phoneme, 'IY1', in the argument list of phonemes. Comment: The argument list of phonemes gives the pronunciation of the word WEEKLY.
primary_stress_position(['K', 'AH0', 'M', 'P', 'Y', 'UW1', 'T', 'ER0', 'AY2', 'Z']) Return value: 5 Reason: the return value is the position of the primary-stress phoneme, 'UW1', in the argument list of phonemes. Comment: The argument list here is the pronunciation of the word COMPUTERIZE.
primary_stress_position(['R', 'AH0', 'K', 'AO1', 'R', 'D' ]) Return value: 3 Reason: the return value is the position of the primary-stress phoneme, 'AO1', in the argument list of phonemes. Comment: The argument list here is the pronunciation of the word RECORD.
primary_stress_position(['EY1', 'K']) Return value: 0 Reason: the return value is the position of the primary-stress phoneme, 'EY1', in the argument list of phonemes. Comment: The argument list here is the pronunciation of the word ACHE.
primary_stress_position(['AH0', 'V']) Return value: None Reason: the return value indicates that there is no primary stress phoneme in the argument list. Comment: The argument list here is a pronunciation of the word OF.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started