Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Gensim 3.4.0 word2vec不支持的操作数类型用于+;:';int';和';str';_Python_Word2vec_Gensim - Fatal编程技术网

Python Gensim 3.4.0 word2vec不支持的操作数类型用于+;:';int';和';str';

Python Gensim 3.4.0 word2vec不支持的操作数类型用于+;:';int';和';str';,python,word2vec,gensim,Python,Word2vec,Gensim,我已将word2vec.py中的代码更改为: \AppData\Local\Continuum\anaconda3\lib\site-packages\gensim\models\word2vec.py in reset_weights(self, hs, negative, wv) 1417 for i in xrange(len(wv.vocab)): 1418 # construct deterministic seed from wor

我已将word2vec.py中的代码更改为:

\AppData\Local\Continuum\anaconda3\lib\site-packages\gensim\models\word2vec.py in reset_weights(self, hs, negative, wv)
   1417         for i in xrange(len(wv.vocab)):
   1418             # construct deterministic seed from word AND seed argument
-> 1419             wv.vectors[i] = self.seeded_vector( "".join(str(wv.index2word[i]),str(self.seed)), wv.vector_size)
   1420         if hs:
   1421             self.syn1 = zeros((len(wv.vocab), self.layer1_size), dtype=REAL)
但我收到了错误:

TypeError: unsupported operand type(s) for +: 'int' and 'str'
在第1419行,箭头指向该行。我不明白当int和str都在str()方法中时,操作数是如何连接的


我正在使用Anaconda环境,如果这在python3中很重要的话

您是否尝试过调试到
self.seedd_vector
以查看“引擎盖下”发生了什么?是的,它没有帮助,尽管我认为我发现了问题(有些),我正在处理二进制文件以提供模型,但一些字符没有正确解析,这导致了它失败。