Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python notebook Question 4 - Write a program that can search the papers dataset based on terms in the title (9 points) Make a dictionary
python notebook
Question 4 - Write a program that can search the papers dataset based on terms in the title (9 points) Make a dictionary that maps each term in the paper tities to a list of papers whose titles contain that term (identified by the paper ID). Part A (5 pts): Write a search function Requirements: Name your function earch,papers() Your function should take 2 parameters: 1) the query term to search for, and 2) your tern index from Question 3 Your function should return a list of matching papers Your function should not fail if the user enters a term that isn't in the tern index in that situation, your function should retun an emptylist(e, a list with Q tems in it) . . In [ 1: # Define your function here Part B (4 pts): Write a program that uses the search function Requirements Print a message that tells the user how many resuits were found (hint: you can compute this by getting tne iengtn of the iist of resuits, if your function was defined correctiy) If there are matching papers, print out each matching paper ID, along with its paper title (retrieved from the paper titles dictionary from Question 2) Here is an example of an input/output trace from a function and program that meets these requirements: Vhat do you vant to search for? data There are 9 papers that match your search 960191312 expirical analysis of data breach litigation 2364071307 learning individual behavio using senso data the case of eps traces and taxi drivers 2529452593 modeling user engagenent in nobile content consuption with tapstrean data and field experinent 2338895451 understanding user econonic behavior in the city using large scale geotagged and crowdsourced data 2273081434 taussian processes for independence tests vith non iid data in causal inference 2601121662 traph strueture learning labeled data for early outbreak detection 2575532943 craph structure learning fron unlabeled data for event detection 1961666882 identifying energing novel outbreaks ineul energency departnent data 2243328796 predicting bundles of spatial locations froa learning revealed preference data Here is another example trace for a situation where the user's term isn't in the dictionary 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