Search code examples
rnlpword-embeddingr-text

"`select()` doesn't handle lists" when computing textSimilarity between two word embeddings in R


How many words in word embedding variables do you need to compute semantic similarity in r-package text? I’m trying to run:

library(text)
WEhello<-textEmbed("hello")
WEgoodbye<-textEmbed("goodbye")
textSimilarity(WEhello, WEgoodbye)

But I get this error:

Error in `dplyr::select()`:
! `select()` doesn't handle lists.

Solution

  • To get this to work you have to select the word embedding (and avoid also including the $singlewords_we). Try this:

    textSimilarity(WEhello$x, WEgoodbye$x)