most_similar: Calculate the words most similar to an input word.

Description Usage Arguments Value References Examples

View source: R/top_relations.R

Description

The similarity between two vectors is determined as follows:

cos(x,y) = (a • b) / (||a|| ||b||)

where (a • b) is equal to the dot product of a and b, and (||a|| ||b||) is equal to the magnitude of a and b. This formula returns the angle between the two vectors.

Usage

1
most_similar(m, word, num_results = 10)

Arguments

m

A matrix.

word

An entry in m.

num_results

Number of results to display.

Value

A data table of words in m most similar to x.

References

“Word-Vectors and Search Engines.” Geometry and Meaning, by Dominic Widdows, CSLI Publications, 2004, pp. 132–166.

Examples

1
most_similar(W, "loue")

ajfabry/Statspeare documentation built on Jan. 26, 2020, 7:44 a.m.