在 CoreNLP 管道中,是否可以将 Coref 工具(dcoref)与新的依赖解析器工具(depparse)一起使用?
In the CoreNLP pipeline, is it possible to use the Coref tool (dcoref) with the new dependency parser tool (depparse)?
这就是您通常将管道初始化为 运行 某些文本的方式:
//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"
好问题!这目前在管道中是不可能的,尽管它确实应该是。我会在下次开发会议上提出来。
目前,如果您知道您的管道不需要选区分析,您可以通过在管道标志中设置 属性 轻松解决此问题:-enforceRequirements false
.
但是,看起来您正在使用 dcoref
,这确实需要选区分析 --- 因此很遗憾,无法使用 parse
注释器。
这就是您通常将管道初始化为 运行 某些文本的方式:
//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"
好问题!这目前在管道中是不可能的,尽管它确实应该是。我会在下次开发会议上提出来。
目前,如果您知道您的管道不需要选区分析,您可以通过在管道标志中设置 属性 轻松解决此问题:-enforceRequirements false
.
但是,看起来您正在使用 dcoref
,这确实需要选区分析 --- 因此很遗憾,无法使用 parse
注释器。