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 *** This is the most important one **Basically the folder that' contains the dictionary is in a json file called, sample.json, so you wanna have a code that apparently use two parameters and  the phrase apparently loops through the queries , inside the json file where the dictionary is found in the  json file called sample.json 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.The sample.json is the json text file.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter1: An Overview Of Computers And Programming Languages
Section: Chapter Questions
Problem 18SA: 18. Tom and Jerry opened a new lawn service. They provide three types of services: mowing,...
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
    • *** This is the most important one **Basically the folder that' contains the dictionary is in a json file called, sample.json, so you wanna have a code that apparently use two parameters and  the phrase apparently loops through the queries , inside the json file where the dictionary is found in the  json file called sample.json

    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.The sample.json is the json text file.

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 ===============')
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
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"]
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
O 20 points.json
Add fuzzy phrasal search problem
12 days ago
D 30_points.json
Add fuzzy phrasal search problem
12 days ago
O 50 points,json
Add fuzzy phrasal search problem
12 days ago
O problem_statement.pdf
Add fuzzy phrasal search problem
12 days ago
sample.json
Add fuzzy phrasal search problem
12 days ago
solution.py
Add sample solution.py and update Readme
12 days ago
oo00 o o
Transcribed Image Text:O 20 points.json Add fuzzy phrasal search problem 12 days ago D 30_points.json Add fuzzy phrasal search problem 12 days ago O 50 points,json Add fuzzy phrasal search problem 12 days ago O problem_statement.pdf Add fuzzy phrasal search problem 12 days ago sample.json Add fuzzy phrasal search problem 12 days ago solution.py Add sample solution.py and update Readme 12 days ago oo00 o o
Expert Solution
Step 1

Answer:

I have done code and also I have attached code.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
C-string
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning