Examples of IStringExpression


Examples of org.apache.uima.ruta.expression.string.IStringExpression

      if (iterator.isValid()) {
        result = iterator.get();
      }
    } else if (matcher instanceof RutaLiteralMatcher) {
      RutaLiteralMatcher lm = (RutaLiteralMatcher) matcher;
      IStringExpression expression = lm.getExpression();
      String stringValue = expression.getStringValue(parent, annotation, stream);
      AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
      int delta = documentAnnotation.getBegin();
      String document = documentAnnotation.getCoveredText();
      int pointer = annotation.getEnd() - delta;
      int indexOf = document.indexOf(stringValue, pointer);
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

          RutaRuleElement nextElement, RuleMatch ruleMatch, RuleApply ruleApply,
          ComposedRuleElementMatch containerMatch, int nextDepth, RutaRuleElement sideStepOrigin,
          RutaStream stream, InferenceCrowd crowd) {
    List<RuleMatch> result = new ArrayList<RuleMatch>();
    RutaLiteralMatcher matcher = (RutaLiteralMatcher) nextElement.getMatcher();
    IStringExpression expression = matcher.getExpression();
    String stringValue = expression.getStringValue(parent, null, stream);
    AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
    int delta = documentAnnotation.getBegin();
    String document = documentAnnotation.getCoveredText();
    int pointer = 0;
    if (annotation != null) {
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

      if (feature != null) {
        Type range = feature.getRange();
        String rangeName = range.getName();
        stream.getCas().removeFsFromIndexes(annotationFS);
        if (rangeName.equals(UIMAConstants.TYPE_STRING) && expr instanceof IStringExpression) {
          IStringExpression stringExpr = (IStringExpression) expr;
          String string = stringExpr.getStringValue(parent, match, element, stream);
          annotationFS.setStringValue(feature, string);
        } else if (rangeName.equals(UIMAConstants.TYPE_INTEGER)
                && expr instanceof INumberExpression) {
          INumberExpression numberExpr = (INumberExpression) expr;
          int v = numberExpr.getIntegerValue(parent, match, element, stream);
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

          return ne.getFloatValue(owner, null, null);
        } else if (clazz.equals(String.class)) {
          return ne.getStringValue(owner, null, null);
        }
      } else if (clazz.equals(String.class) && value instanceof IStringExpression) {
        IStringExpression se = (IStringExpression) value;
        return se.getStringValue(owner, null, null);
      } else if (clazz.equals(Boolean.class) && value instanceof IBooleanExpression) {
        IBooleanExpression be = (IBooleanExpression) value;
        return be.getBooleanValue(owner, null, null);
      }
      if (clazz.equals(RutaWordList.class) && value instanceof LiteralWordListExpression) {
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

  private void setFeatureValue(AnnotationFS a, Feature feature, IRutaExpression argExpr,
          RuleElement element, RutaStream stream) {
    String range = feature.getRange().getName();
    if (range.equals(UIMAConstants.TYPE_STRING)) {
      if (argExpr instanceof IStringExpression) {
        IStringExpression stringExpr = (IStringExpression) argExpr;
        String string = stringExpr.getStringValue(element.getParent(), null, stream);
        a.setStringValue(feature, string);
      }
    } else if (argExpr instanceof INumberExpression
            && (range.equals(UIMAConstants.TYPE_INTEGER) || range.equals(UIMAConstants.TYPE_LONG)
                    || range.equals(UIMAConstants.TYPE_SHORT) || range
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

          return ne.getFloatValue(owner, null, null);
        } else if (clazz.equals(String.class)) {
          return ne.getStringValue(owner, null, null);
        }
      } else if (clazz.equals(String.class) && value instanceof IStringExpression) {
        IStringExpression se = (IStringExpression) value;
        return se.getStringValue(owner, null, null);
      } else if (clazz.equals(Boolean.class) && value instanceof IBooleanExpression) {
        IBooleanExpression be = (IBooleanExpression) value;
        return be.getBooleanValue(owner, null, null);
      }
      if (clazz.equals(RutaWordList.class) && value instanceof LiteralWordListExpression) {
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

        typeMap = new HashMap<String, Object>();
        map.put(type, typeMap);
      }
      Set<Entry<IStringExpression, IRutaExpression>> entrySet2 = value.entrySet();
      for (Entry<IStringExpression, IRutaExpression> entry2 : entrySet2) {
        IStringExpression key2 = entry2.getKey();
        IRutaExpression value2 = entry2.getValue();
        String stringValue = key2.getStringValue(getParent(), null, stream);
        typeMap.put(stringValue, value2);
      }
    }
    return result;
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

  public void test() {
    RutaVerbalizer v = new RutaVerbalizer();
    List<TypeExpression> typeExprList = new ArrayList<TypeExpression>();
    List<IStringExpression> stringExprList = new ArrayList<IStringExpression>();
    String var = "anyVar";
    IStringExpression varExpr = new ReferenceNumberExpression(var);
    TypeExpression typeExpr1 = new SimpleTypeExpression("Type1");
    TypeExpression typeExpr2 = new ReferenceTypeExpression("typeVar");
    typeExprList.add(typeExpr1);
    typeExprList.add(typeExpr2);
    INumberExpression numExpr1 = new SimpleNumberExpression(4);
    INumberExpression numExpr2 = new ReferenceNumberExpression("numVar");
    IBooleanExpression boolExpr1 = new SimpleBooleanExpression(true);
    IStringExpression stringExpr = new SimpleStringExpression("string");
    stringExprList.add(stringExpr);
    TypeListExpression typeListExpr = new SimpleTypeListExpression(typeExprList);
    StringListExpression stringListExpr = new SimpleStringListExpression(stringExprList);
    AbstractRutaCondition c = null;
    String s = null;
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

      // null is possibly coveredText
      if (feature != null) {
        v1 = afs.getStringValue(feature);
      }
      if (arg instanceof IStringExpression) {
        IStringExpression expr = (IStringExpression) arg;
        String v2 = expr.getStringValue(parent, afs, stream);
        return compare(v1, v2);
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.uima.ruta.expression.string.IStringExpression

        }

      }
    } else if (matcher instanceof RutaLiteralMatcher) {
      RutaLiteralMatcher lm = (RutaLiteralMatcher) matcher;
      IStringExpression expression = lm.getExpression();
      String stringValue = expression.getStringValue(parent, annotation, stream);
      AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
      int delta = documentAnnotation.getBegin();
      String document = documentAnnotation.getCoveredText();
      int pointer = annotation.getEnd() - delta;
      int indexOf = document.indexOf(stringValue, pointer);
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.