Package org.apache.uima.cas

Examples of org.apache.uima.cas.CAS.createAnnotation()


    CAS cas = example.getDocumentCAS();
    // TODO: access type with string constant
    Type frameType = cas.getTypeSystem().getType("org.apache.uima.ruta.type.RutaFrame");
    int begin = left.getWordConstraint().getTokenAnnotation().getEnd();
    int end = right.getWordConstraint().getTokenAnnotation().getBegin();
    AnnotationFS pointer = cas.createAnnotation(frameType, begin, end);
    FSIterator iterator = cas.getAnnotationIndex().iterator(pointer);
    while (iterator.isValid()) {
      FeatureStructure fs = iterator.get();
      AnnotationFS a = (AnnotationFS) fs;
      if (a.getBegin() >= begin && a.getEnd() <= end) {
View Full Code Here


          TextRulerExampleDocument document) {
    List<TrabalRuleItem> result = new ArrayList<TrabalRuleItem>();
    int begin = ruleItem.getAnnotation().getBegin();
    CAS cas = document.getCAS();
    Type frameType = cas.getTypeSystem().getType(ANNOTATION_TYPE_FRAME);
    AnnotationFS pointer = cas.createAnnotation(frameType, begin, begin);
    FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex().iterator(pointer);
    int nextEnd = -1;

    while (iterator.isValid()) {
      FeatureStructure fs = iterator.get();
View Full Code Here

          TextRulerExampleDocument document) {
    List<TrabalRuleItem> result = new ArrayList<TrabalRuleItem>();
    int end = ruleItem.getAnnotation().getEnd();
    CAS cas = document.getCAS();
    Type frameType = cas.getTypeSystem().getType(ANNOTATION_TYPE_FRAME);
    AnnotationFS pointer = cas.createAnnotation(frameType, end, Integer.MAX_VALUE);
    FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex().iterator(pointer);
    int nextBegin = -1;
    while (iterator.isValid()) {
      FeatureStructure fs = iterator.get();
      if (fs instanceof AnnotationFS) {
View Full Code Here

          TextRulerExampleDocument document) {
    CAS cas = document.getCAS();
    List<TrabalRuleItem> result = new ArrayList<TrabalRuleItem>();
    int begin = ruleItem.getAnnotation().getBegin();
    Type frameType = cas.getTypeSystem().getType(ANNOTATION_TYPE_FRAME);
    AnnotationFS pointer = cas.createAnnotation(frameType, 0, begin);
    FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex().iterator(pointer);
    while (iterator.hasNext()) {
      TrabalAnnotation annotation = new TrabalAnnotation(iterator.next(), enableFeatures);
      if (annotation.getBegin() >= begin) {
        break;
View Full Code Here

    CAS cas = ae.newCAS();
    cas.setDocumentText("This is the default view.");
    CAS newView = cas.createView(NEW_VIEW);
    newView.setDocumentText("This is a new view.");
    Type type = cas.getTypeSystem().getType(TEST_TYPE);
    AnnotationFS createAnnotation = newView.createAnnotation(type, 5, 7);
    newView.addFsToIndexes(createAnnotation);

    ae.process(cas);

    cas.reset();
View Full Code Here

    CAS cas = ae.newCAS();
    cas.setDocumentText("This is the default view.");
    CAS newView = cas.createView(NEW_VIEW);
    newView.setDocumentText("This is a new view.");
    Type type = cas.getTypeSystem().getType(TEST_TYPE);
    AnnotationFS createAnnotation = newView.createAnnotation(type, 10, 13);
    newView.addFsToIndexes(createAnnotation);

    ae.process(cas);

    cas.reset();
View Full Code Here

    CAS cas = ae.newCAS();
    cas.setDocumentText(FileUtils.file2String(textFile, "UTF-8"));
   
    Type typeCW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.CW");
    Type typeSW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.SW");
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 0, 5));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 7, 13));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 15, 18));
    cas.addFsToIndexes(cas.createAnnotation(typeSW, 19, 22));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 23, 28));
   
View Full Code Here

    cas.setDocumentText(FileUtils.file2String(textFile, "UTF-8"));
   
    Type typeCW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.CW");
    Type typeSW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.SW");
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 0, 5));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 7, 13));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 15, 18));
    cas.addFsToIndexes(cas.createAnnotation(typeSW, 19, 22));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 23, 28));
   
    ae.process(cas);
View Full Code Here

   
    Type typeCW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.CW");
    Type typeSW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.SW");
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 0, 5));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 7, 13));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 15, 18));
    cas.addFsToIndexes(cas.createAnnotation(typeSW, 19, 22));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 23, 28));
   
    ae.process(cas);
View Full Code Here

    Type typeCW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.CW");
    Type typeSW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.SW");
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 0, 5));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 7, 13));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 15, 18));
    cas.addFsToIndexes(cas.createAnnotation(typeSW, 19, 22));
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 23, 28));
   
    ae.process(cas);

    Type t = null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.