Learn R Programming

fuzzylink (version 0.2.1)

get_similarity_matrix: Create matrix of embedding similarities

Description

Create a matrix of pairwise similarities between each string in strings_A and strings_B.

Usage

get_similarity_matrix(embeddings, strings_A = NULL, strings_B = NULL)

Value

A matrix of cosine similarities between the embeddings of strings_A and the embeddings of strings_B

Arguments

embeddings

A matrix of text embeddings

strings_A

A string vector

strings_B

A string vector

Examples

Run this code

if (FALSE) {
embeddings <- get_embeddings(c('UPS', 'USPS', 'Postal Service'))
get_similarity_matrix(embeddings)
get_similarity_matrix(embeddings, 'Postal Service')
get_similarity_matrix(embeddings, 'Postal Service', c('UPS', 'USPS'))
}

Run the code above in your browser using DataLab