sentopics_labels | R Documentation |
Extract or replace the labels of a sentopicmodel
. The replaced
labels will appear in most functions dealing with the output of the
sentomicmodel
.
sentopics_labels(x, flat = TRUE)
sentopics_labels(x) <- value
x |
a |
flat |
if FALSE, return a list of dimension labels instead of a character vector. |
value |
a list of future labels for the topic model. The list should be named and contain a character vector for each dimension to label. See the examples for a correct usage. |
a character vector of topic/sentiment labels.
Olivier Delmarcelle
mergeTopics
Other sentopics helpers:
sentopics_date()
,
sentopics_sentiment()
# by default, sentopics_labels() generate standard topic names
lda <- LDA(ECB_press_conferences_tokens)
sentopics_labels(lda)
# to change labels, a named list must be provided
sentopics_labels(lda) <- list(
topic = paste0("superTopic", 1:lda$K)
)
sentopics_labels(lda)
# using NULL remove labels
sentopics_labels(lda) <- NULL
sentopics_labels(lda)
# also works for JST/rJST models
jst <- JST(ECB_press_conferences_tokens)
sentopics_labels(jst) <- list(
topic = paste0("superTopic", 1:jst$K),
sentiment = c("negative", "neutral", "positive")
)
sentopics_labels(jst)
# setting flat = FALSE return a list or labels for each dimension
sentopics_labels(jst, flat = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.