List<Feature> features = new ArrayList<Feature>();
String dtreeStr ="(TOP (EVENT " + focusAnnotation.getCoveredText().trim() + "))";
//find the colldepnode covered by focusAnnotation:
for(ConllDependencyNode node : JCasUtil.selectCovered(view, ConllDependencyNode.class, focusAnnotation)){
//find if it has head:
ConllDependencyNode head = node.getHead();
SimpleTree curTree = null;
SimpleTree headTree = null;
if(head == null) { //if the current node is the root, then not right
continue;
}
// curTree = SimpleTree.fromString(String.format("(%s %s)", node.getDeprel(), SimpleTree.escapeCat(node.getCoveredText().trim())));
curTree = SimpleTree.fromString(String.format("(%s %s)", node.getDeprel(), node.getPostag()));
while(head.getHead() != null){ //while head node is not the root
// String token = node.getHead().getHead() == null ? "TOP" : node.getHead().getCoveredText();
// headTree = SimpleTree.fromString(String.format("(%s %s)", head.getDeprel(), SimpleTree.escapeCat(head.getCoveredText().trim())));
headTree = SimpleTree.fromString(String.format("(%s %s)", head.getDeprel(), head.getPostag()));
curTree.parent = headTree.children.get(0);
headTree.children.get(0).addChild(curTree);
curTree = headTree;
head = head.getHead();
}
if(headTree==null){
curTree = SimpleTree.fromString(String.format("(%s (%s %s))",node.getDeprel(), node.getPostag(),"null"));
dtreeStr = curTree.toString();
}else{