`R/3_1_textSimilarity.R`

`textSimilarityMatrix.Rd`

Compute semantic similarity scores between all combinations in a word embedding

`textSimilarityMatrix(x, method = "cosine")`

- 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").

A matrix of semantic similarity scores

see `textSimilarityNorm`

and `textSimilarityTest`

```
similarity_scores <- textSimilarityMatrix(word_embeddings_4$harmonytext[1:3, ])
round(similarity_scores, 3)
#> [,1] [,2] [,3]
#> [1,] 1.000 0.838 0.722
#> [2,] 0.838 1.000 0.884
#> [3,] 0.722 0.884 1.000
```