% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topic_modeling.R
\name{calculate_topic_probability}
\alias{calculate_topic_probability}
\title{Calculate Topic Probabilities}
\usage{
calculate_topic_probability(stm_model, top_n = 10, verbose = TRUE, ...)
}
\arguments{
\item{stm_model}{A fitted STM model object from stm::stm().}

\item{top_n}{Number of top topics to display by prevalence (default: 10).}

\item{verbose}{Logical, if TRUE prints progress messages (default: TRUE).}

\item{...}{Additional arguments passed to tidytext::tidy().}
}
\value{
A DT::datatable showing topics and their mean gamma (prevalence) values,
rounded to 3 decimal places.
}
\description{
Extracts and summarizes topic probabilities (gamma values) from an STM model,
returning a formatted data table of mean topic prevalence.
}
\examples{
if (interactive()) {
  data <- TextAnalysisR::SpecialEduTech
  united <- unite_cols(data, c("title", "keyword", "abstract"))
  tokens <- prep_texts(united, text_field = "united_texts")
  dfm_obj <- quanteda::dfm(tokens)
  stm_data <- quanteda::convert(dfm_obj, to = "stm")

  topic_model <- stm::stm(
    documents = stm_data$documents,
    vocab = stm_data$vocab,
    K = 10,
    verbose = FALSE
  )

  prob_table <- calculate_topic_probability(topic_model, top_n = 10)
  print(prob_table)
}
}
\concept{topic-modeling}
