Learn R Programming

text (version 0.9.90)

textSimilarity: Compute the semantic similarity between two text variables.

Description

Compute the semantic similarity between two text variables.

Usage

textSimilarity(x, y, method = "cosine")

Value

A vector comprising semantic similarity scores.

Arguments

x

Word embeddings from textEmbed.

y

Word embeddings from textEmbed.

method

Character string describing type of measure to be computed. Default is "cosine" (see also measures from textDistance() (which here is computed as 1 - textDistance) including "euclidean", "maximum", "manhattan", "canberra", "binary" and "minkowski").

See Also

see textDistance, textSimilarityNorm and textSimilarityTest

Examples

Run this code
library(dplyr)
similarity_scores <- textSimilarity(
  word_embeddings_4$harmonytext,
  word_embeddings_4$satisfactiontext
)
comment(similarity_scores)

Run the code above in your browser using DataLab