Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def synonym_queries(synonym_words, queries):
- output = []
- for q1, q2 in queries:
- q1, q2 = q1.split(), q2.split()
- if len(q1) != len(q2):
- output.append(False)
- continue
- result = True
- for i in range(len(q1)):
- w1, w2 = q1[i], q2[i]
- if w1 == w2:
- continue
- elif words_are_synonyms(w1, w2):
- continue
- result = False
- break
- output.append(result)
- return output
Add Comment
Please, Sign In to add comment