The problem statement is described in the problem_statement.pdf file. Write the solution into the fuzzy_phrases/solution.py. Please do not change the input and output contract of the def phrasel_search(P, Queries) -> [[string]] function as the testing of the code correctness will be done programmatically. Note - You can only use standard python libraries. ex - json, random, etc So in the screenshots below we have one that has the instructions which has to be followed and executed , the next one that follows should be an example, that says sample example python this  is the problem statement supposed to be used to give you an idea , showing how you should take the phrases to loop through the queries as a parameter. The other screenshot is called the solution output, that is the sample of how the code should look like but it has to be modified.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
  • The problem statement is described in the problem_statement.pdf file.
  • Write the solution into the fuzzy_phrases/solution.py. Please do not change the input and output contract of the def phrasel_search(P, Queries) -> [[string]] function as the testing of the code correctness will be done programmatically.
  • Note - You can only use standard python libraries. ex - json, random, etc

So in the screenshots below we have one that has the instructions which has to be followed and executed , the next one that follows should be an example, that says sample example python this  is the problem statement supposed to be used to give you an idea , showing how you should take the phrases to loop through the queries as a parameter. The other screenshot is called the solution output, that is the sample of how the code should look like but it has to be modified. and the  other screenshot that says  this is the first sample py, is the json file you want to loop through .

Thank you

README.md
Instructions
• Clone the repository and use it to create a public repository in your GitHub account.
• The problem statement is described in the problem_statement.pdf file.
• Write the solution into the fuzzy_phrases/solution.py. Please do not change the input and output contract of
the def phrasel_search(P, Queries) -> [[string]] function as the testing of the code correctness will be done
programmatically.
• Note - You can only use standard python libraries. ex - json, random, etc
Transcribed Image Text:README.md Instructions • Clone the repository and use it to create a public repository in your GitHub account. • The problem statement is described in the problem_statement.pdf file. • Write the solution into the fuzzy_phrases/solution.py. Please do not change the input and output contract of the def phrasel_search(P, Queries) -> [[string]] function as the testing of the code correctness will be done programmatically. • Note - You can only use standard python libraries. ex - json, random, etc
13 lines (11 sloc)
411 Bytes
import json
def phrasel_search(P, Queries):
# Write your solution here
ans = [[]]
return ans
if
name_ == "_main_":
with open('sample.json', 'r') as f:
sample_data - json.loads (f.read())
P, Queries = sample_data['phrases'], sample_data['queries']
returned_ans = phrasel_search (P, Queries)
10
11
12
13
print('============= ALL TEST PASSED SUCCESSFULLY ===============')
Transcribed Image Text:13 lines (11 sloc) 411 Bytes import json def phrasel_search(P, Queries): # Write your solution here ans = [[]] return ans if name_ == "_main_": with open('sample.json', 'r') as f: sample_data - json.loads (f.read()) P, Queries = sample_data['phrases'], sample_data['queries'] returned_ans = phrasel_search (P, Queries) 10 11 12 13 print('============= ALL TEST PASSED SUCCESSFULLY ===============')
You have a large list of phrases PO. i.e -> ["i would have", "they love", i analyzed", "made
decision", .]
You will be given Queries[query_string]. i.e -> ["since this morning i have analyzed all the data
from the company and made my decision", "they love the idea"]
Your task is to fuzzy search all the phrases in the query string. For the above example, the
resultant search phrases are -> [["i have analyzed", "made my decision"], ["they love"]]
Note: A fuzzy search is that there can be at max extra one word in the phrase.
The query_strings will come one by one online.
Constraints ->
1 < length(P) < 1000000
1< length(query_string) < 100000
1 < length(Queries) < 1000
Example ->
Given ->
P = ["i would have", "they love", i analyzed", "made decision"]
Queries = [
"since this morming i have analyzed all the data from the company and made my decision",
"they love the idea",
Expected Output = [
["i have analyzed", “made my decision"],
["they love"]
Transcribed Image Text:You have a large list of phrases PO. i.e -> ["i would have", "they love", i analyzed", "made decision", .] You will be given Queries[query_string]. i.e -> ["since this morning i have analyzed all the data from the company and made my decision", "they love the idea"] Your task is to fuzzy search all the phrases in the query string. For the above example, the resultant search phrases are -> [["i have analyzed", "made my decision"], ["they love"]] Note: A fuzzy search is that there can be at max extra one word in the phrase. The query_strings will come one by one online. Constraints -> 1 < length(P) < 1000000 1< length(query_string) < 100000 1 < length(Queries) < 1000 Example -> Given -> P = ["i would have", "they love", i analyzed", "made decision"] Queries = [ "since this morming i have analyzed all the data from the company and made my decision", "they love the idea", Expected Output = [ ["i have analyzed", “made my decision"], ["they love"]
33 lines (33 sloc)
885 Bytes
Raw
Blame
"queries": [
"close box son add bad strong afford down bad middle",
"business become for department chap offer business become for chap tell afford aware bad name business become for committee chap normal around egg expect learn prepare ba
"phrases": [
goodbye lot forget",
"health contact ever big",
"balance
"business become for chap",
"approach field",
"else after blow inform",
"around egg expect learn",
"add bad",
"increase
accept",
"close box",
"afford bad"
"solution": [
"close box",
"add bad",
"afford down bad"
1.
"business become for department chap",
"business become for chap",
"afford aware bad",
"business become for committee chap",
"around egg expect learn",
"balance goodbye lot forget"
31
32
33
Transcribed Image Text:33 lines (33 sloc) 885 Bytes Raw Blame "queries": [ "close box son add bad strong afford down bad middle", "business become for department chap offer business become for chap tell afford aware bad name business become for committee chap normal around egg expect learn prepare ba "phrases": [ goodbye lot forget", "health contact ever big", "balance "business become for chap", "approach field", "else after blow inform", "around egg expect learn", "add bad", "increase accept", "close box", "afford bad" "solution": [ "close box", "add bad", "afford down bad" 1. "business become for department chap", "business become for chap", "afford aware bad", "business become for committee chap", "around egg expect learn", "balance goodbye lot forget" 31 32 33
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY