sagorbrur / bnlp

BNLP is a natural language processing toolkit for Bengali Language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getting error for len(bft.model.wv)

hegdekasha opened this issue · comments

Hai,
I wanted get the vocabulary size of BNLPfasttext model. I used similar code which worked for word2vec. However, it is not working for for fastext. could to please help me

Hi @hegdekasha ,
Here is the way to get the vocab size:

from bnlp.embedding.fasttext import BengaliFasttext

bft = BengaliFasttext()

print(len(bft.model.words))

You can check the inside module and get other method by the following steps:

from bnlp.embedding.fasttext import BengaliFasttext

bft = BengaliFasttext()
print(dir(bft))
# bft contains a module "model"
# then again you can check the inside module by
print(dir(bft.model))
# now you will get the other module inside bft.model and use accordingly

Hope it will help.

Regards