So I got the "standard" Stanford Parser to work thanks to danger89's answers to this previous post, Stanford Parser and NLTK.
However, I am now trying to get the dependency parser to work and it seems the method highlighted in the previous link no longer works. Here is my code:
import nltk
import os
java_path = "C:\\Program Files\\Java\\jre1.8.0_51\\bin\\java.exe"
os.environ['JAVAHOME'] = java_path
from nltk.parse import stanford
os.environ['STANFORD_PARSER'] = 'path/jar'
os.environ['STANFORD_MODELS'] = 'path/jar'
parser = stanford.StanfordDependencyParser(model_path="path/jar/englishPCFG.ser.gz")
sentences = parser.raw_parse_sents(nltk.sent_tokenize("The iPod is expensive but pretty."))
I get the following error: 'module' object has no attribute 'StanfordDependencyParser'
The only thing I changed was "StanfordDependencyParser" from "StanfordParser". Any ideas how I can get this to work?
I also tried the Stanford Neural Dependency parser by importing it as shown in the documentation here: http://www.nltk.org/_modules/nltk/parse/stanford.html
This one didn't work either.
Pretty new to NLTK. Thanks in advance for any helpful input.