sum_wordvec {PsychWordVec}R Documentation

Calculate the sum vector of multiple words.

Description

Calculate the sum vector of multiple words.

Usage

sum_wordvec(data, x = NULL, verbose = TRUE)

Arguments

data

A wordvec (data.table) or embed (matrix), see data_wordvec_load.

x

Can be:

  • NULL: use the sum of all word vectors in data

  • a single word:

    "China"

  • a list of words:

    c("king", "queen")

    cc(" king , queen ; man | woman")

  • an R formula (~ xxx) specifying words that positively and negatively contribute to the similarity (for word analogy):

    ~ boy - he + she

    ~ king - man + woman

    ~ Beijing - China + Japan

verbose

Print information to the console? Defaults to TRUE.

Value

Normalized sum vector.

Download

Download pre-trained word vectors data (.RData): https://psychbruce.github.io/WordVector_RData.pdf

See Also

normalize

most_similar

dict_expand

dict_reliability

Examples

sum_wordvec(normalize(demodata), ~ king - man + woman)


[Package PsychWordVec version 2023.9 Index]