Skip to contents

Unified helper that produces the long-format data.frame(topic, term, beta) expected by generate_topic_labels() from an STM model, an embedding result, or a hybrid result. Dispatches on the object's structure:

  • STM model (has $beta$logbeta and $vocab) -> top terms via stm::labelTopics() FREX

  • Embedding result (has $topic_keywords) -> c-TF-IDF keywords with rank-derived pseudo-beta

  • Hybrid result (has $combined_topics) -> weighted combined keywords

Usage

extract_topic_terms_df(model, n = 7)

Arguments

model

A topic model object (STM fit, embedding result, or hybrid result).

n

Number of top terms per topic (default 7).

Value

data.frame(topic, term, beta) in long format.