MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / find_analogies

Function find_analogies

nlp_class2/pretrained_w2v.py:38–40  ·  view source on GitHub ↗
(w1, w2, w3)

Source from the content-addressed store, hash-verified

36# ('pablo', 0.5631559491157532),
37# ('malta', 0.5620371103286743)]
38def find_analogies(w1, w2, w3):
39 r = word_vectors.most_similar(positive=[w1, w3], negative=[w2])
40 print("%s - %s = %s - %s" % (w1, w2, r[0][0], w3))
41
42def nearest_neighbors(w):
43 r = word_vectors.most_similar(positive=[w])

Callers 1

pretrained_w2v.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected