SHARE
TWEET

Untitled

a guest Jan 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def synonym_queries(synonym_words, queries):
  2.     output = []
  3.     for q1, q2 in queries:
  4.         q1, q2 = q1.split(), q2.split()
  5.         if len(q1) != len(q2):
  6.             output.append(False)
  7.             continue
  8.         result = True
  9.         for i in range(len(q1)):
  10.             w1, w2 = q1[i], q2[i]
  11.             if w1 == w2:
  12.                 continue
  13.             elif words_are_synonyms(w1, w2):
  14.                 continue
  15.             result = False
  16.             break
  17.         output.append(result)
  18.     return output
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top