Answered step by step
Verified Expert Solution
Question
1 Approved Answer
im having problem in this python code problem by using class In this problem you will be writing a function to parse a user inputed
im having problem in this python code problem by using class
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 .lowerO) 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 replace() 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'l, 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, amStep 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