【gensim问题记录】EOFError: unexpected end of input; is count incorrect or file otherwise damaged?

参考博客
报错信息:
【gensim问题记录】EOFError: unexpected end of input; is count incorrect or file otherwise damaged?_第1张图片
打开词向量文件

vi glove.840B.300d.word2vec.txt

词向量文件中的第一行是两个数字,第一个表示此文件中共有词多少;第二个是词向量的维度
输入crtl+end,跳转到最后一行,此时文件行数为2096017,而文件一行的行数+维度也占了一行,因此词数是文件行数-1,修改为2096016
【gensim问题记录】EOFError: unexpected end of input; is count incorrect or file otherwise damaged?_第2张图片
我这里犯傻一直打开的是glove.840B.300d.txt文件,这个文件也是2096017行但是第一行没有行数和列数。

你可能感兴趣的:(问题记录,python)