斯坦福NLP管道&x2013;顺序处理(Java)
如何正确使用斯坦福NLP管道进行两阶段注释斯坦福NLP管道&x2013;顺序处理(Java),java,stanford-nlp,Java,Stanford Nlp,如何正确使用斯坦福NLP管道进行两阶段注释 在第一阶段中,我只需要标记化和分句,因此我使用以下代码: private Annotation annotatedDocument = null; private StanfordCoreNLP pipeline = null; ... public void firstPhase() { Properties props = new Properties(); props.setProperty("annotat
在第一阶段中,我只需要标记化和分句,因此我使用以下代码:
private Annotation annotatedDocument = null;
private StanfordCoreNLP pipeline = null;
...
public void firstPhase() {
Properties props = new Properties();
props.setProperty("annotators", "tokenize, ssplit");
pipeline = new StanfordCoreNLP(props);
annotatedDocument = new Annotation(textDocument);
}
第二阶段是可选的,因此我不会在第一阶段使用所有注释器。第二阶段代码:
public void secondPhase() {
POSTaggerAnnotator posTaggerAnot = new POSTaggerAnnotator();
posAnot.annotate(annotatedDocument);
// Lemmatization
MorphaAnnotator morphaAnot = new MorphaAnnotator();
morphaAnot.annotate(annotatedDocument);
}
第一个问题:在第二阶段使用“独立”注释器的方法正确吗?还是有办法利用现有的管道 第二个问题:我对相关注释器有问题。我希望在第二阶段使用它,如下所示:
CorefAnnotator coref = new CorefAnnotator(new Properties());
但这个构造器似乎永无止境。没有属性的构造函数不存在,对吗?是否需要一些属性设置?有[至少]3种方法可以做到这一点:
enforceRequirements=false
。这将为您链接注释器,但不需要满足它们的要求——即,如果您知道某些注释已经存在,则不必重新运行它们相应的注释器文档
对象,当您请求各种注释时,它会懒散地将它们插入没错,Coref注释器的问题是java.lang.OutOfMemoryError异常。