Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLTK was unable to find the TreeTagger bin! #10

Closed
Clockwork-Robot opened this issue Aug 23, 2016 · 8 comments
Closed

NLTK was unable to find the TreeTagger bin! #10

Clockwork-Robot opened this issue Aug 23, 2016 · 8 comments

Comments

@Clockwork-Robot
Copy link

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
Copy link
Owner

miotto commented Aug 23, 2016

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
Copy link
Author

Clockwork-Robot commented Aug 24, 2016

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
Copy link
Owner

miotto commented Sep 11, 2016

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
Copy link

I had the same issue and you're last posting worked, but raised a different Error. I opened a new issue for this here: #11

@jacquesfize
Copy link

jacquesfize commented Jan 18, 2017

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 :

  • Download tree-tagger
  • Download the scripts into your tree-tagger directory
  • Then use the install-tagger.sh

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:

  • Extract the parameters files and dispose each of them in the right directory with the right name
  • Change the path in each script files (tree-tagger-french, etc.) so you can execute tree-tagger scripts anywhere !

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

Best

@miotto
Copy link
Owner

miotto commented Jan 18, 2017

Thanks you for the response.

@miotto miotto closed this as completed Jan 18, 2017
@g-i-o-r-g-i-o
Copy link

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

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

@ThayerBanker21
Copy link

ThayerBanker21 commented Mar 27, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants