Skip to contents

Title

Usage

calculate_semantic_coherence(dtm, K_values, n_seeds, seed)

Arguments

dtm

document term matrix (quanteda::dfm or tm::tm)

K_values

vector for k values

n_seeds

number of different random initializations for every k value

seed

if seeds should be reproducible

Value

tibble with LDA models and semantic coherence

Examples

if (FALSE) {
dtm <- aspol |>
preprocess_corpus(kunta) |>
 dplyr::count(kunta, LEMMA) |>
 tidytext::cast_dfm(kunta, LEMMA, n)

 future::plan(future::multisession, workers = future::availableCores(logical = FALSE) - 1)

 progressr::with_progressor({calculate_semantic_coherence(dtm = dtm, K_values = seq(5, 10, by = 5),
                              n_seeds = 1, seed = 1234)})
}