Prints a compact scientific report – corpus size, cluster separation, coherence, and topic diversity – and returns a tidy per-topic quality table.
Arguments
- object
An
sbert_topic_modelreturned bytopics().- measure
Coherence measure passed to
coherence().- n_terms
Number of top terms per topic used for coherence and topic diversity.
- ...
Unused; present for S3 compatibility.
Value
Invisibly, a data frame with one row per topic containing topic,
label, n_documents, proportion, and coherence.
Examples
text <- c(
"Cats chase mice", "Dogs chase balls",
"Stocks and bonds trade", "Markets price shares"
)
embeddings <- rbind(c(1, 0), c(0.9, 0.1), c(0, 1), c(0.1, 0.9))
topic_model <- topics(text, 2, embeddings = embeddings, n_terms = 3)
summary(topic_model)
#> Semantic topic model summary
#> documents: 4
#> topics: 2
#> model: precomputed embeddings
#> between/total SS: 99.3%
#> mean npmi coherence: -0.1667
#> topic topic_diversity: 1.000 (top 10 terms)
#>
#> topic label n_documents proportion coherence
#> 1 Cats chase mice 2 0.5 0.0000
#> 2 Stocks and bonds trade 2 0.5 -0.3333
