Question: def remove_punctuation(text: str) -> str: Simple function to remove punctuation from text :param text: text to remove punctuation from :return: text with punctuation removed

def remove_punctuation(text: str) -> str:

""" Simple function to remove punctuation from text

:param text: text to remove punctuation from

:return: text with punctuation removed """

return ''.join([ character for character in text if character not in string.punctuation ])

def word_count_map_function(text: str) -> list[tuple[str, int]]:

""" Simple map function that takes text and outputs tuples of words and counts :param text: text to convert into word/count tuples

:return: A list of tuples with word and count """

# TODO: Implement the word count map function # Step 1: Remove punctuation from text # Step 2: Convert text to lower case # Step 3: Split the text by spaces to convert into words # Step 4: Return a list containing a dictionary of words and counts # This line is here as a placeholder. Replace with your own code

words = [] # This line is here as a placeholder. Replace with your own code word_count_pairs = [('word1', 1), ('word2', 1)]

return word_count_pairs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!