sagorbrur / bnlp

BNLP is a natural language processing toolkit for Bengali Language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: cannot import name 'stopwords' from 'bnlp.corpus'

abdullahmoosa opened this issue · comments

Hello. I am trying to import stopwords from bnlp.corpus in Google Colab.
I am facing this issue : ImportError: cannot import name 'stopwords' from 'bnlp.corpus' (/usr/local/lib/python3.10/dist-packages/bnlp/corpus/init.py)

I have installed bnlp using "pip install -U bnlp_toolkit".
and then imported bnlp.
I am using python 3.10.12 currently.

Screenshot 2023-08-15 210756

Hi @abdullahmoosa ,
The latest version 4.0.0 is totally incompatible with the previous version 3.
Please downgrade to 3.3.2 or upgrade your code according to the latest documentation
Latest codes snippet to access the stopwords is

from bnlp import BengaliCorpus as corpus

print(corpus.stopwords)
print(corpus.punctuations)
print(corpus.letters)
print(corpus.digits)
print(corpus.vowels)

Hi! How can I use the remove_stopwords() for the new version of the bnlp module?

@Nesarul-Hoque ,
We deprecated the remove stopwords function from the utility.
You can do that by simply tokenizing your texts and checking and removing words in the stopwords list you will get from here.

@sagorbrur
That's what I thought too. Thank you for the early response.

Thank you @sagorbrur
Currently working with removing the stopwords from the stopwords list.