Aug-05-2020, 06:11 AM
In https://github.com/src-d/wmd-relax is implemented Fast Word Mover's Distance.
Distance between words I try compute by shortest path of Wordnet.(comparing)
Here is code:
but
1.what means embeddings = [[0.1, 1], [1, 0.1]]
2.what is [0, 1]
3.what is [1.5, 0.5]
how compare
"Politician speaks to the media in Illinois."
"The president greets the press in Chicago."
especially without word2vec but shortest path?
Distance between words I try compute by shortest path of Wordnet.(comparing)
Here is code:
import numpy from wmd import WMD embeddings = numpy.array([[0.1, 1], [1, 0.1]], dtype=numpy.float32) nbow = {"first": ("#1", [0, 1], numpy.array([1.5, 0.5], dtype=numpy.float32)), "second": ("#2", [0, 1], numpy.array([0.75, 0.15], dtype=numpy.float32))} calc = WMD(embeddings, nbow, vocabulary_min=2) print(calc.nearest_neighbors("first"))is small vocabulary_min=2
but
1.what means embeddings = [[0.1, 1], [1, 0.1]]
2.what is [0, 1]
3.what is [1.5, 0.5]
how compare
"Politician speaks to the media in Illinois."
"The president greets the press in Chicago."
especially without word2vec but shortest path?