Dan
Dan

Reputation: 35

How to remove special characters and stop words in a file using python?

I am new to python and struggling to make code removing stop words and special characters from a file without using nltk. I tried reading and taking ideas from other questions but none helped me.

Also, I tried installing nltk in PyCharm and importing it

import nltk

but it says:

ModuleNotFoundError: No module named 'nltk'

Can anyone help me with this? Thank you so much

Upvotes: 0

Views: 380

Answers (1)

lucyjosef
lucyjosef

Reputation: 762

If you're using python2.7, install it from terminal running : pip install nltk Otherwise, for python 3, just run pip3 install nltk

If you meet this kind of error

enter image description here

just run nltk.download('punkt')(or whatever you see in the error, here I got punkt) from our python console

You shouldn't see any importError now

Upvotes: 2

Related Questions