The error is:
> lda_model = LDA$new(n_topics = 3, vocabulary = vocab, doc_topic_prior = 0.1, topic_word_prior = 0.01)
Error in .subset2(public_bind_env, "initialize")(...) :
unused argument (vocabulary = list(term = c("normal", "bobo", "lixo", "sozinho", "triste", "santo", "dificil", "homem", "querido", "doido", "puta", "namorado", "viciado", "grosso", "anjo", "maravilhoso", "otario", "ciumento", "feio", "pessimo", "idiota", "bonito", "capaz", "otimo", "pior", "serio", "foda", "ruim", "fofo", "merda", "lerdo", "novo", "velho", "mal", "chato", "legal", "feliz", "burro", "unico", "trouxa", "boa", "ninguem", "lindo", "melhor", "amigo", "louco", "apaixonado"), term_count = c(205,
215, 219, 222, 223, 232, 235, 241, 251, 261, 263, 264, 274, 276, 280, 280, 282, 284, 305, 311, 323, 333, 352, 354, 355, 363, 369, 380, 397, 405, 411, 421, 434, 458, 544, 577, 589, 628, 638, 690, 796, 826, 896, 936, 1177, 1251, 1344), doc_count = c(191, 187, 166, 212, 196, 214, 218, 219, 231, 205, 239, 230, 249, 235, 242, 253, 258, 256, 242, 278, 296, 275, 310, 314, 332, 319, 324, 345, 315, 341, 339, 356, 365, 409, 466, 480, 500, 525, 577, 557, 670, 707, 702, 785, 972, 981,
>
I'm getting the error when running LDA$new
after vocabulary, tokenizer and dtm were successfully created. The full code is:
current_dir_files = list.files(path = ".", full.names = TRUE)
files_iterator = ifiles(current_dir_files, reader = read_file)
it_tokens <- itoken(files_iterator, preprocess_function = tolower,
tokenizer = word_tokenizer, progressbar = TRUE)
vocab <- create_vocabulary(it_tokens, stopwords = words.remove) %>%
prune_vocabulary(term_count_min = 200, doc_proportion_max = 0.1)
vec <- vocab_vectorizer(vocabulary = vocab)
dtm <- create_dtm(it = it_tokens, vectorizer = vec)
lda_model = LDA$new(n_topics = 3, vocabulary = vocab, doc_topic_prior = 0.1, topic_word_prior = 0.01)
I'm using ‘text2vec’ version 0.5.0, R 3.4.1 64bits, RStudio 1.0.153.
Please check documentation -
?LDA
and http://text2vec.org/topic_modeling.html#latent_dirichlet_allocation. Signature of function was changed since text2vec 0.4, now there should not bevocabulary
argument.