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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -