小编San*_*ket的帖子

了解使用“gensim.corpora.Dictionary(TEXT)”后单词如何存储在 gensim 语料库字典中

将文本文档列表转换为语料库词典,然后使用以下方法将其转换为词袋模型:

dictionary = gensim.corpora.Dictionary(docs) # docs is a list of text documents
corpus = [dictionary.doc2bow(doc) for doc in docs]
Run Code Online (Sandbox Code Playgroud)

我们可以使用以下方法找出字典中特定单词的索引值:

dictionary.doc2idx(["righteous","height"])
Run Code Online (Sandbox Code Playgroud)

有没有办法找到存储在字典中特定索引处的单词?

python corpus gensim

3
推荐指数
1
解决办法
3879
查看次数

标签 统计

corpus ×1

gensim ×1

python ×1