powered by
A high-level wrapper around Python 'BERTopic'. Python dependencies are checked at runtime.
bertopic_fit(text, embeddings = NULL, ...)
An S3 object of class "bertopic_r" containing:
.py: the underlying Python model (reticulate object)
.py
topics: integer vector of topic assignments
topics
probs: numeric matrix/data frame of topic probabilities (if available)
probs
Character vector of documents.
Optional numeric matrix (n_docs x dim). If supplied, passed through to Python.
Additional arguments forwarded to bertopic.BERTopic(...).
bertopic.BERTopic(...)
if (FALSE) { if (reticulate::py_module_available("bertopic")) { m <- bertopic_fit(c("a doc", "another doc")) print(class(m)) } }
Run the code above in your browser using DataLab