topic_table: Function to calculate topics and words arrays from the mallet...

Description Usage Arguments Value Examples

View source: R/classes.R

Description

Function to calculate topics and words arrays from the mallet model.

Usage

1
topic_table(model)

Arguments

model

tmTopicModel mallet type model.

Value

topics Array of the topics.

words Array of the most important words in topic.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
library(rJava)
x <- tmCorpus(lapply(1:100, function(x) paste(sample(LETTERS, 11),
                                              collapse = "")))

model <- train(x)
new_x <- tmCorpus(lapply(1:100, function(x) paste(sample(LETTERS, 11),
                                                  collapse = "")))


topic_table(model)

y <- DocumentTermMatrix(x)
rownames(y) <- meta(x, "title")
jss_TM <-
  list(VEM = train(y, k = k, control = list(seed = SEED)),
       VEM_fixed = train(y, k = k,
                         control = list(estimate.alpha = FALSE, seed = SEED)),
       Gibbs = train(y, k = k, method = "Gibbs",
                     control = list(seed = SEED, burnin = 1000,
                                    thin = 100, iter = 1000)))
pred_VEM <- predict(jss_TM$VEM, new_x)

## End(Not run)

textmining documentation built on May 29, 2017, 8:27 p.m.