我一直在尝试运行一个示例,说明如何从 python 的 gensim 库中使用 word2vec,但我不断收到此错误
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Run Code Online (Sandbox Code Playgroud)
这是我的代码,它只是一个简单的例子:
from gensim.models import Word2Vec
sentences = [['first', 'sentence'], ['second', 'sentence']]
# train word2vec on the two sentences
model = Word2Vec(sentences, min_count=1)
Run Code Online (Sandbox Code Playgroud)
注意:我已经确保安装了 gensim 及其所有依赖项。