Examples of RutaAnnotation


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

  public RutaAnnotation getCorrectTMA(List<AnnotationFS> annotationsInWindow,
          RutaAnnotation heuristicAnnotation) {
    for (AnnotationFS annotation : annotationsInWindow) {
      if (annotation instanceof RutaAnnotation) {
        RutaAnnotation tma = (RutaAnnotation) annotation;
        if (tma.getBegin() == heuristicAnnotation.getBegin()
                && tma.getEnd() == heuristicAnnotation.getEnd()
                && tma.getAnnotation().getType()
                        .equals(heuristicAnnotation.getAnnotation().getType())) {
          return tma;
        }
      }
    }
View Full Code Here

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

  public RutaAnnotation getCorrectTMA(List<AnnotationFS> annotationsInWindow,
          RutaAnnotation heuristicAnnotation) {
    for (AnnotationFS annotation : annotationsInWindow) {
      if (annotation instanceof RutaAnnotation) {
        RutaAnnotation tma = (RutaAnnotation) annotation;
        if (tma.getBegin() == heuristicAnnotation.getBegin()
                && tma.getEnd() == heuristicAnnotation.getEnd()
                && tma.getAnnotation().getType()
                        .equals(heuristicAnnotation.getAnnotation().getType())) {
          return tma;
        }
      }
    }
View Full Code Here

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

    Type heuristicType = stream.getJCas().getCasType(RutaAnnotation.type);
    List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(annotation,
            heuristicType);
    double score = 0;
    if (!annotationsInWindow.isEmpty()) {
      RutaAnnotation heuristicAnnotation = (RutaAnnotation) stream.getCas().createAnnotation(
              heuristicType, annotation.getBegin(), annotation.getEnd());
      heuristicAnnotation.setAnnotation((Annotation) annotation);
      RutaAnnotation tma = stream.getCorrectTMA(annotationsInWindow, heuristicAnnotation);
      score = tma.getScore();
    }
    if (var != null) {
      element.getParent().getEnvironment().setVariableValue(var, score);
    }
    boolean value = score >= min.getDoubleValue(element.getParent(), null, stream)
View Full Code Here

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

  }

  protected void updateHeuristicAnnotation(RuleMatch match, RuleElement element, RutaStream stream,
          AnnotationFS matchedAnnotation, double deltaScore) {
    Type heuristicType = stream.getJCas().getCasType(RutaAnnotation.type);
    RutaAnnotation heuristicAnnotation = (RutaAnnotation) stream.getCas().createAnnotation(
            heuristicType, matchedAnnotation.getBegin(), matchedAnnotation.getEnd());
    Annotation newAnnotation = (Annotation) stream.getCas().createAnnotation(
            type.getType(element.getParent()), heuristicAnnotation.getBegin(),
            heuristicAnnotation.getEnd());
    heuristicAnnotation.setScore(deltaScore);
    heuristicAnnotation.setAnnotation(newAnnotation);
    List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(heuristicAnnotation,
            heuristicType);

    if (annotationsInWindow.isEmpty()) {
      heuristicAnnotation.addToIndexes();
      newAnnotation.addToIndexes();
      stream.addAnnotation(newAnnotation, match);
    } else {
      RutaAnnotation tma = stream.getCorrectTMA(annotationsInWindow, heuristicAnnotation);
      if (tma != null) {
        tma.removeFromIndexes();
        double newScore = tma.getScore() + deltaScore;
        tma.setScore(newScore);
        tma.addToIndexes();
      } else {
        heuristicAnnotation.addToIndexes();
        newAnnotation.addToIndexes();
        stream.addAnnotation(newAnnotation, match);
      }
View Full Code Here

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

  }

  protected void updateHeuristicAnnotation(RuleMatch match, RuleElement element,
          RutaStream stream, AnnotationFS matchedAnnotation, double deltaScore) {
    Type heuristicType = stream.getJCas().getCasType(RutaAnnotation.type);
    RutaAnnotation heuristicAnnotation = (RutaAnnotation) stream.getCas()
            .createAnnotation(heuristicType, matchedAnnotation.getBegin(),
                    matchedAnnotation.getEnd());
    Annotation newAnnotation = (Annotation) stream.getCas().createAnnotation(
            type.getType(element.getParent()), heuristicAnnotation.getBegin(),
            heuristicAnnotation.getEnd());
    heuristicAnnotation.setScore(deltaScore);
    heuristicAnnotation.setAnnotation(newAnnotation);
    List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(heuristicAnnotation,
            heuristicType);

    if (annotationsInWindow.isEmpty()) {
      heuristicAnnotation.addToIndexes();
      newAnnotation.addToIndexes();
      stream.addAnnotation(newAnnotation, match);
    } else {
      RutaAnnotation tma = stream.getCorrectTMA(annotationsInWindow, heuristicAnnotation);
      if (tma != null) {
        tma.removeFromIndexes();
        double newScore = tma.getScore() + deltaScore;
        tma.setScore(newScore);
        tma.addToIndexes();
      } else {
        heuristicAnnotation.addToIndexes();
        newAnnotation.addToIndexes();
        stream.addAnnotation(newAnnotation, match);
      }
View Full Code Here

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

    Type heuristicType = stream.getJCas().getCasType(RutaAnnotation.type);
    List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(annotation,
            heuristicType);
    double score = 0;
    if (!annotationsInWindow.isEmpty()) {
      RutaAnnotation heuristicAnnotation = (RutaAnnotation) stream.getCas()
              .createAnnotation(heuristicType, annotation.getBegin(), annotation.getEnd());
      heuristicAnnotation.setAnnotation((Annotation) annotation);
      RutaAnnotation tma = stream.getCorrectTMA(annotationsInWindow, heuristicAnnotation);
      score = tma.getScore();
    }
    if (var != null) {
      element.getParent().getEnvironment().setVariableValue(var, score);
    }
    boolean value = score >= min.getDoubleValue(element.getParent())
View Full Code Here

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

  public RutaAnnotation getCorrectTMA(List<AnnotationFS> annotationsInWindow,
          RutaAnnotation heuristicAnnotation) {
    for (AnnotationFS annotation : annotationsInWindow) {
      if (annotation instanceof RutaAnnotation) {
        RutaAnnotation tma = (RutaAnnotation) annotation;
        if (tma.getBegin() == heuristicAnnotation.getBegin()
                && tma.getEnd() == heuristicAnnotation.getEnd()
                && tma.getAnnotation().getType()
                        .equals(heuristicAnnotation.getAnnotation().getType())) {
          return tma;
        }
      }
    }
View Full Code Here

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

  public RutaAnnotation getCorrectTMA(List<AnnotationFS> annotationsInWindow,
          RutaAnnotation heuristicAnnotation) {
    for (AnnotationFS annotation : annotationsInWindow) {
      if (annotation instanceof RutaAnnotation) {
        RutaAnnotation tma = (RutaAnnotation) annotation;
        if (tma.getBegin() == heuristicAnnotation.getBegin()
                && tma.getEnd() == heuristicAnnotation.getEnd()
                && tma.getAnnotation().getType()
                        .equals(heuristicAnnotation.getAnnotation().getType())) {
          return tma;
        }
      }
    }
View Full Code Here

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

    Type heuristicType = stream.getJCas().getCasType(RutaAnnotation.type);
    List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(annotation,
            heuristicType);
    double score = 0;
    if (!annotationsInWindow.isEmpty()) {
      RutaAnnotation heuristicAnnotation = (RutaAnnotation) stream.getCas().createAnnotation(
              heuristicType, annotation.getBegin(), annotation.getEnd());
      heuristicAnnotation.setAnnotation((Annotation) annotation);
      RutaAnnotation tma = stream.getCorrectTMA(annotationsInWindow, heuristicAnnotation);
      score = tma.getScore();
    }
    if (var != null) {
      element.getParent().getEnvironment().setVariableValue(var, score);
    }
    boolean value = score >= min.getDoubleValue(element.getParent(), null, stream)
View Full Code Here

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

  }

  protected void updateHeuristicAnnotation(RuleMatch match, RuleElement element, RutaStream stream,
          AnnotationFS matchedAnnotation, double deltaScore) {
    Type heuristicType = stream.getJCas().getCasType(RutaAnnotation.type);
    RutaAnnotation heuristicAnnotation = (RutaAnnotation) stream.getCas().createAnnotation(
            heuristicType, matchedAnnotation.getBegin(), matchedAnnotation.getEnd());
    Annotation newAnnotation = (Annotation) stream.getCas().createAnnotation(
            type.getType(element.getParent()), heuristicAnnotation.getBegin(),
            heuristicAnnotation.getEnd());
    heuristicAnnotation.setScore(deltaScore);
    heuristicAnnotation.setAnnotation(newAnnotation);
    List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(heuristicAnnotation,
            heuristicType);

    if (annotationsInWindow.isEmpty()) {
      heuristicAnnotation.addToIndexes();
      newAnnotation.addToIndexes();
      stream.addAnnotation(newAnnotation, match);
    } else {
      RutaAnnotation tma = stream.getCorrectTMA(annotationsInWindow, heuristicAnnotation);
      if (tma != null) {
        tma.removeFromIndexes();
        double newScore = tma.getScore() + deltaScore;
        tma.setScore(newScore);
        tma.addToIndexes();
      } else {
        heuristicAnnotation.addToIndexes();
        newAnnotation.addToIndexes();
        stream.addAnnotation(newAnnotation, match);
      }
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.