2

I am trying to implement word2vec within nlpaug library and the following code :

aug = naw.WordEmbsAug(
    model_type='word2vec', model_path='GoogleNews-vectors-negative300.bin',
    action="insert")

gives me error of :

Word2VecKeyedVectors' object has no attribute 'index_to_key'

How can i fix such an issue ?

furas
  • 134,197
  • 12
  • 106
  • 148
  • 1
    always put full error message (starting at word "Traceback") in question (not in comments) as text (not screenshot, not link to external portal). There are other useful information. – furas Feb 08 '22 at 12:03
  • better show minimal working code which makes this problem. maybe problem in in different line - I don't see code wiht `index_to_key` in this code. You didn't show FULL error message so we don't know where exactly is `index_to_key` in code. And put it all in question, not in comments. – furas Feb 08 '22 at 12:05

2 Answers2

3

This is probably related to the version of gensim you use. You can print the version with:

import gensim
print(gensim.__version__)
bsenst
  • 41
  • 5
1

I was running into this with gensim version 3.6, an upgrade to version 4.2 solved the problem.