Learn R Programming

text (version 0.9.50)

textSimilarityNorm: Compute the semantic similarity between a text variable and a word norm (i.e., a text represented by one word embedding that represent a construct).

Description

Compute the semantic similarity between a text variable and a word norm (i.e., a text represented by one word embedding that represent a construct).

Usage

textSimilarityNorm(x, y)

Arguments

x

Word embeddings from textEmbed (with several rows of text).

y

Word embedding from textEmbed (from only one text).

Value

A vector comprising cosine semantic similarity scores.

See Also

see textSimilarity and textSimilarityTest

Examples

Run this code
# NOT RUN {
library(dplyr)
library(tibble)
harmonynorm <- c("harmony peace ")
satisfactionnorm <- c("satisfaction achievement")

norms <- tibble::tibble(harmonynorm, satisfactionnorm)
word_embeddings <- word_embeddings_4
word_embeddings_wordnorm <- textEmbed(norms)
similarity_scores <- textSimilarityNorm(
  word_embeddings$harmonytext,
  word_embeddings_wordnorm$harmonynorm
)
# }

Run the code above in your browser using DataLab