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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -