Description Usage Arguments Value Examples
Return the position of n (by default n = 10) neighbors
of word and their cosine similarities.
1 2 3 4 |
model |
A model as returned by |
word |
The word to extract. |
n |
Number of neightbours to return. |
A tibble of word index and their cosine.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# setup word2vec Julia dependency
setup_word2vec()
# sample corpus
data("macbeth", package = "word2vec.r")
# train model
model_path <- word2vec(macbeth)
# get word vectors
model <- word_vectors(model_path)
# neighbours of macbeth and their cosine
cosine(model, "macbeth", 20L)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.