Skip to content

Instantly share code, notes, and snippets.

@alexgolec
Created January 18, 2019 16:33
Show Gist options
  • Save alexgolec/2b8d5a89a6d146abc31430c42157b4bd to your computer and use it in GitHub Desktop.
Save alexgolec/2b8d5a89a6d146abc31430c42157b4bd to your computer and use it in GitHub Desktop.
...
synonyms = defaultdict(set)
for w1, w2 in synonym_words:
synonyms[w1].append(w2)
...
elif (w2 in synonyms.get(w1, tuple()) or
w1 in synonyms.get(w2, tuple())):
continue
@adamochayon
Copy link

Hey Alex!
You seem to have a bug in the gist - you cannot append to a set but rather add.
I forked the gist with the correction here-
https://gist.github.com/adamochayon/51a17b95dd3d73aa6572d67a02b33f90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment