stanford nlp 3.8.0 parse中通过java程序获取root节点

 Collection<TypedDependency> tdl = gs.allTypedDependencies();

// TreeGraphNode tsn = gs.root();

for(TypedDependency i: tdl){
//reln表示节点的关系,dep表示依赖指向的节点
if(i.reln() == GrammaticalRelation.ROOT){
LOG.info("输出root: " + i.dep().toString());
;
}
}

 
原文地址:https://www.cnblogs.com/herosoft/p/8298042.html