(base) ling581-24$ python bfs.py mend.v.1 tear.v.1 start: mend.v.1 is in synset repair.v.01 end: tear.v.1 is in synset tear.v.01 Found at distance 4 (13610 nodes expanded) tear.v.01 deriv_related rupture.n.03 hyponyms breakage.n.03 deriv_related break.v.04 antonyms repair.v.01 Found at distance 4 (13856 nodes expanded) tear.v.01 hyponyms separate.v.02 hypernyms sever.v.01 also_sees break.v.04 antonyms repair.v.01 Search space complete DiGraph with 7 nodes and 7 edges (base) ling581-24$ python bfs.py fix.v.1 flat.a.1 start: fix.v.1 is in synset repair.v.01 end: flat.a.1 is in synset flat.s.01 Not found (distance 5 and 100021 nodes expanded) (base) ling581-24$ python bfs.py -m 1000000 fix.v.1 flat.a.1 start: fix.v.1 is in synset repair.v.01 end: flat.a.1 is in synset flat.s.01 Not found (distance 6 and 1000004 nodes expanded) (base) ling581-24$ python bfs.py -m 1000000 fix.v.1 flat.a.2 start: fix.v.1 is in synset repair.v.01 end: flat.a.2 is in synset flat.s.02 Not found (distance 6 and 1000004 nodes expanded) (base) ling581-24$ python bfs.py -m 1000000 fix.v.1 flat.a.7 start: fix.v.1 is in synset repair.v.01 end: flat.a.7 is in synset compressed.s.03 Not found (distance 6 and 1000004 nodes expanded) (base) ling581-24$ (base) ling581-24$ python bfs.py -m 1000000 fix.v.1 deflate.v.6 start: fix.v.1 is in synset repair.v.01 end: deflate.v.6 is in synset deflate.v.06 Found at distance 6 (851961 nodes expanded) deflate.v.06 hyponyms decrease.v.01 deriv_related decrease.n.01 deriv_related decrease.v.02 hyponyms change.v.01 hypernyms better.v.02 hypernyms repair.v.01 DiGraph with 7 nodes and 6 edges (base) ling581-24$ python bfs.py -m 1000000 clean.v.1 dirty.a.1 start: clean.v.1 is in synset clean.v.01 end: dirty.a.1 is in synset dirty.a.01 Found at distance 3 (3962 nodes expanded) dirty.a.01 deriv_related dirt.n.02 deriv_related dirty.v.01 antonyms clean.v.01 Found at distance 3 (3984 nodes expanded) dirty.a.01 deriv_related dirt.n.02 deriv_related dirty.v.01 antonyms clean.v.01 Search space complete DiGraph with 4 nodes and 3 edges (base) ling581-24$ python bfs.py -m 1000000 fill.v.1 empty.a.1 start: fill.v.1 is in synset fill.v.01 end: empty.a.1 is in synset empty.a.01 Not found (distance 5 and 1000000 nodes expanded) (base) ling581-24$ python bfs.py -m 1000000 fill.v.1 empty.v.1 start: fill.v.1 is in synset fill.v.01 end: empty.v.1 is in synset empty.v.01 Found at distance 1 (27 nodes expanded) empty.v.01 antonyms fill.v.01 Search space complete DiGraph with 2 nodes and 1 edges (base) ling581-24$ (base) ling581-24$ python Python 3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:38:11) [Clang 14.0.6 ] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import nltk >>> import gensim >>> from nltk.data import find >>> word2vec_sample = str(find('models/word2vec_sample/pruned.word2vec.txt')) >>> model = gensim.models.KeyedVectors.load_word2vec_format(word2vec_sample, binary=False) >>> model.most_similar(positive=['flat','tire'], negative=['fix'], topn=5) [('tires', 0.5352495908737183), ('chassis', 0.35741865634918213), ('Tires', 0.35724493861198425), ('Tire', 0.35435542464256287), ('rigids', 0.35333168506622314)] >>> model.most_similar(positive=['deflate','tire'], negative=['fix'], topn=5) Traceback (most recent call last): File "", line 1, in File "/Users/sandiway/opt/anaconda3/lib/python3.9/site-packages/gensim/models/keyedvectors.py", line 841, in most_similar mean = self.get_mean_vector(keys, weight, pre_normalize=True, post_normalize=True, ignore_missing=False) File "/Users/sandiway/opt/anaconda3/lib/python3.9/site-packages/gensim/models/keyedvectors.py", line 518, in get_mean_vector raise KeyError(f"Key '{key}' not present in vocabulary") KeyError: "Key 'deflate' not present in vocabulary" >>> >>> model.most_similar(positive=['deflated','tire'], negative=['fix'], topn=5) [('tires', 0.5590618252754211), ('Tires', 0.39363858103752136), ('Tire', 0.38084614276885986), ('punctured', 0.34828218817710876), ('crushed', 0.3400101661682129)] >>> >>>