sloria / textblob-aptagger

*Deprecated* A fast and accurate part-of-speech tagger for TextBlob.
MIT License
104 stars 41 forks source link

Import error: from textblob.packages import nltk #5

Closed ddorian closed 9 years ago

ddorian commented 9 years ago

On Active-python 2.7 (windows 32bit).

After doing:

pip install -U textblob python -m textblob.download_corpora pip install -U textblob-aptagger

The import fails on

Traceback (most recent call last):

from textblob_aptagger import PerceptronTagger File "C:\Python27\lib\site-packages\textblob_aptaggerinit.py", line 8, in from textblob_aptagger.taggers import PerceptronTagger File "C:\Python27\lib\site-packages\textblob_aptagger\taggers.py", line 10, in from textblob.packages import nltk ImportError: No module named packages

sloria commented 9 years ago

For compatibility with textblob 0.9.0, you will need to install the latest development version of textblob-aptagger:

$ pip install -U git+https://github.com/sloria/textblob-aptagger.git@dev
ddorian commented 9 years ago

Thanks, now it works. Can you release a new version ?

ddorian commented 9 years ago

You think it's a good idea to also change:

from textblob_aptagger.taggers import PerceptronTagger to from .taggers import PerceptronTagger

in init.py, so it works with just copy-paste of the project folder (without installation).

The same is for line 12 on taggers.py:

from ._perceptron import AveragedPerceptron

If you want I can make a pull-request?

sloria commented 9 years ago

There are a few things that need to be addressed before the next release. For now, you can install the latest dev version with the command above or put the following in a requirements.txt file:

git+https://github.com/sloria/textblob-aptagger.git@dev

Full import are preferred. They make it easier to understand where modules and symbols come from. It is not recommended to vendorize this project. Better to install with pip using the methods I've described above.

SarvagyaVaish commented 9 years ago

Another option is to install nltk and then change "from textblob.packages import nltk" to "import nltk"