`cosine.Rd`

Return the position of `n`

(by default `n = 10`

) neighbors
of `word`

and their cosine similarities.

cosine(model, word, n = 10L) # S3 method for wordvectors cosine(model, word, n = 10L)

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`

.

# 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) # }