Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use provided embedding #2

Open
nazanaza2970 opened this issue Oct 2, 2020 · 1 comment
Open

Unable to use provided embedding #2

nazanaza2970 opened this issue Oct 2, 2020 · 1 comment

Comments

@nazanaza2970
Copy link

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
Copy link
Member

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['প্রধানমন্ত্রী']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants