pair_similarity {PsychWordVec} | R Documentation |
Compute a matrix of cosine similarity/distance of word pairs.
Description
Compute a matrix of cosine similarity/distance of word pairs.
Usage
pair_similarity(
data,
words = NULL,
pattern = NULL,
words1 = NULL,
words2 = NULL,
distance = FALSE
)
Arguments
data |
A |
words |
[Option 1] Character string(s). |
pattern |
[Option 2] Regular expression (see |
words1 , words2 |
[Option 3] Two sets of words for only n1 * n2 word pairs. See examples. |
distance |
Compute cosine distance instead?
Defaults to |
Value
A matrix of pairwise cosine similarity/distance.
Download
Download pre-trained word vectors data (.RData
):
https://psychbruce.github.io/WordVector_RData.pdf
See Also
Examples
pair_similarity(demodata, c("China", "Chinese"))
pair_similarity(demodata, pattern="^Chi")
pair_similarity(demodata,
words1=c("China", "Chinese"),
words2=c("Japan", "Japanese"))
[Package PsychWordVec version 2023.9 Index]