我有这段代码来拟合主题模型和MALLET 的 R 包装器:
docs <- mallet.import(DF$document, DF$text, stop_words)
mallet_model <- MalletLDA(num.topics = 4)
mallet_model$loadDocuments(docs)
mallet_model$train(100)
我已经使用tm包来读取我的文档,这些文档是目录中的 txt 文件:
myCorpus <- Corpus(DirSource("data")) # a directory of txt files
语料库不能用作 的输入mallet.import
,那么我如何从myCorpus
上面的 tm 语料库DF
到调用的?