我一直在使用该topicmodels
包在 R 中创建 LDA 模型。
require(tm)
require(topicmodels)
textvector <- c("this is one sentence", "this is another one",
"a third sentence appears")
#and more, read in through a file
dtm <- DocumentTermMatrix(Corpus(VectorSource(textvector)))
lda.model <- LDA(dtm, 5)
但它接受文档的唯一格式是实际的文字文档。我想知道是否有办法提供频率图
[word1: 4, word2: 9, word3: 25, word5:3...]
这显然不是 R 中的“地图”,而是允许从词频创建主题模型的任何数据结构(数据框、表、向量列表)表示?
我需要这个的原因是因为主题模型不是在“文档”和“单词”上创建的,而是在图像中的类似特征上创建的,并且长格式表示需要太多空间。