Skip to contents

Calculate FREX ranked words and values for a topic

Usage

frex_topic(beta, vocab, topic = 1, top_n = NULL, frex_weight = 0.5)

Arguments

beta

A numeric matrix of dimension (topics x words) representing the probability distribution of words within each topic. Each row should sum to 1. Beta must be on the probability scale (not log scale).

vocab

a character vector of vocabulary terms corresponding to the columns of beta.

topic

the topic index that we want to calculate, the default is 1.

top_n

the number of top words to return, the default is to return all words.

frex_weight

the weight between 0 and 1 controlling the balance between frequency and exclusivity in the FREX metric. Weight closer to 1 is favoring exclusivity and closer to 0 is favoring frequency, we set the default as 0.5.

Value

a data frame with ranks, words, and FREX values of the words