python - Unable to use word.tokenize() functionc from nltk package -
unable call word_tokenize() nltk package. though had performed following steps in terminal
>>python >>import nltk >>nltk.download('all')
and following simple code tokenizing
import nltk sentence = """at 8 o'clock on thursday morning. arthur didn't feel good.""" tokens = nltk.word_tokenize(sentence) tokens
but in spyder console shows
import nltk file "nltk.py", line 3, in <module> tokens = nltk.word_tokenize(sentence) attributeerror: 'module' object has no attribute 'word_tokenize' >>>
it looks named script nltk.py
, code importing instead of nltk
module expect.
try changing script use name.
Comments
Post a Comment