从句子注释中,您可以获得各种类型的从属单词集合.这可能是您要寻找的“下一个升级”.
Tree tree = sentenceAnnotation.get(TreeAnnotation.class);
// print the tree if needed
SemanticGraph basic = sentenceAnnotation.get(BasicDependenciesAnnotation.class);
Collection deps = basic.typedDependencies();
for (TypedDependency typedDep : deps) {
GrammaticalRelation reln = typedDep.reln();
String type = reln.toString();
}
SemanticGraph colapsed = sentenceAnnotation
.get(CollapsedDependenciesAnnotation.class);
Collection deps = colapsed.typedDependencies();
for (TypedDependency typedDep : deps) {
GrammaticalRelation reln = typedDep.reln();
String type = reln.toString();
}
SemanticGraph ccProcessed = sentenceAnnotation
.get(CollapsedCCProcessedDependenciesAnnotation.class);
Collection deps = ccProcessed.typedDependencies();
for (TypedDependency typedDep : deps) {
GrammaticalRelation reln = typedDep.reln();
String type = reln.toString();
}