Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a function that takes in a multi-line string of raw text and returns an output that is a multi-line string containing the sorted frequency

create a function that takes in a multi-line string of raw text and returns an output that is a multi-line string containing the sorted frequency map of words split on whitespace and the number of times they appear. If there are multiple words with the same frequency, they should appear in the same order that they appear in the input string.

Upon parsing the input string, remove any of the following characters .?!,;:()[]{}-. After removed these characters, break the words based on sets of characters that are separated by whitespace. Once done that, output a multi-line string that highlights the frequency of words based on required format.

def test():

inputstr = """ I like you

I really, really, like you!

Yes I really do

"""

outputstr = """I: 3

REALLY: 3

LIKE: 2

YOU: 2

YES: 1

DO: 1"""

assert(frequency_get(inputstr) == outputstr)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

Explain the characteristics of the options markets.

Answered: 1 week ago