miotto / treetagger-python

A Python module for interfacing with the Treetagger by Helmut Schmid.
Other
77 stars 29 forks source link

NLTK was unable to find the TreeTagger bin! #10

Closed Clockwork-Robot closed 7 years ago

Clockwork-Robot commented 8 years ago

Hello,

I am trying to use treetagger-python and I don't seem to have it working properly. I downloaded TreeTagger and installed it in ~/treetagger and therefore set TREETAGGER_HOME to this path in my .bashrc file.

However, when I want to use it, I get the following error:

NLTK was unable to find the TreeTagger bin!

I think it comes from a TREETAGGER_HOME which is misconfigured, but I actually have no clue of what could be the correct path.

I also may be wrong and the error could come from somewhere else.

Could you please enlighten me?

Thanks a lot!

miotto commented 8 years ago

Hello,

I think the easiest way is to change in TreeTagger Python source code the search path to the directory of the TreeTagger. Change the file treetagger.py in line 82 from '~/tree-tagger/cmd' to '~/treetagger/cmd' (your installation directory of TreeTagger). Now Python/NLTK should find the files in the correct directory.

If this does not work, we will find another solution. Has the installation and the test works, as described in the URL TreeTagger?

Regards

Clockwork-Robot commented 8 years ago

Hello miotto,

Thank you very much for the quick answer! Unfortunately, changing the source code didn't make it work; I still get the same error message.

TreeTagger works well as you can see below:

ana@velociraptor:~$ cd ~/treetagger
ana@velociraptor:~/treetagger$ echo 'Salut tout le monde !' | cmd/tree-tagger-french
    reading parameters ...
    tagging ...
Salut   NOM salut
tout    ADV tout
le  DET:ART le
monde   NOM monde
!   SENT    !
     finished.

Have a good day!

miotto commented 8 years ago

Hello,

Sorry that I answer so late.

I checked again, it was my fault. At the end of the export of the environment variable 'TREETAGGER_HOME' has a 'cmd' are added. It seems that NLTK searches the executable file directly in the specified directory. The command must be as follows

export TREETAGGER_HOME='/path/to/your/TreeTagger/cmd/'

Please try it again.

Regards

niklasben commented 8 years ago

I had the same issue and you're last posting worked, but raised a different Error. I opened a new issue for this here: https://github.com/miotto/treetagger-python/issues/11

jacquesfize commented 7 years ago

Hi, I had the same issue and resolved it. The error comes from the tree-tagger installation. When you're installing tree-tagger, you have 3 big steps :

But for me, I didn't execute the install-tagger.sh because I didn't see the interest. But after looking into it, the script is doing 2 things:

So if you didn't execute the install-tagger.sh, run it ! For me, it works directly after executing it !

Best

miotto commented 7 years ago

Thanks you for the response.

g-i-o-r-g-i-o commented 4 years ago

wrong export TREETAGGER_HOME='/path/to/your/TreeTagger/cmd/'

fixed export TREETAGGER_HOME='/path/to/your/TreeTagger/'

ThayerBanker21 commented 3 years ago

Unfortunately, I am having the same issues as above e.g. 'NLTK was unable to find the TreeTagger bin!' I checked all the solutions above, but to no avail.


AttributeError Traceback (most recent call last)

in () 1 tt_es = TreeTagger(path_to_treetagger='../') 2 ----> 3 print(tt_es.tag('Como las matrioskas rusas esas muñecas que llevan en su vientre otras figuras estas memorias')) /Users/brentdial/Marvel/Ng/Project_Cielo/TreeTagger/treetagger-python/treetagger.py in tag(self, sentences) 158 # Run the tagger and get the output 159 if(self._abbr_list is None): --> 160 p = Popen([self._treetagger_bin], 161 shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE) 162 elif(self._abbr_list is not None): AttributeError: 'TreeTagger' object has no attribute '_treetagger_bin' Any other ideas? For instance, what is the what argument goes into TreeTagger() if the TREETAGGER_HOME is set? Do you still put the path?