【发布时间】:2016-09-19 19:27:14
【问题描述】:
我想用 Stanford CoreNLP 解析一些德语文本并获得一个 CONLL 输出,以便我可以将后者传递给 CorZu 进行共指解析。
我该如何以编程方式做到这一点?
这是我目前的代码(仅输出依赖树):
Annotation germanAnnotation = new Annotation("Gestern habe ich eine blonde Frau getroffen");
Properties germanProperties = StringUtils.argsToProperties("-props", "StanfordCoreNLP-german.properties");
StanfordCoreNLP pipeline = new StanfordCoreNLP(germanProperties);
pipeline.annotate(germanAnnotation);
StringBuilder trees = new StringBuilder("");
for (CoreMap sentence : germanAnnotation.get(CoreAnnotations.SentencesAnnotation.class)) {
Tree sentenceTree = sentence.get(TreeCoreAnnotations.TreeAnnotation.class);
trees.append(sentenceTree).append("\n");
}
【问题讨论】:
标签: format dependencies stanford-nlp