View source: R/choose.target.r
choose.target | R Documentation |
Randomly samples words within a given similarity range to the input
choose.target(x,lower,upper,n,tvectors=tvectors)
x |
a character vector of |
lower |
the lower bound of the similarity range; a numeric |
upper |
the upper bound of the similarity range; a numeric |
n |
an integer giving the number of target words to be sampled |
tvectors |
the semantic space in which the computation is to be done (a numeric matrix where every row is a word vector) |
Computes cosine values between the input x
and all the word vectors in tvectors
. Then only selects words with a cosine similarity between lower
and upper
to the input, and randomly samples n
of these words.
This function is designed for randomly selecting target words with a predefined similarity towards a given prime word (or sentence/document).
A named numeric vector. The names of the vector give the target words, the entries their respective cosine similarity to the input.
Fritz Guenther
Landauer, T.K., & Dumais, S.T. (1997). A solution to Plato's problem: The Latent Semantic Analysis theory of acquisition, induction and representation of knowledge. Psychological Review, 104, 211-240.
cosine
,
Cosine
,
neighbors
data(wonderland)
choose.target("mad hatter",lower=.2,upper=.3,
n=20, tvectors=wonderland)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.