Commit 018e62f0 authored by Ken Kawamoto's avatar Ken Kawamoto Committed by Neal Wu
Browse files

Prevent analogy() from printing spurious "unknown" (#2584)

parent 57014e4c
...@@ -482,7 +482,7 @@ class Word2Vec(object): ...@@ -482,7 +482,7 @@ class Word2Vec(object):
for c in [self._id2word[i] for i in idx[0, :]]: for c in [self._id2word[i] for i in idx[0, :]]:
if c not in [w0, w1, w2]: if c not in [w0, w1, w2]:
print(c) print(c)
break return
print("unknown") print("unknown")
def nearby(self, words, num=20): def nearby(self, words, num=20):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment