similarity.Rd
Return the cosine similarity value between two words word1
and word2
.
similarity(model, word1, word2) # S3 method for wordvectors similarity(model, word1, word2)
model | A model as returned by |
---|---|
word1, word2 | Words to compare. |
# 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) # similarity b/w macbeth and wife similarity(model, "macbeth", "king") # }