I am trying to use the Stanford parser in a small application written in Python with the NLTK interface. I tried the code given below.
Everything seems to work right, no errors, Java is launched but I systematically get an empty iterator () and the program does not display the parsing tree.
I use Windows 7, Python 3.4.3, JRE jre1.8.0_51. I did the same with the POS tagger but got the same empty result.
import os
from nltk.parse import stanford
os.environ['STANFORD_PARSER'] = 'path\\jars'
os.environ['STANFORD_MODELS'] = 'path\\jars'
os.environ['JAVAHOME']= "path\\Java\jre1.8.0_51\\bin"
parser = stanford.StanfordParser(model_path="path\\englishPCFG.ser.gz")
sentences = parser.raw_parse_sents(("Hello the world.", "Thank you for helping me with this problem."))
print(sentences)
for line in sentences:
for sentence in line:
sentence.draw()