use of edu.stanford.nlp.trees.international.pennchinese.ChineseGrammaticalStructure in project CoreNLP by stanfordnlp.
the class CoNLLDocumentReader method setDependencyTree.
private void setDependencyTree(Annotation anno) {
List<CoreMap> sentences = anno.get(SentencesAnnotation.class);
for (CoreMap sentence : sentences) {
Tree tree = sentence.get(TreeAnnotation.class);
if (tree == null)
continue;
SemanticGraph deps = null;
SemanticGraph basicDeps = null;
if (options.lang == Locale.CHINESE) {
final boolean threadSafe = true;
deps = SemanticGraphFactory.makeFromTree(new ChineseGrammaticalStructure(tree, Filters.acceptFilter(), chineseHeadFinder), SemanticGraphFactory.Mode.COLLAPSED, GrammaticalStructure.Extras.NONE, null);
basicDeps = SemanticGraphFactory.makeFromTree(new ChineseGrammaticalStructure(tree, Filters.acceptFilter(), chineseHeadFinder), SemanticGraphFactory.Mode.BASIC, GrammaticalStructure.Extras.NONE, null);
} else {
deps = SemanticGraphFactory.generateEnhancedDependencies(tree);
basicDeps = SemanticGraphFactory.generateUncollapsedDependencies(tree);
}
sentence.set(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class, basicDeps);
sentence.set(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class, deps);
}
}
Aggregations