Compute the cosine semantic similarity between two text variables.

textSimilarity(x, y)

Arguments

x

Word embeddings from textEmbed.

y

Word embeddings from textEmbed.

Value

A vector comprising cosine semantic similarity scores.

See also

Examples

library(dplyr)
#> #> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
wordembeddings <- wordembeddings4 similiarty_scores <- textSimilarity(wordembeddings$harmonytext, wordembeddings$satisfactiontext) comment(similiarty_scores)
#> [1] "x embedding = ..y embedding = ."