Skip to contents

This function implements a simple non-negative matrix factorization (NMF) approach to topic modeling, without requiring additional packages.

Usage

extract_topics(
  text_data,
  text_column = "abstract",
  n_topics = 5,
  max_terms = 10,
  n_iterations = 50
)

Arguments

text_data

A data frame containing the text data

text_column

Name of the column containing the text

n_topics

Number of topics to extract

max_terms

Maximum number of terms per topic to return

n_iterations

Number of iterations for the NMF algorithm

Value

A list containing topic-term and document-topic matrices

Examples

if (FALSE) { # \dontrun{
topics <- extract_topics(article_data, text_column = "abstract", n_topics = 5)
} # }