Cosine: Compute cosine similarity

View source: R/Cosine.r

CosineR Documentation

Compute cosine similarity

Description

Computes the cosine similarity for two single words

Usage

Cosine(x,y,tvectors=tvectors)

Arguments

x

A single word, given as a character of length(x) = 1

y

A single word, given as a character of length(y) = 1

tvectors

the semantic space in which the computation is to be done (a numeric matrix where every row is a word vector)

Details

Instead of using numeric vectors, as the cosine() function from the lsa package does, this function allows for the direct computation of the cosine between two single words (i.e. Characters). which are automatically searched for in the LSA space given in as tvectors.

Value

The cosine similarity as a numeric

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.

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://wordvec.colorado.edu/

See Also

distance asym

Examples

data(wonderland)

Cosine("alice","rabbit",tvectors=wonderland)

LSAfun documentation built on Nov. 18, 2023, 1:10 a.m.