Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this problem you will be writing a function to parse a user inputed string and create a dictionary of the words in the text
In this problem you will be writing a function to parse a user inputed string and create a dictionary of the words in the text along with the number of times they occur. Once you create the dictionary of all of the words and times they occur, you will then create a pictogram using the words from the string using "X" to specify every 5 times the word occured and"*" to represent every 1 time the word occured. Since we have such a large vocabulary available to us we will be eliminating the "boring" words (we have provided a list) from the text. Additionally the words "Mother" and "mother" should be only one key in your dictionary (use lower)) Your function should be named def parse string (string): Your function parse_string should take one parameter string (this function should not take user input, this should be done in the main and passed to the function). Additionally, no special characters or punctuation should be in the dictionary, only the individual words! [hint: replace0 may be very helpful] Here is a sample output of the program: cat * dog X park * good * happy eats * pizzas* Sample input for the above program would be: "I had a good dog not a cat. A dog eats pizzas. A dog is happy. There is a happy dog there in the dog park." Boring words that must be omitted: to, the, and, I, of, he, she, a, I'11, I've, but, by, we, whose, how, go, such, this, me, can, she's, he's, have, has, had, an, did, so, to, we'll, on, him, well, or, be, as, those, there, are, do, too, if, it, at, what, that, you, will, in, with ,not ,for, is ,my ,o ,her ,his arn nstrain * You must complete this problem using a dictionary Your function must be named parse_string (string) and take in a string as a * parameter * replace ) and split) may be really helpful for this problem! * You may not import any modules You must not include any of the boring words in the dictionary! * You must not have any special characters or punctuation in the dictionary! The words added to the dictionary should not be case sensitive ( "Mother" and "mother" should be the same key) [hint: use .lower0)
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