cogniinsight / Word-embedding-model-for-Bangla

Word Embedding Model for Bangla
7 stars 4 forks source link

Unable to use provided embedding #2

Open nazanaza2970 opened 4 years ago

nazanaza2970 commented 4 years ago

I downloaded the binary file provided and tried to run the sample code given in google colab. The code fails to execute with error - KeyError: "word 'প্রধানমন্ত্রী' not in vocabulary" . I have tried some other words too but it outputs a similar error. I used the following code - `!gdown --id 0Bxa1keXJ_v7CMmNwdWlEUVJOdlU

import gensim model = gensim.models.Word2Vec.load('/content/model/bn_w2v_model.bin')

words=model.most_similar(positive=['ভাত'], negative=[], topn=10)

for w in words: print(w[0]) `

I hope you look into this matter asap.

AridHasan commented 4 years ago

Please use the following code:

from gensim.models import KeyedVectors

model = KeyedVectors.load_word2vec_format('bn_w2v_model.text', binary=False)
words = model.most_similar(positive=['প্রধানমন্ত্রী'], negative=[], topn=10)

for w in words:
  print(w[0])
vector = model['প্রধানমন্ত্রী']