2017-08-29 8 views
0

エラーは次のとおりです。

> 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, 
> 

私は」語彙の後にLDA$newを実行するとエラーが発生しました。tokenizerとdtmは正常に作成されました。完全なコードは次のとおりです。

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) 

私が使用している「text2vec」バージョン0.5.0、3.4.1 R 64-ビット、RStudio 1.0.153。

答えて

0

ドキュメント - ?LDAhttp://text2vec.org/topic_modeling.html#latent_dirichlet_allocationを確認してください。関数の署名がtext2vec 0.4以降に変更されました。今はvocabulary引数ではありません。

+0

すぐにお返事ありがとうございます。私は以前のバージョンのパッケージを使ってコードを書いていました。パッケージのおめでとう、それは本当に素晴らしいです。 –

+0

回答を受け入れてください –

関連する問題