I\'m trying to work with Stanford POS tagger within NLTK. I\'m using the example shown here:
http://www.nltk.org/api/nltk.tag.html#module-nltk.tag.stanford
I
Lot has changed since this solution.Here is my solution to the code,after I too faced the error.Basically increasing JAVA heapsize solved it.
import os
java_path = "C:\\Program Files\\Java\\jdk1.8.0_102\\bin\\java.exe"
os.environ['JAVAHOME'] = java_path
from nltk.tag.stanford import StanfordPOSTagger
path_to_model = "stanford-postagger-2015-12-09/models/english-bidirectional-distsim.tagger"
path_to_jar = "stanford-postagger-2015-12-09/stanford-postagger.jar"
tagger=StanfordPOSTagger(path_to_model, path_to_jar)
tagger.java_options='-mx4096m' ### Setting higher memory limit for long sentences
sentence = 'This is testing'
print tagger.tag(sentence.split())
The best thing to do is simply to download the latest version of the Stanford POS tagger where the dependency problem is now fixed (March 2018).
wget https://nlp.stanford.edu/software/stanford-postagger-full-2017-06-09.zip