multicostring: Sentence x Vector Comparison

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

Description

Computes cosines between a sentence/ document and multiple words

Usage

1
multicostring(x,y,tvectors=tvectors,breakdown=TRUE)

Arguments

x

a character vector specifying a sentence/ document (or also a single word)

y

a character vector specifying multiple single words

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

The format of x (or y) can be of the kind x <- "word1 word2 word3" , but also of the kind x <- c("word1", "word2", "word3"). This allows for simple copy&paste-inserting of text, but also for using character vectors, e.g. the output of neighbors.
Both x and y can also just consist of one single word. For computing the vector for the document/ sentence specified in x, the simple Addition model is used (see costring).

Value

A numeric giving the cosine between the input sentences/documents

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.

Dennis, S. (2007). How to use the LSA Web Site. In T. K. Landauer, D. S. McNamara, S. Dennis, & W. Kintsch (Eds.), Handbook of Latent Semantic Analysis (pp. 35-56). Mahwah, NJ: Erlbaum.

http://lsa.colorado.edu/

See Also

cosine, Cosine, multicos, multicostring

Examples

1
2
3
4
5
6
7
8
9
data(wonderland)

multicostring("Alice was beginning to get very tired.",
        "A white rabbit with a clock ran close to her.",
        tvectors=wonderland)

multicostring("Suddenly, a cat appeared in the woods",
names(neighbors("cheshire",n=20,tvectors=wonderland)), 
tvectors=wonderland)

codymarquart/LSAfun documentation built on May 13, 2019, 8:47 p.m.