【发布时间】:2018-09-01 01:04:45
【问题描述】:
在构建 python gensim word2vec model 时,有没有办法查看 doc-to-word 矩阵?
输入sentences = [['first', 'sentence'], ['second', 'sentence']] 我会看到类似*:
first second sentence
doc0 1 0 1
doc1 0 1 1
*我已经说明了“人类可读”,但我正在寻找一个 scipy(或其他)矩阵,索引到 model.wv.index2word。
并且,可以将其转换为单词到单词的矩阵(查看共现)吗?比如:
first second sentence
first 1 0 1
second 0 1 1
sentence 1 1 2
我已经使用 CountVectorizer 实现了类似 word-word co-occurrence matrix 的东西。它运作良好。但是,我已经在我的管道中使用了 gensim,并且速度/代码的简单性对我的用例很重要。
【问题讨论】: