【问题标题】:Gensim Predict Output Word Function SyntaxGensim 预测输出字函数语法
【发布时间】:2019-07-05 18:06:11
【问题描述】:

如何使用 Gensim predict 输出单词功能?

model = KeyedVectors.load_word2vec_format('./GoogleNews-vectors-negative300.bin', binary=True)

model.predict_output_word(['Hi', 'how', 'you'], topn=10)

AttributeError: 'Word2VecKeyedVectors' object has no attribute 'predict_output_word'

我尝试了 Word2Vec.load_word2vec_format('./GoogleNews-vectors-negative300.bin', binary=True),它也被弃用了。

【问题讨论】:

    标签: gensim


    【解决方案1】:

    GoogleNews-vectors-negative300.bin 这样的文件只包含词向量,而不是用于训练的完整模型。所以在这种情况下不能使用predict_output_word。如果您自己训练了一个完整的模型并使用model.save() 保存它,那么predict_output_word 方法将可用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-13
      相关资源
      最近更新 更多