Ejemplo n.º 1
0
 static Tree createNode(Tree top, String label, Tree... children) {
   CoreLabel headLabel = (CoreLabel) top.label();
   CoreLabel production = new CoreLabel();
   production.setValue(label);
   production.set(
       TreeCoreAnnotations.HeadWordLabelAnnotation.class,
       headLabel.get(TreeCoreAnnotations.HeadWordLabelAnnotation.class));
   production.set(
       TreeCoreAnnotations.HeadTagLabelAnnotation.class,
       headLabel.get(TreeCoreAnnotations.HeadTagLabelAnnotation.class));
   Tree newTop = new LabeledScoredTreeNode(production);
   for (Tree child : children) {
     newTop.addChild(child);
   }
   return newTop;
 }