我正在使用 Doc2vec 构建词汇表,但出现错误“AttributeError:模块‘gensim.utils’没有属性‘smart_open’”。我该如何解决这个问题?
这是针对 Databricks 平台上的笔记本,在 Python 3 中运行。过去,我尝试在本地 Jupyter Notebook 上运行代码,但出现了相同的错误。
我还搜索了https://radimrehurek.com/gensim/models/doc2vec.html但找不到与 smart_open 相关的任何内容。
model = Doc2Vec(window=5, min_count=1, size=50, sample=1e-5, negative=5, workers=1)
model.build_vocab(sentences.to_array())
Run Code Online (Sandbox Code Playgroud)
我分别运行了以上几行。第一行工作正常。第二个说: AttributeError: module 'gensim.utils' has no attribute 'smart_open'