Learn R Programming

wordvector (version 0.1.0)

analogy: [experimental] Find analogical relationships between words

Description

[experimental] Find analogical relationships between words

Usage

analogy(x, formula, n = 10, exclude = TRUE, type = c("word", "simil"))

Value

a data.frame with the words sorted and their cosine similarity sorted in descending order.

Arguments

x

a textmodel_wordvector object.

formula

a formula object that defines the relationship between words using + or - operators.

n

the number of words in the resulting object.

exclude

if TRUE, words in formula are excluded from the result.

type

specify the type of vectors to be used. "word" is word vectors while "simil" is similarity vectors.

References

Mikolov, T., Sutskever, I., Chen, K., Corrado, G., & Dean, J. (2013). Distributed Representations of Words and Phrases and their Compositionality. http://arxiv.org/abs/1310.4546.

Examples

Run this code
# \donttest{
# from Mikolov et al. (2023)
analogy(wdv, ~ berlin - germany + france)
analogy(wdv, ~ quick - quickly + slowly)
# }

Run the code above in your browser using DataLab