View source: R/centroid_analysis.r
centroid_analysis | R Documentation |
Performs a centroid analysis for a set of words
centroid_analysis(responses,targets = NULL,split=" ",unique.responses = FALSE,
reference.list = NULL,verbose = FALSE,rank.responses = FALSE,
tvectors=tvectors)
responses |
a character vector specifying multiple single words |
targets |
(optional:) a character vector specifying one or multiple single words |
split |
a character vector defining the character used to split the input strings into individual words (white space by default) |
unique.responses |
If |
reference.list |
(optional:) A list of words in reference to which the neighborhood ranks are computed: Only entries in |
verbose |
If |
rank.responses |
If |
tvectors |
the semantic space in which the computation is to be done (a numeric matrix where every row is a word vector) |
The centroid analysis computes the average vector for a set of words. The intended use case is that these words are responses towards a given concept; the centroid then serves as the estimated vector representation for that concept.
An object of class centroid_analysis
. This object is a list consisting of:
$centroid |
The centroid of the response vectors |
$cosines |
The cosine similarity between the response centroid and each target vector |
$ranks.target |
The rank of the response centroid in the neighborhood of each target vector, with reference to |
$ranks.centroid |
The rank of each target in the neighborhood of the response centroid, with reference to |
Fritz Guenther, Aliona Petrenco
Pugacheva, V., & Günther, F. (2024). Lexical choice and word formation in a taboo game paradigm. Journal of Memory and Language, 135, 104477.
cosine
,
Cosine
,
neighbors
data(wonderland)
centroid_analysis(responses=c("mouse","rabbit","cat","king","queen"),targets=c("alice","hare"),
tvectors=wonderland)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.