Ejemplo n.º 1
0
  private void convertConstituent(
      View aView, org.apache.uima.jcas.tcas.Annotation aNode, Set<String> aConstituents) {
    if (aNode instanceof Constituent) {
      // LAPPS constituents inherit from Relation which has no offsets
      Annotation constituent =
          aView.newAnnotation(id(CONSTITUENT, aNode), Discriminators.Uri.CONSTITUENT);
      aConstituents.add(constituent.getId());

      for (org.apache.uima.jcas.tcas.Annotation child :
          select(((Constituent) aNode).getChildren(), org.apache.uima.jcas.tcas.Annotation.class)) {
        convertConstituent(aView, child, aConstituents);
      }
    } else if (aNode instanceof Token) {
      aConstituents.add(id(TOKEN, aNode));
    } else {
      throw new IllegalStateException("Unexpected node type: " + aNode);
    }
  }