modern-nlp-in-python icon indicating copy to clipboard operation
modern-nlp-in-python copied to clipboard

Code giving error

Open sudarshan85 opened this issue 6 years ago • 0 comments

Hi,

This is a great resource. I wanted to point out that some of the code especially for LDA analyzing and word vector creation is not working. I am guessing that this is due to updated version of gensim. Also some of the code shows errors for Python 3.

# build a list of the terms, integer indices,
# and term counts from the food2vec model vocabulary
ordered_vocab = [(term, voc.index, voc.count) for term, voc in food2vec.vocab.items()]

This is giving me an error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-21-2c76ac03d027> in <module>()
      1 # build a list of the terms, integer indices,
      2 # and term counts from the food2vec model vocabulary
----> 3 ordered_vocab = [(term, voc.index, voc.count) for term, voc in food2vec.vocab.items()]

AttributeError: 'Word2Vec' object has no attribute 'vocab'

I'm am trying to update the code to bring the original output.

sudarshan85 avatar Mar 12 '18 19:03 sudarshan85