son, but there's no code looping through it , its just codes that were presented me as a solution to me through bartleby, but it's calling from no parameter therefore running an error 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]] fun
Please the First two solutions bartleby gave me dont work, i attached a link for you too take a look at it yourself.
I need to loop through the json file text as sample.json, but there's no code looping through it , its just codes that were presented me as a solution to me through bartleby, but it's calling from no parameter therefore running an error
- 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.
(This is where you can see the question directly)
Supposingly the code which they gave to me some weeks ago, doesn't work after all editing i was hoping the coder at bartleby could give it a try for themselves.
https://github.com/JakeMofa/interview-questions
EDITABLE CODE
def phrasel_search(P,Queries):
x1=pd.DataFrame(Queries)
x2=pd.DataFrame(p)
m1=[]
m2=[]
p=[]
l1=x1['name'].tolist();
l2=x2['name'].tolist();
threshold=82
for i in l1:
m1.append(process.extract(i,l2,limit=2))
x1['matches']=m1
for j in x1['matches']:
for k in j:
if k[1]>=threshold;
p.append(k[0])
m2.append(",".join(p))
p=[]
return x1
Step by step
Solved in 2 steps with 1 images