简体   繁体   English

通过corpora.csvcorpus在gensim LDA中输入CSV

[英]CSV Input in gensim LDA via corpora.csvcorpus

I wanna use the LDA in gensim for topic modeling over a few thousand documents. 我想在gensim中使用LDA对数千个文档进行主题建模。 Therefore I´m using a csv-File as Input in the format of a term-document-matrix. 因此,我将csv文件作为term-document-matrix格式使用。

Currently it occurs an error when running the following code: 当前,运行以下代码时会发生错误:

from gensim import corpora

import_path ="TDM.csv"

dictionary = corpora.csvcorpus(import_path, labels='true')

The error is the following: 错误如下:

dictionary = corpora.csvcorpus(import_path, labels='true')

AttributeError: module 'gensim.corpora' has no attribute 'csvcorpus'

Am I using the module correctly and if so, where is my mistake? 我是否正确使用了模块,如果可以,我的错误在哪里?

Thanks in advance. 提前致谢。

This also bugged me for quite awhile. 这也困扰了我一段时间。 It looks like csvcorpus is actually in the experimental stage as you can see in their github issue, https://github.com/RaRe-Technologies/gensim/issues/1583 正如您在github问题https://github.com/RaRe-Technologies/gensim/issues/1583中看到的那样,csvcorpus似乎实际上处于实验阶段

I would recommend going by the old fashioned way of using the csv package to read your csv file instead. 我建议您改用使用csv包的老式方式来读取您的csv文件。

Cheers. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM