Examples of RutaBasic


Examples of org.apache.uima.ruta.type.RutaBasic

  public Collection<RutaBasic> getAllBasicsInWindow(AnnotationFS windowAnnotation) {
    if (windowAnnotation.getBegin() >= windowAnnotation.getEnd()) {
      return Collections.emptySet();
    }
    RutaBasic beginAnchor = getBeginAnchor(windowAnnotation.getBegin());
    if (beginAnchor.getEnd() == windowAnnotation.getEnd()) {
      Collection<RutaBasic> result = new ArrayList<RutaBasic>(1);
      result.add(beginAnchor);
      return result;
    }
    Collection<RutaBasic> subSet = null;
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

  public RutaBasic getBasicNextTo(boolean before, AnnotationFS annotation) {
    if (annotation == null) {
      return beginAnchors.get(0);
    }
    if (before) {
      RutaBasic pointer = beginAnchors.get(annotation.getBegin());
      moveTo(pointer);
      if (isVisible(pointer) || !isValid()) {
        moveToPrevious();
      }
      if (isValid()) {
        RutaBasic nextBasic = (RutaBasic) get();
        // TODO HOTFIX for annotation of length 0
        while (isValid() && nextBasic.getEnd() > annotation.getBegin()) {
          moveToPrevious();
          if (isValid()) {
            nextBasic = (RutaBasic) get();
          }
        }
        return nextBasic;
      }
    } else {
      RutaBasic pointer = endAnchors.get(annotation.getEnd());
      moveTo(pointer);
      if (isVisible(pointer)) {
        moveToNext();
      }
      if (isValid()) {
        RutaBasic nextBasic = (RutaBasic) get();
        // TODO HOTFIX for annotation of length 0
        while (isValid() && nextBasic.getBegin() < annotation.getEnd()) {
          moveToNext();
          if (isValid()) {
            nextBasic = (RutaBasic) get();
          }
        }
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

  public RutaBasic getNextBasic2(AnnotationFS previous) {
    AnnotationFS pointer = cas
            .createAnnotation(basicType, previous.getEnd() - 1, previous.getEnd());
    currentIt.moveTo(pointer);
    if (currentIt.isValid()) {
      RutaBasic basic = (RutaBasic) currentIt.get();
      return basic;
    }
    return null;
  }
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

      return false;
    }
    int begin = annotationFS.getBegin();
    int end = annotationFS.getEnd();
    Set<Type> currentHiddenTypes = filter.getCurrentHiddenTypes();
    RutaBasic beginAnchor = getBeginAnchor(begin);
    for (Type type : currentHiddenTypes) {
      boolean partOf = beginAnchor.isPartOf(type);
      if (partOf) {
        return false;
      }
    }
    RutaBasic endAnchor = getEndAnchor(end);
    for (Type type : currentHiddenTypes) {
      boolean partOf = endAnchor.isPartOf(type);
      if (partOf) {
        return false;
      }
    }
    return true;
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

 

  public boolean match(FeatureStructure fs) {
    boolean result = false;
    if (fs instanceof RutaBasic) {
      RutaBasic tmb = (RutaBasic) fs;
      if(tmb.isEmpty()) {
        return true;
      }
      if (types != null) {
        for (Type each : types) {
          result |= tmb.isPartOf(each);
          if (result) {
            return true;
          }
        }
      }
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

    List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotations(indexes,
            element.getContainer());
    for (AnnotationFS matched : matchedAnnotations) {

      if (TYPES_AT_BEGIN.equals(op)) {
        RutaBasic beginAnchor = stream.getBeginAnchor(matched.getBegin());
        Collection<?>[] beginMap = beginAnchor.getBeginMap();
        Set<AnnotationFS> aset = new HashSet<AnnotationFS>();
        for (Collection<?> set : beginMap) {
          if(set != null) {
            aset.addAll((Collection<? extends AnnotationFS>) set);
          }
        }
        for (AnnotationFS annotationFS : aset) {
          list.add(annotationFS.getType());
        }
      } else if (TYPES_AT_END.equals(op)) {
        RutaBasic endAnchor = stream.getEndAnchor(matched.getEnd());
//        Collection<Set<AnnotationFS>> values = endAnchor.getEndMap().values();
        Collection<?>[] endMap = endAnchor.getEndMap();
        Set<AnnotationFS> aset = new HashSet<AnnotationFS>();
        for (Collection<?> set : endMap) {
          if(set != null) {
            aset.addAll((Collection<? extends AnnotationFS>) set);
          }
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

  }

  private Collection<AnnotationFS> getNextAnnotations(boolean before, AnnotationFS annotation,
          RutaStream stream, RutaBlock parent) {
    List<AnnotationFS> result = new ArrayList<AnnotationFS>(1);
    RutaBasic basicNextTo = stream.getBasicNextTo(before, annotation);
    if (basicNextTo == null) {
      return result;
    }
    String stringValue = expression.getStringValue(parent, annotation, stream);
    if (stringValue.equals(basicNextTo.getCoveredText())) {
      result.add(basicNextTo);
    }
    return result;
  }
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

      Type matchedType = annotationFS.getType();
      boolean subsumes = stream.getCas().getTypeSystem().subsumes(t, matchedType);
      if(subsumes && !allAtAnchor) {
        stream.removeAnnotation(annotationFS, t);
      } else {
        RutaBasic beginAnchor = stream.getBeginAnchor(annotationFS.getBegin());
        Collection<AnnotationFS> beginAnchors = beginAnchor.getBeginAnchors(t);
        if (beginAnchors != null) {
          for (AnnotationFS each : new ArrayList<AnnotationFS>(beginAnchors)) {
            if (allAtAnchor || each.getEnd() == annotationFS.getEnd()) {
              stream.removeAnnotation(each, t);
            }
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

    List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotations(null,
            element.getContainer());
    for (AnnotationFS matchedAnnotation : matchedAnnotations) {
      List<RutaBasic> list = stream.getBasicsInWindow(matchedAnnotation);
      if (!list.isEmpty()) {
        RutaBasic last = list.get(list.size() - 1);
        createAnnotation(last, element, stream, match);
      }

    }
View Full Code Here

Examples of org.apache.uima.ruta.type.RutaBasic

    for (Type type : types) {
      if (type == null) {
        continue;
      }
      String name = type.getName();
      RutaBasic firstBasicOfAll = stream.getFirstBasicOfAll();
      if ("uima.tcas.DocumentAnnotation".equals(name)
              || "org.apache.uima.ruta.type.Document".equals(name)
              || (stream.getDocumentAnnotationType().getName().equals(name) && (firstBasicOfAll != null && firstBasicOfAll
                      .beginsWith(type)))) {
        // TODO what about dynamic windowing?
        annotations.add(stream.getDocumentAnnotation());
      } else {
        annotations.addAll(stream.getAnnotations(type));
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.