Skip to content

Instantly share code, notes, and snippets.

View adamochayon's full-sized avatar

Adam Ochayon adamochayon

View GitHub Profile
...
synonyms = defaultdict(set)
for w1, w2 in synonym_words:
synonyms[w1].add(w2)
...
elif (w2 in synonyms.get(w1, tuple()) or
w1 in synonyms.get(w2, tuple())):
continue