Package org.apache.uima.ruta

Examples of org.apache.uima.ruta.RutaBlock


  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    List<Type> types = new ArrayList<Type>();
    RutaBlock parent = element.getParent();
    if (element instanceof RutaRuleElement) {
      types = ((RutaRuleElement) element).getMatcher().getTypes(parent, stream);
    }
    if (types == null)
      return;

    for (Type type : types) {
      String stringValue = featureStringExpression.getStringValue(parent, match, element, stream);
      Feature featureByBaseName = type.getFeatureByBaseName(stringValue);
      RutaEnvironment environment = parent.getEnvironment();
      List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotationsOf(element);
      for (AnnotationFS annotationFS : matchedAnnotations) {
        if (annotationFS.getType().getFeatureByBaseName(stringValue) == null) {
          System.out.println("Can't access feature " + stringValue
                  + ", because it's not defined in the matched type: " + annotationFS.getType());
View Full Code Here


  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    RutaEnvironment environment = parent.getEnvironment();
    List list = environment.getVariableValue(var, List.class);
    // Class<?> vtype = environment.getVariableType(var);
    Class<?> vgtype = environment.getVariableGenericType(var);
    for (RutaExpression each : elements) {
      if (each instanceof ListExpression) {
View Full Code Here

    this.parameterMap = map;
  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    RutaModule thisScript = parent.getScript();
    AnalysisEngine targetEngine = thisScript.getEngine(namespace);
    ConfigurationParameterDeclarations configurationParameterDeclarations = targetEngine
            .getAnalysisEngineMetaData().getConfigurationParameterDeclarations();

    Set<Entry<StringExpression, RutaExpression>> entrySet = parameterMap.entrySet();
View Full Code Here

  }

  protected void fillFeatures(TOP structure, Map<StringExpression, RutaExpression> features,
          AnnotationFS matchedAnnotation, RuleElement element, RutaStream stream) {
    Map<String, RutaExpression> map = new HashMap<String, RutaExpression>();
    RutaBlock parent = element.getParent();
    for (Entry<StringExpression, RutaExpression> each : features.entrySet()) {
      String value = each.getKey().getStringValue(parent, matchedAnnotation, stream);
      map.put(value, each.getValue());
    }
View Full Code Here

  }

  @SuppressWarnings({ "rawtypes" })
  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    List list = parent.getEnvironment().getVariableValue(var, List.class);
    List<Object> toRemove = new ArrayList<Object>();
    for (Object entry : list) {
      Object value1 = getValue(entry, parent, stream);
      for (RutaExpression arg : elements) {
        if (arg instanceof ListExpression) {
          ListExpression l = (ListExpression) arg;
          List list2 = l.getList(parent, stream);
          for (Object object : list2) {
            Object value2 = getValue(object, parent, stream);
            if (value1.equals(value2)) {
              toRemove.add(entry);
            }
          }
        } else {
          Object value2 = getValue(arg, parent, stream);
          if (value1.equals(value2)) {
            toRemove.add(entry);
          }
        }
      }
    }
    for (Object object : toRemove) {
      list.remove(object);
    }
    parent.getEnvironment().setVariableValue(var, list);
  }
View Full Code Here

    Type casType = stream.getJCas().getCasType(RutaColoring.type);
    FeatureStructure newAnnotationFS = stream.getCas().createFS(casType);
    RutaColoring coloring = null;
    if (newAnnotationFS instanceof RutaColoring) {
      coloring = (RutaColoring) newAnnotationFS;
      RutaBlock parent = element.getParent();
      coloring.setBgColor(bgcolor.getStringValue(parent, match, element, stream));
      coloring.setFgColor(fgcolor.getStringValue(parent, match, element, stream));
      coloring.setSelected(selected.getBooleanValue(parent, match, element, stream));
      coloring.setTargetType(type.getType(parent).getName());
      coloring.addToIndexes();
View Full Code Here

    this.maxIgnoreChar = maxIgnoreChar;
  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock block = element.getParent();
    RutaTable table = tableExpr.getTable(block);
    int index = indexExpr.getIntegerValue(block, match, element, stream);
    Type type = typeExpr.getType(block);
    Map<String, Integer> map = new HashMap<String, Integer>();
    for (StringExpression each : featureMap.keySet()) {
View Full Code Here

  }

  @Override
  protected void callScript(String blockName, RuleMatch match, RuleElement element,
          RutaStream stream, InferenceCrowd crowd, RutaModule targetScript) {
    RutaBlock block = targetScript.getBlock(blockName);
    if (block == null) {
      return;
    }
    RutaStream completeStream = stream.getCompleteStream();
    ScriptApply apply = block.apply(completeStream, crowd);
    match.addDelegateApply(this, apply);
  }
View Full Code Here

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {

    Map<String, Type> typeMap = new HashMap<String, Type>();
    RutaBlock parent = element.getParent();
    for (StringExpression eachKey : map.keySet()) {
      String stringValue = eachKey.getStringValue(parent, match, element, stream);
      TypeExpression typeExpression = map.get(eachKey);
      if (typeExpression != null) {
        Type typeValue = typeExpression.getType(parent);
View Full Code Here

  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    List<AnnotationFS> matchedAnnotationsOf = match.getMatchedAnnotationsOf(element);
    for (AnnotationFS annotationFS : matchedAnnotationsOf) {
      RutaStream windowStream = stream.getWindowStream(annotationFS, annotationFS.getType());
      RutaWordList wl = null;
      RutaBlock parent = element.getParent();
      if (list != null) {
        wl = list.getList(parent);
      } else if (stringList != null) {
        wl = new TreeWordList(stringList.getList(parent, stream));
      }
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.RutaBlock

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.