Examples of EvaluatedCondition


Examples of org.apache.uima.ruta.rule.EvaluatedCondition

    if(arg != null) {
      text = arg.getStringValue(element.getParent(), annotation, stream);
    }
    if (stringList == null) {
      RutaWordList wordList = listExpr.getList(element.getParent());
      return new EvaluatedCondition(this, wordList.contains(text, false, 0, null, 0, true));
    }
    List<String> sList = stringList.getList(element.getParent(), stream);
    boolean contains = sList.contains(text);
    return new EvaluatedCondition(this, contains);
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

      Date givenDate = dateFormat.parse(dateValue);
      int compareTo = matchedDate.compareTo(givenDate);
      result = compareTo < 0;
    } catch (Exception e) {
    }
    return new EvaluatedCondition(this, result);
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

      if (totalCount != 0) {
        percentValue = (((double) basicCount) / ((double) totalCount)) * 100;
      }
      boolean value = percentValue >= min.getDoubleValue(element.getParent(), annotation, stream)
              && percentValue <= max.getDoubleValue(element.getParent(), annotation, stream);
      return new EvaluatedCondition(this, value);
    } else {
      boolean value = anchorCount >= min.getIntegerValue(element.getParent(), annotation, stream)
              && anchorCount <= max.getIntegerValue(element.getParent(), annotation, stream);
      return new EvaluatedCondition(this, value);
    }
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

  @Override
  public EvaluatedCondition eval(AnnotationFS annotation, RuleElement element, RutaStream stream,
          InferenceCrowd crowd) {
    if (expr instanceof IBooleanExpression) {
      IBooleanExpression be = (IBooleanExpression) expr;
      return new EvaluatedCondition(this, be.getBooleanValue(element.getParent(), null, stream));
    } else if (expr instanceof FeatureMatchExpression) {
      FeatureMatchExpression fme = (FeatureMatchExpression) expr;
      TypeExpression typeExpr = fme.getTypeExpr();
      Type type = typeExpr.getType(element.getParent());
      List<AnnotationFS> annotations = getAnnotationsToCheck(annotation, type, fme, stream);
      Collection<AnnotationFS> featureAnnotations = fme.getFeatureAnnotations(annotations, stream,
              element.getParent(), true);
      return new EvaluatedCondition(this, !featureAnnotations.isEmpty());
    }
    return new EvaluatedCondition(this, false);
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

  public EvaluatedCondition eval(AnnotationFS annotation, RuleElement element, RutaStream stream,
          InferenceCrowd crowd) {
    if (!isWorkingOnList()) {
      Type t = type.getType(element.getParent());
      boolean result = check(t, annotation, element, stream);
      return new EvaluatedCondition(this, result);
    } else {
      boolean result = false;
      List<Type> types = getList().getList(element.getParent(), stream);
      for (Type t : types) {
        result |= check(t, annotation, element, stream);
        if (result == true) {
          break;
        }
      }
      return new EvaluatedCondition(this, result);
    }
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

  public EvaluatedCondition eval(AnnotationFS annotation, RuleElement element, RutaStream stream,
          InferenceCrowd crowd) {
    if (!isWorkingOnList()) {
      Type t = type.getType(element.getParent());
      boolean result = check(annotation, stream, t);
      return new EvaluatedCondition(this, result);
    } else {
      boolean result = false;
      List<Type> types = getList().getList(element.getParent(), stream);
      for (Type t : types) {
        result |= check(annotation, stream, t);
        if (result == true) {
          break;
        }
      }
      return new EvaluatedCondition(this, result);
    }
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

          RutaStream symbolStream, InferenceCrowd crowd) {
    boolean result = true;
    List<EvaluatedCondition> evals = new ArrayList<EvaluatedCondition>();
    for (AbstractRutaCondition each : conditions) {
      crowd.beginVisit(each, null);
      EvaluatedCondition eval = each.eval(currentSymbol, element, symbolStream, crowd);
      crowd.endVisit(each, null);
      result &= eval.isValue();
      evals.add(eval);
    }
    return new EvaluatedCondition(this, result, evals);
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

    boolean value = count >= minExpr.getIntegerValue(element.getParent(), annotation, stream)
            && count <= maxExpr.getIntegerValue(element.getParent(), annotation, stream);
    if (varExpr != null) {
      element.getParent().getEnvironment().setVariableValue(varExpr, count);
    }
    return new EvaluatedCondition(this, value);
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

          InferenceCrowd crowd) {
    int result = 0;
    List<EvaluatedCondition> evals = new ArrayList<EvaluatedCondition>();
    for (AbstractRutaCondition each : conditions) {
      crowd.beginVisit(each, null);
      EvaluatedCondition eval = each.eval(annotation, element, stream, crowd);
      crowd.endVisit(each, null);
      evals.add(eval);
      if (eval.isValue()) {
        result++;
      }
    }
    boolean value = result >= min.getIntegerValue(element.getParent(), annotation, stream)
            && result <= max.getIntegerValue(element.getParent(), annotation, stream);
    return new EvaluatedCondition(this, value, evals);
  }
View Full Code Here

Examples of org.apache.uima.ruta.rule.EvaluatedCondition

        if (each.beginsWith(t2)) {
          count2++;
        }
      }
    }
    return new EvaluatedCondition(this, count1 > count2);
  }
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.