Compute similarity between word or document vectors
Source:R/utils.R
similarity.textmodel_wordvector.RdCompute the cosine similarity between word vectors for selected words.
Usage
# S3 method for class 'textmodel_wordvector'
similarity(
x,
targets,
layer = c("words", "documents"),
mode = c("character", "numeric"),
...
)Value
a matrix of cosine similarity scores when mode = "numeric" or of
words sorted in descending order by the similarity scores when mode = "character".
When targets is a named numeric vector, word (or document) vectors are weighted and summed
before computing similarity scores.