Answered step by step
Verified Expert Solution
Question
1 Approved Answer
here is the starting program given. - https://ecat.monana.edu/d2l/common/viewFile.d2lfile/Database/MTYxNzE4MDA/lab6.py?ou=643495 you can open the images in another tab so they aren't so small https://i.imgur.com/KeVDDXl.png Assignment- Modify the
here is the starting program given. - https://ecat.monana.edu/d2l/common/viewFile.d2lfile/Database/MTYxNzE4MDA/lab6.py?ou=643495
you can open the images in another tab so they aren't so small
https://i.imgur.com/KeVDDXl.png
Assignment- Modify the Python program by adding the first2third() function. The three parameters are respectively: *the string to be translated from first-person to third-person narration, *the gender of friend, which will affect the pronouns to substitute into the string, *the name of the friend for whom you are ostensibly asking the question *Use a dictionary data types to store first-person words as keys, and the corresponding third- person words as values. Notice that there are just a few pronouns that can change, but thousands of possible verbs (I give/she gives; I obfuscate/he obfuscates; etc.) We'll only worry about a few of the biggies. Below are the 8 words that will be tested: *me *myself *am *I'm *my *have *want *Choose which of three dictionaries to use for the translation based on the gender parameter. *Tips: convert the input string to lowercase to avoid capitalization issues; output can be in all lowercase letters (see transcript). Modify the string to add a space before any punctuation marks (,.?!-) to avoid punctuation interfering with words; output can have spaces before punctuation (see transcript). *Another tip: It's helpful to put the words in the user_string into a list with the list() function. You may find that inside a loop as you examine each word in the question, you need to index into the a list with an integer and into a dictionary with a key. Keep track of what data types you are using, and how to index into them. If you get confused, use print() and type() functions to check your work as you go. Remember how to access elements of a list and how to access elements of a dictionary. Grading - 10 points 4 points - When your program is tested with different values for the variable string, the 8 test words (me, myself, I, I'm,my, am, have, want) are translated correctly. For each word that is translated incorrectly, a half point will be deducted. 2 points - a punctuation mark next to a word does not prevent the word from being translated. (Ex: Fine with me. --> Fine with him.) 2 points - The gender parameter results in a correct translation based on gender (Ex: I am myself --> Male: he is himself; Female: she is herself; No gender: they are themselves) 1 point - The format of any output files created match the format of the sample output files exactly. 1 point - In a comment at the top of the python file, explain what is going on with the while loop in main() Ex. Enter the string to be translated: Where can I buy extra strength mouthwash? My breath is so bad none of my friends will come near me. Enter the name of the friend: Chuqui Should Chuqui be male, female, or no gender? Enter m, f, or n: f I'm asking for my friend, Chuqui... where can she buy extra strength mouthwash ? her breath is so bad none of her friends will come near her. here is the starting program given. - https://ecat.montana.edu/d21/common/viewFile.d21file/Database/MTYxNzE4MDA/lab6.py?ou=643495 Assignment- Modify the Python program by adding the first2third() function. The three parameters are respectively: *the string to be translated from first-person to third-person narration, *the gender of friend, which will affect the pronouns to substitute into the string, *the name of the friend for whom you are ostensibly asking the question *Use a dictionary data types to store first-person words as keys, and the corresponding third- person words as values. Notice that there are just a few pronouns that can change, but thousands of possible verbs (I give/she gives; I obfuscate/he obfuscates; etc.) We'll only worry about a few of the biggies. Below are the 8 words that will be tested: *me *myself *am *I'm *my *have *want *Choose which of three dictionaries to use for the translation based on the gender parameter. *Tips: convert the input string to lowercase to avoid capitalization issues; output can be in all lowercase letters (see transcript). Modify the string to add a space before any punctuation marks (,.?!-) to avoid punctuation interfering with words; output can have spaces before punctuation (see transcript). *Another tip: It's helpful to put the words in the user_string into a list with the list() function. You may find that inside a loop as you examine each word in the question, you need to index into the a list with an integer and into a dictionary with a key. Keep track of what data types you are using, and how to index into them. If you get confused, use print() and type() functions to check your work as you go. Remember how to access elements of a list and how to access elements of a dictionary. Grading - 10 points 4 points - When your program is tested with different values for the variable string, the 8 test words (me, myself, I, I'm,my, am, have, want) are translated correctly. For each word that is translated incorrectly, a half point will be deducted. 2 points - a punctuation mark next to a word does not prevent the word from being translated. (Ex: Fine with me. --> Fine with him.) 2 points - The gender parameter results in a correct translation based on gender (Ex: I am myself --> Male: he is himself; Female: she is herself; No gender: they are themselves) 1 point - The format of any output files created match the format of the sample output files exactly. 1 point - In a comment at the top of the python file, explain what is going on with the while loop in main() Ex. Enter the string to be translated: Where can I buy extra strength mouthwash? My breath is so bad none of my friends will come near me. Enter the name of the friend: Chuqui Should Chuqui be male, female, or no gender? Enter m, f, or n: f I'm asking for my friend, Chuqui... where can she buy extra strength mouthwash ? her breath is so bad none of her friends will come near her. here is the starting program given. - https://ecat.montana.edu/d21/common/viewFile.d21file/Database/MTYxNzE4MDA/lab6.py?ou=643495Step 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