I am working on an NLTK project, I have successfully installed it, following the tutorial here , I use Windows 7. Therefore, to help I test my installation, I ran these commands in python:
import nltk from nltk.tag import pos_tag
I am using Python 2.7 and is located under C:\Python27 . Then I created a sample script ( D: \ nltk-test.py ) that contains the following commands:
import nltk from nltk.tag import pos_tag text = nltk.word_tokenize("Hello world!") print pos_tag(text)
The problem is when I tried to execute this with python nltk-test.py , I get an error
Traceback (most recent call last): File "nltk-test.py", line 1, in <module> import nltk File "D:\nltk.py", line 3, in <module> ImportError: No module named tag
I moved the file ( nltk-test.py ) inside C:\Python27\ and it works fine, but I cannot run it outside or if I placed it on another drive.
kimbebot
source share