Why Gensim doc2vec give AttributeError: 'list' object has no attribute 'words'?

前端 未结 1 1525
小鲜肉
小鲜肉 2021-02-14 08:59

I am trying to experiment gensim doc2vec, by using following code. As far as I understand from tutorials, it should work. However it gives AttributeError: \'list\' obje

相关标签:
1条回答
  • 2021-02-14 09:17

    Input to gensim.models.doc2vec should be an iterator over the LabeledSentence (say a list object). Try:

    model = Doc2Vec([document], size = 100, window = 1, min_count = 1, workers=1)
    

    I have reduced the window size, and min_count so that they make sense for the given input. Also go through this nice tutorial on Doc2Vec, if you haven't already.

    0 讨论(0)
提交回复
热议问题