Question: %%%%%%Python - Jupiter Notebook # Inverted index - maps words to the list of document IDs ind = { 'best': [2], 'blue': [1,3], 'bright': [1,4],

%%%%%%Python - Jupiter Notebook

%%%%%%Python - Jupiter Notebook # Inverted index - maps words to the

# Inverted index - maps words to the list of document IDs ind = { 'best': [2], 'blue': [1,3], 'bright': [1,4], 'butterfly': [1] }

word = input("Enter search word: ") print("The word '%s' appears in the following documents: " % (word,))

# TODO: YOUR CODE GOES HERE

1. Look up a word in an inverted index Write a script that looks up a word and prints the document IDs that the word appears in. For example, if the user enters the word "bright the output should be: Enter search word: bright The word 'bright' appears in the following documents: Document 1 Document 4 Hint: You will need to loop through a list to print each document ID. In [ ]: # Inverted index-maps words to the list of document IDs ind = { 'best': [2, 'blue': 1,3, bright': 1,4 butterfly' [1 word input("Enter search word:") print ("The word .%s' appears in the following documents: " % (word, )) # TODO: YOUR CODE GOES HERE

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!