无法运行程序获取解码错误。实际上,我正在使用gensim并尝试Doc2vec库,而在这样做时,我得到了这个错误? 代码:-在
def to_array(self):
self.sentences = []
for source, prefix in self.sources.items():
with utils.smart_open(source) as fin:
for item_no, line in enumerate(fin):
self.sentences.append(LabeledSentence(
utils.to_unicode(line).split(), [prefix + '_%s' %
item_no]))
return self.sentences
sentences = LabeledLineSentence(sources)
model = Doc2Vec(min_count=1, window=10, size=100, dm_mean=0, sample=1e-5,
negative=5, workers=12)
model.build_vocab(sentences.to_array())
在错误:-在
^{pr2}$
看起来这个AnacondaGensim程序在需要utf-8时得到了一个字节。
model.build_vocab(sentences.to_array())
没有得到它想要的类型。在你在哪里找到的?“utils”是从哪里进口的?我不认为这是普通的python3。看看this。在
考虑到您使用的是python3,您可能不需要任何东西。在
就换一个
与
^{pr2}$如果不起作用,请尝试:
^{3}$相关问题 更多 >
编程相关推荐