top_n | R Documentation |
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.
top_n(similarity, n)
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. |
A dataframe of token-token-cosine values.
# af_top_sim <- top_n(af_cosine, 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.