This is how you would normally initialize a pipeline to run on some text:
//stanford NLP
static Properties props = new Properties();
static StanfordCoreNLP pipeline;
static void initStanfordPipeline() {
// creates a StanfordCoreNLP object, with POS tagging, lemmatization, NER, parsing, and coreference resolution
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref"); // depparse is an option for using a new dependency parsing model
pipeline = new StanfordCoreNLP(props);
}
I get the following error when I try 'depparse' instead of 'parse' as an option in the pipeline:
Exception in thread "main" java.lang.IllegalArgumentException: annotator "dcoref" requires annotator "parse"
Good question! This currently isn't possible in the pipeline, though it really ought to be. I'll bring it up in our next development meeting.
For now, if you know that your pipeline doesn't require constituency parses, you can easily get around this by setting a property in the pipeline flags: -enforceRequirements false
.
However, it looks like you're using dcoref
, which does require constituency parses --- so there's no way around using the parse
annotator, unfortunately.