title: Setting NLTK with Stanford NLP (both StanfordNERTagger and StanfordPOSTagger) for Spanish
body: <p>The <code>NLTK</code> documentation is rather poor in this integration. The steps I <a href="https://github.com/nltk/nltk/wiki/Installing-Third-Party-Software#stanford-tagger-ner-tokenizer-and-parser" rel="noreferrer">followed</a> were:</p>
  
  <ul>
  <li><p>Download <a href="http://nlp.stanford.edu/software/stanford-postagger-full-2015-04-20.zip" rel="noreferrer">http://nlp.stanford.edu/software/stanford-postagger-full-2015-04-20.zip</a> to <code>/home/me/stanford</code></p></li>
  <li><p>Download <a href="http://nlp.stanford.edu/software/stanford-spanish-corenlp-2015-01-08-models.jar" rel="noreferrer">http://nlp.stanford.edu/software/stanford-spanish-corenlp-2015-01-08-models.jar</a> to <code>/home/me/stanford</code></p></li>
  </ul>
  
  <p>Then in a <code>ipython</code> console:</p>
  
  <p>In [11]: import nltk                                                                                                                                                                 </p>
  
  <pre><code>In [12]: nltk.__version__
  Out[12]: '3.1'
  
  In [13]: from nltk.tag import StanfordNERTagger
  </code></pre>
  
  <p>Then</p>
  
  <pre><code>st = StanfordNERTagger('/home/me/stanford/stanford-postagger-full-2015-04-20.zip', '/home/me/stanford/stanford-spanish-corenlp-2015-01-08-models.jar')
  </code></pre>
  
  <p>But when I tried to run it:</p>
  
  <pre><code>st.tag('Adolfo se la pasa corriendo'.split())
  Error: no se ha encontrado o cargado la clase principal edu.stanford.nlp.ie.crf.CRFClassifier
  
  ---------------------------------------------------------------------------
  OSError                                   Traceback (most recent call last)
  &lt;ipython-input-14-0c1a96b480a6&gt; in &lt;module&gt;()
  ----&gt; 1 st.tag('Adolfo se la pasa corriendo'.split())
  
  /home/nanounanue/.pyenv/versions/3.4.3/lib/python3.4/site-packages/nltk/tag/stanford.py in tag(self, tokens)
       64     def tag(self, tokens):
       65         # This function should return list of tuple rather than list of list
  ---&gt; 66         return sum(self.tag_sents([tokens]), [])
       67 
       68     def tag_sents(self, sentences):
  
  /home/nanounanue/.pyenv/versions/3.4.3/lib/python3.4/site-packages/nltk/tag/stanford.py in tag_sents(self, sentences)
       87         # Run the tagger and get the output
       88         stanpos_output, _stderr = java(cmd, classpath=self._stanford_jar,
  ---&gt; 89                                                        stdout=PIPE, stderr=PIPE)
       90         stanpos_output = stanpos_output.decode(encoding)
       91 
  
  /home/nanounanue/.pyenv/versions/3.4.3/lib/python3.4/site-packages/nltk/__init__.py in java(cmd, classpath, stdin, stdout, stderr, blocking)
      132     if p.returncode != 0:
      133         print(_decode_stdoutdata(stderr))
  --&gt; 134         raise OSError('Java command failed : ' + str(cmd))
      135 
      136     return (stdout, stderr)
  
  OSError: Java command failed : ['/usr/bin/java', '-mx1000m', '-cp', '/home/nanounanue/Descargas/stanford-spanish-corenlp-2015-01-08-models.jar', 'edu.stanford.nlp.ie.crf.CRFClassifier', '-loadClassifier', '/home/nanounanue/Descargas/stanford-postagger-full-2015-04-20.zip', '-textFile', '/tmp/tmp6y169div', '-outputFormat', 'slashTags', '-tokenizerFactory', 'edu.stanford.nlp.process.WhitespaceTokenizer', '-tokenizerOptions', '"tokenizeNLs=false"', '-encoding', 'utf8']
  </code></pre>
  
  <p>The same occur with the <code>StandfordPOSTagger</code></p>
  
  <p><strong>NOTE</strong>: I need that this will be the spanish version.
  <strong>NOTE</strong>: I  am running this in <code>python 3.4.3</code></p>