Description Usage Arguments Examples
Compute the analogy similarity between two lists of words. The positions
and the similarity values of the top n
similar words will be returned.
For example: "king - man + woman =~ queen"
1 2 3 4 5 6 7 8 9 | analogy(model, pos, neg, n = 5L)
## S3 method for class 'wordvectors'
analogy(model, pos, neg, n = 5L)
analogy_words(model, pos, neg, n = 5L)
## S3 method for class 'wordvectors'
analogy_words(model, pos, neg, n = 5L)
|
model |
A model as returned by |
pos, neg |
Positive and negative words. |
n |
Number of neightbours to return. |
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)
# "king - man + woman =~ queen"
analogy_words(model, pos = list("king"), neg = list("malcolme"), 8L)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.