choose.target: Random Target Selection

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Randomly samples words within a given similarity range to the input

Usage

1
choose.target(x,lower,upper,n,tvectors=tvectors,breakdown=TRUE)

Arguments

x

a character vector of length(x) = 1 specifying a word or a sentence/document

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)

breakdown

if TRUE, the function breakdown is applied to the input

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 G?nther

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

cosine, Cosine, neighbors

Examples

1
2
3
4
data(wonderland)

choose.target("mad hatter",lower=.2,upper=.3,
                n=20, tvectors=wonderland)

codymarquart/LSAfun2 documentation built on May 13, 2019, 8:48 p.m.