Learn R Programming

text (version 0.9.90)

textSimilarityMatrix: Compute semantic similarity scores between all combinations in a word embedding

Description

Compute semantic similarity scores between all combinations in a word embedding

Usage

textSimilarityMatrix(x, method = "cosine")

Value

A matrix of semantic similarity scores

Arguments

x

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 textSimilarityNorm and textSimilarityTest

Examples

Run this code
similarity_scores <- textSimilarityMatrix(word_embeddings_4$harmonytext[1:3, ])
round(similarity_scores, 3)

Run the code above in your browser using DataLab