通常,这是初始化管道以在某些文本上运行的方式:
//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
,不幸的是,无法使用注释器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句