NLTK can't find the Stanford POS tagger model file
<p>I am trying to use StanfordPOSTagger from the NLTK. I  downloaded Stanford POS full tagger. I have set </p>

<pre><code>CLASSPATH=/home/waheeb/Stanford_Tools/stanford-postagger-full-2015-12-09  /stanford-postagger.jar
STANFORD_MODELS=home/waheeb/Stanford_Tools/stanford-postagger-full-2015-12-09/models
</code></pre>

<p>When I type the following in python:</p>

<pre><code>&gt;&gt;&gt; from nltk.tag import StanfordPOSTagger
&gt;&gt;&gt; st = StanfordPOSTagger('english-bidirectional-distsim.tagger')
</code></pre>

<p>I get the following error:</p>

<pre><code>Traceback (most recent call last):
File "&lt;stdin&gt;", line 1, in &lt;module&gt;
File "/home/waheeb/anaconda2/lib/python2.7/site-packages/nltk/tag /stanford.py", line 136, in __init__
super(StanfordPOSTagger, self).__init__(*args, **kwargs)
File "/home/waheeb/anaconda2/lib/python2.7/site-packages/nltk/tag/stanford.py", line 56, in __init__
env_vars=('STANFORD_MODELS',), verbose=verbose)
File "/home/waheeb/anaconda2/lib/python2.7/site-packages /nltk/internals.py", line 573, in find_file
file_names, url, verbose))
File "/home/waheeb/anaconda2/lib/python2.7/site-packages/nltk/internals.py", line 567, in find_file_iter
raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))
</code></pre>

<p>LookupError: </p>

<pre><code>=========================================================================
NLTK was unable to find the english-bidirectional-distsim.tagger file!
Use software specific configuration paramaters or set the TANFORD_MODELS  environment variable.
==========================================================================
</code></pre>

<p>Why is that?? </p>

<p>You forgot to use <code>export</code> in the command line before calling your python script. I.e. </p>

<pre><code>alvas@ubi:~$ export STANFORDTOOLSDIR=$HOME
alvas@ubi:~$ export CLASSPATH=$STANFORDTOOLSDIR/stanford-postagger-full-2015-12-09/stanford-postagger.jar
alvas@ubi:~$ export STANFORD_MODELS=$STANFORDTOOLSDIR/stanford-postagger-full-2015-12-09/models
alvas@ubi:~$ python
</code></pre>

<p>For more details see <a href="https://gist.github.com/alvations/e1df0ba227e542955a8a" rel="nofollow">https://gist.github.com/alvations/e1df0ba227e542955a8a</a></p>

<hr>

<p>Similar problems includes:</p>

<ul>
<li><a href="http://stackoverflow.com/questions/34037094/setting-nltk-with-stanford-nlp-both-stanfordnertagger-and-stanfordpostagger-fo">Setting NLTK with Stanford NLP (both StanfordNERTagger and StanfordPOSTagger) for Spanish</a></li>
<li><a href="http://stackoverflow.com/questions/22930328/error-using-stanford-pos-tagger-in-nltk-python">Error using Stanford POS Tagger in NLTK Python</a></li>
<li><a href="http://stackoverflow.com/questions/34692987/cant-make-stanford-pos-tagger-working-in-nltk">Can&#39;t make Stanford POS tagger working in nltk</a></li>
<li><a href="http://stackoverflow.com/questions/7344916/trouble-importing-stanford-pos-tagger-into-nltk">trouble importing stanford pos tagger into nltk</a></li>
<li><a href="http://stackoverflow.com/questions/13883277/stanford-parser-and-nltk">Stanford Parser and NLTK</a></li>
</ul>

python nlp nltk stanford-nlp pos-tagger