Reputation: 1
I have downloaded all the packages of NLTK with the command of nltk.download()
.
but the thing is that when I try to import TweetTokenizer
I get the error.
tokenizer = TweetTokenizer(preserve_case=False, strip_handles=True, reduce_len=True)
tweet_tokens = tokenizer.tokenize(tweet2)
Error:
NameError: name 'TweetTokenizer' is not defined
Upvotes: 0
Views: 513
Reputation: 19307
nltk.download()
is not for importing packages but for downloading respective corpora and modules. Details found here.
You still have to import the modules. For this you will have to use from nltk.tokenize import TweetTokenizer
. Details found here.
Upvotes: 1
Reputation: 16738
You have probably not imported the TweetTokenizer
. Try:
from nltk.tokenize import TweetTokenizer
Upvotes: 0