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

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


      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


        List<Number> l = new ArrayList<Number>(le.getList(element.getParent()));
        while (l.remove(v)) {
          count++;
        }
      } else if (arg instanceof StringExpression && list instanceof StringListExpression) {
        StringExpression e = (StringExpression) arg;
        StringListExpression le = (StringListExpression) list;
        String v = e.getStringValue(element.getParent());
        List<String> l = new ArrayList<String>(le.getList(element.getParent()));
        while (l.remove(v)) {
          count++;
        }
      } else if (arg instanceof TypeExpression && list instanceof TypeListExpression) {
        TypeExpression e = (TypeExpression) arg;
        TypeListExpression le = (TypeListExpression) list;
        Type v = e.getType(element.getParent());
        List<Type> l = new ArrayList<Type>(le.getList(element.getParent()));
        while (l.remove(v)) {
          count++;
        }
      }
View Full Code Here

        if (iterator.isValid()) {
          result = iterator.get();
        }
      } else if (matcher instanceof RutaLiteralMatcher) {
        RutaLiteralMatcher lm = (RutaLiteralMatcher) matcher;
        StringExpression expression = lm.getExpression();
        String stringValue = expression.getStringValue(parent);
        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

  private void tryWithNextLiteral(boolean after, AnnotationFS annotation,
          RutaRuleElement nextElement, RuleMatch ruleMatch, RuleApply ruleApply,
          ComposedRuleElementMatch containerMatch, RutaRuleElement sideStepOrigin,
          RutaStream stream, InferenceCrowd crowd) {
    RutaLiteralMatcher matcher = (RutaLiteralMatcher) nextElement.getMatcher();
    StringExpression expression = matcher.getExpression();
    String stringValue = expression.getStringValue(parent);
    AnnotationFS documentAnnotation = stream.getDocumentAnnotation();
    int delta = documentAnnotation.getBegin();
    String document = documentAnnotation.getCoveredText();
    int pointer = 0;
    if(annotation != null) {
View Full Code Here

        List<Number> l = new ArrayList<Number>(le.getList(element.getParent()));
        while (l.remove(v)) {
          basicCount++;
        }
      } else if (arg instanceof StringExpression && argList instanceof StringListExpression) {
        StringExpression e = (StringExpression) arg;
        StringListExpression le = (StringListExpression) argList;
        String v = e.getStringValue(element.getParent());
        List<String> l = new ArrayList<String>(le.getList(element.getParent()));
        while (l.remove(v)) {
          basicCount++;
        }
      } else if (arg instanceof TypeExpression && argList instanceof TypeListExpression) {
        TypeExpression e = (TypeExpression) arg;
        TypeListExpression le = (TypeListExpression) argList;
        Type v = e.getType(element.getParent());
        List<Type> l = new ArrayList<Type>(le.getList(element.getParent()));
        while (l.remove(v)) {
          basicCount++;
        }
      }
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

    } 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

    assertEquals("Type1 == typeVar", s);
    s = v.verbalize(boolExpr11);
    assertEquals("Type1 != typeVar", s);

    List<StringExpression> stringExprList = new ArrayList<StringExpression>();
    StringExpression stringExpr1 = new SimpleStringExpression("string");
    StringExpression stringExpr2 = new ReferenceStringExpression(var);
    stringExprList.add(stringExpr1);
    stringExprList.add(stringExpr2);
    StringExpression stringExpr3 = new ComposedStringExpression(stringExprList);
   
    s = v.verbalize(stringExpr1);
    assertEquals("\"string\"", s);
    s = v.verbalize(stringExpr2);
    assertEquals("anyVar", s);
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);
    TypeListExpression typeListExpr = new SimpleTypeListExpression(typeExprList);
    StringListExpression stringListExpr = new SimpleStringListExpression(stringExprList);
    AbstractRutaCondition c = null;
    String s = null;
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(element.getParent());
      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(element.getParent());
              targetEngine.setConfigParameterValue(stringValue, list.toArray());
            } else if (value instanceof TypeListExpression) {
              TypeListExpression tle = (TypeListExpression) value;
              List<Type> list = tle.getList(element.getParent());
              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(element.getParent());
              targetEngine.setConfigParameterValue(stringValue, string);
            } else if (value instanceof TypeExpression) {
              TypeExpression te = (TypeExpression) value;
              Type t = te.getType(element.getParent());
              targetEngine.setConfigParameterValue(stringValue, t.getName());
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.