choose.target {LSAfun} | R Documentation |
Random Target Selection
Description
Randomly samples words within a given similarity range to the input
Usage
choose.target(x,lower,upper,n,tvectors=tvectors)
Arguments
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) |
Details
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).
Value
A named numeric vector. The names of the vector give the target words, the entries their respective cosine similarity to the input.
Author(s)
Fritz Guenther
References
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.
See Also
Examples
data(wonderland)
choose.target("mad hatter",lower=.2,upper=.3,
n=20, tvectors=wonderland)