这就是通常初始化管道以在某些文本上运行的方法:
//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);
}
当我尝试'depparse'而不是'parse'作为管道中的选项时,我收到以下错误:
Exception in thread "main" java.lang.IllegalArgumentException: annotator "dcoref" requires annotator "parse"
答案 0 :(得分:1)
好问题!目前这在管道中是不可能的,尽管它确实应该是。我将在下一次开发会议上提出来。
目前,如果你知道你的管道不需要选区解析,你可以通过在管道标志中设置一个属性来轻松解决这个问题:-enforceRequirements false
。
然而,看起来你正在使用dcoref
,这确实需要选区解析---所以不幸的是,无法使用parse
注释器。