% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topic_modeling.R
\name{find_topic_matches}
\alias{find_topic_matches}
\title{Find Similar Topics}
\usage{
find_topic_matches(
  topic_model,
  query,
  top_n = 10,
  method = "cosine",
  embedding_model = "all-MiniLM-L6-v2",
  include_terms = TRUE
)
}
\arguments{
\item{topic_model}{A topic model object (semantic topic model or STM model).}

\item{query}{A character string representing the query topic.}

\item{top_n}{The number of similar topics to return (default: 10).}

\item{method}{The similarity method: "cosine", "euclidean", "embedding".}

\item{embedding_model}{The embedding model to use for query encoding (default: "all-MiniLM-L6-v2").}

\item{include_terms}{Logical, whether to include topic terms in the similarity calculation (default: TRUE).}
}
\value{
A list containing similar topics and their similarity scores.
}
\description{
This function finds the most similar topics to a given query using semantic similarity analysis.
It works with both semantic topic models and traditional STM models by creating topic representations
using transformer embeddings and calculating cosine similarity scores.
}
\examples{
if (interactive()) {
  mydata <- TextAnalysisR::SpecialEduTech
  united_tbl <- TextAnalysisR::unite_cols(
    mydata,
    listed_vars = c("title", "keyword", "abstract")
  )
  texts <- united_tbl$united_texts

  topic_model <- TextAnalysisR::fit_embedding_model(
    texts = texts,
    method = "umap_hdbscan",
    n_topics = 8
  )

  similar_topics <- TextAnalysisR::find_topic_matches(
    topic_model = topic_model,
    query = "mathematical learning",
    top_n = 5
  )

  print(similar_topics)
}
}
\concept{topic-modeling}
