[英]Latent Semantic Indexation with gensim
In order to use the Latent semantic indexation method from gensim, I want to begin with a small "classique" example like : 为了使用gensim中的潜在语义索引方法,我想从一个小“ classique”示例开始:
import logging, gensim, bz2
id2word = gensim.corpora.Dictionary.load_from_text('wiki_en_wordids.txt')
mm = gensim.corpora.MmCorpus('wiki_en_tfidf.mm')
lsi = gensim.models.lsimodel.LsiModel(corpus=mm, id2word=id2word, num_topics=400)
etc..
My question is : How to get the corpus iterator 'wiki_en_tfidf.mm' ? 我的问题是:如何获取语料库迭代器“ wiki_en_tfidf.mm”? Must I download it from somewhere ?
我必须从某个地方下载吗? I have searched on the Internet but I did not find anything.
我已经在Internet上搜索了,但是没有找到任何东西。 Help please ?
请帮助 ?
The first page of search results includes a link to: 搜索结果的第一页包含指向以下内容的链接:
https://radimrehurek.com/gensim/wiki.html https://radimrehurek.com/gensim/wiki.html
which says "First let's load the corpus iterator and dictionary, created in the second step above." 它说:“首先,让我们加载在上面第二步中创建的语料库迭代器和字典。”
Step 2 is 步骤2是
Convert the articles to plain text (process Wiki markup) and store the result as sparse TF-IDF vectors.
将文章转换为纯文本(处理Wiki标记),并将结果存储为稀疏TF-IDF向量。 In Python, this is easy to do on-the-fly and we don't even need to uncompress the whole archive to disk.
在Python中,这很容易即时进行,我们甚至不需要将整个档案解压缩到磁盘上。 There is a script included in gensim that does just that, run:
gensim中包含一个脚本,可以执行以下操作:
$ python -m gensim.scripts.make_wiki
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.