Package org.apache.uima.ruta.expression.string

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


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


      NumberExpression indexExpr = a.getIndexExpr();
      WordTableExpression tableExpr = a.getTableExpr();
      Map<StringExpression, NumberExpression> featureMap = a.getFeatureMap();
      BooleanExpression ignoreCase = a.getIgnoreCase();
      NumberExpression ignoreLength = a.getIgnoreLength();
      StringExpression ignoreChar = a.getIgnoreChar();
      NumberExpression maxIgnoreChar = a.getMaxIgnoreChar();

      String type = verbalizer.verbalize(typeExpr);
      String index = verbalizer.verbalize(indexExpr);
      String table = verbalizer.verbalize(tableExpr);
View Full Code Here

        return compare(v1, v2);
      }
    } else if (rn.equals(UIMAConstants.TYPE_STRING)) {
      String v1 = afs.getStringValue(feature);
      if (arg instanceof StringExpression) {
        StringExpression expr = (StringExpression) arg;
        String v2 = expr.getStringValue(parent, afs, stream);
        return compare(v1, v2);
      }
    }
    return false;
  }
View Full Code Here

          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 StringExpression) {
        StringExpression se = (StringExpression) value;
        return se.getStringValue(owner, null, null);
      } else if (clazz.equals(Boolean.class) && value instanceof BooleanExpression) {
        BooleanExpression be = (BooleanExpression) value;
        return be.getBooleanValue(owner, null, null);
      }
      if (clazz.equals(RutaWordList.class) && value instanceof LiteralWordListExpression) {
View Full Code Here

    } else if (expression instanceof ComposedStringExpression) {
      ComposedStringExpression e = (ComposedStringExpression) expression;
      StringBuilder sb = new StringBuilder();
      Iterator<StringExpression> it = e.getExpressions().iterator();
      while (it.hasNext()) {
        StringExpression each = it.next();
        sb.append(verbalize(each));
        if (it.hasNext()) {
          sb.append(" + ");
        }
      }
View Full Code Here

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

    ConfigurationParameterDeclarations configurationParameterDeclarations = targetEngine
            .getAnalysisEngineMetaData().getConfigurationParameterDeclarations();

    Set<Entry<StringExpression, RutaExpression>> entrySet = parameterMap.entrySet();
    for (Entry<StringExpression, RutaExpression> entry : entrySet) {
      StringExpression key = entry.getKey();
      String stringValue = key.getStringValue(parent, match, element, stream);
      ConfigurationParameter configurationParameter = configurationParameterDeclarations
              .getConfigurationParameter(null, stringValue);
      if (configurationParameter != null) {
        RutaExpression value = entry.getValue();
        String type = configurationParameter.getType();
        if (type.equals("String")) {
          if (configurationParameter.isMultiValued()) {
            if (value instanceof StringListExpression) {
              StringListExpression sle = (StringListExpression) value;
              List<String> list = sle.getList(parent, stream);
              targetEngine.setConfigParameterValue(stringValue, list.toArray());
            } else if (value instanceof TypeListExpression) {
              TypeListExpression tle = (TypeListExpression) value;
              List<Type> list = tle.getList(parent, stream);
              List<String> stringList = new ArrayList<String>();
              for (Type each : list) {
                stringList.add(each.getName());
              }
              targetEngine.setConfigParameterValue(stringValue, stringList.toArray());
            }
          } else {
            if (value instanceof StringExpression) {
              StringExpression se = (StringExpression) value;
              String string = se.getStringValue(parent, match, element, stream);
              targetEngine.setConfigParameterValue(stringValue, string);
            } else if (value instanceof TypeExpression) {
              TypeExpression te = (TypeExpression) value;
              Type t = te.getType(parent);
              targetEngine.setConfigParameterValue(stringValue, t.getName());
View Full Code Here

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

    typeExprList.add(typeExpr1);
    typeExprList.add(typeExpr2);
    NumberExpression numExpr1 = new SimpleNumberExpression(4);
    NumberExpression numExpr2 = new ReferenceNumberExpression("numVar");
    BooleanExpression boolExpr1 = new SimpleBooleanExpression(true);
    StringExpression stringExpr = new SimpleStringExpression("string");
    stringExprList.add(stringExpr);
    exprList.add(typeExpr1);
    WordTableExpression wordTableExpr = new ReferenceWordTableExpression(var);
    WordListExpression wordListExpr = new ReferenceWordListExpression(var);
    TypeListExpression typeListExpr = new SimpleTypeListExpression(typeExprList);
View Full Code Here

  public void test() {
    RutaVerbalizer v = new RutaVerbalizer();
    List<TypeExpression> typeExprList = new ArrayList<TypeExpression>();
    List<StringExpression> stringExprList = new ArrayList<StringExpression>();
    String var = "anyVar";
    StringExpression varExpr = new ReferenceNumberExpression(var);
    TypeExpression typeExpr1 = new SimpleTypeExpression("Type1");
    TypeExpression typeExpr2 = new ReferenceTypeExpression("typeVar");
    typeExprList.add(typeExpr1);
    typeExprList.add(typeExpr2);
    NumberExpression numExpr1 = new SimpleNumberExpression(4);
    NumberExpression numExpr2 = new ReferenceNumberExpression("numVar");
    BooleanExpression boolExpr1 = new SimpleBooleanExpression(true);
    StringExpression 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

TOP

Related Classes of org.apache.uima.ruta.expression.string.StringExpression

Copyright © 2018 www.massapicom. 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.