Code Monkey home page Code Monkey logo

nlp-text-classification-model's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nlp-text-classification-model's Issues

'KeyedVectors' object has no attribute 'syn0'

Hi,

I'm using your code here, based on your article in Medium. Because of gensim's update from 3.8 to 4 (which was a major revision) I received some errors.

The first was that model.wv.index2word has been moved to model.wv.index_to_key. So I changed the code accordingly to get rid of this error.

#w2v = dict(zip(model.wv.index2word, model.wv.syn0))  #combination of word and its vector
w2v = dict(zip(model.wv.index_to_key, model.wv.syn0))  #combination of word and its vector

However, this then triggered a new error that I haven't been able to figure out.

AttributeError      Traceback (most recent call last)
<ipython-input-54-04b58a6eb72e> in <module>
      6 #if min_count=2 means if the word is present less than 2 times across all the documents then we shouldn't consider it
      7 
----> 8 w2v = dict(zip(model.wv.index_to_key, model.wv.syn0))  #combination of word and its vector
      9 #w2v = dict(zip(model.wv.index2word, model.wv.syn0))  #combination of word and its vector
     10 
AttributeError: 'KeyedVectors' object has no attribute 'syn0'

Checking the web, the recommended solution for a object has no attribute 'syn0' is to change from model.syn0 to model.wv.syn0 ... but of course this is what the code already is.

Do you have any idea how I can correct this code?

Thanks!

Requirements

Hello,

During my study on this NLP modelling I realized that @vijayaiitk should have mentioned the versions for gensim and some other modules. Because the deprecated versions do not work. For example gensim 3.8.3 should be added to the requirements otherwise visitors who try will encounter repetitive issues related to version.

If you can add requirements I would appreciate it,
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.