% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topic_modeling.R
\name{get_topic_texts}
\alias{get_topic_texts}
\title{Convert Topic Terms to Text Strings}
\usage{
get_topic_texts(
  top_terms_df,
  topic_var = "topic",
  term_var = "term",
  weight_var = NULL,
  sep = " ",
  top_n = NULL
)
}
\arguments{
\item{top_terms_df}{A data frame containing top terms for topics, typically
output from \code{\link{get_topic_terms}}.}

\item{topic_var}{Name of the column containing topic identifiers (default: "topic").}

\item{term_var}{Name of the column containing terms (default: "term").}

\item{weight_var}{Optional name of column with term weights (e.g., "beta").
If provided, terms are ordered by weight before concatenation.}

\item{sep}{Separator between terms (default: " ").}

\item{top_n}{Optional number of top terms to include per topic (default: NULL, uses all).}
}
\value{
A character vector of topic text strings, one per topic, ordered by topic number.
}
\description{
Concatenates top terms for each topic into text strings suitable for
embedding generation. Useful for creating topic representations for
semantic similarity analysis.
}
\examples{
# Topic-term frame as produced by get_topic_terms()
top_terms <- data.frame(
  topic = c(1, 1, 1, 2, 2, 2),
  term  = c("calculator", "arithmetic", "elementary",
            "computer", "instruction", "multiplication"),
  prob  = c(0.10, 0.08, 0.07, 0.12, 0.09, 0.06)
)
get_topic_texts(top_terms)
get_topic_texts(top_terms, weight_var = "prob", top_n = 2)
}
\concept{topic-modeling}
