小编Ama*_*ani的帖子

尝试使用 gensim word2vec 时使用 a.all() 或 a.any() 错误

我一直在尝试运行一个示例,说明如何从 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 及其所有依赖项。

python-2.7 gensim word2vec

2
推荐指数
1
解决办法
1103
查看次数

标签 统计

gensim ×1

python-2.7 ×1

word2vec ×1