Question: the code should be python Change the Boolean matching logic implementation from the class (boolean_term_match function) to use set operations instead of looping over the
the code should be python
Change the Boolean matching logic implementation from the class (boolean_term_match function) to use set operations instead of looping over the query terms and using 'not in' operator. The function signature should not change.
def boolean_term_match(query: str, document: str) -> bool;
query_terms: typing.list[str] = query.lower().split()
document_terms: typing.list[str] = document.lower().split()
for term in query_terms:
if term not in document_terms:
return false
return true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
