Skip to contents

This function takes a matrix of cosine similarity values, where the row and column names are tokens. The values will be calculated for the columns (so if you have a non-square) matrix, make sure the columns are the values you want.

Usage

top_n(similarity, n)

Arguments

similarity

the matrix of cosine values.

n

the number of most related cosine values you want to return. Remember that you will get token-token cosine back as a value of 1, so use n+1 to get the number you want.

Value

A dataframe of token-token-cosine values.

Examples

# af_top_sim <- top_n(af_cosine, 6)