Examples of RutaBlock


Examples of org.apache.uima.ruta.RutaBlock

  }

  protected void callScript(String blockName, RuleMatch match, RuleElement element,
          RutaStream stream, InferenceCrowd crowd, RutaModule targetScript) {
    RutaBlock block = targetScript.getBlock(blockName);
    if (block == null) {
      return;
    }
    List<AnnotationFS> matchedAnnotationsOf = match.getMatchedAnnotationsOf(element, stream);
    for (AnnotationFS annotationFS : matchedAnnotationsOf) {
      RutaStream windowStream = stream.getWindowStream(annotationFS,
              stream.getDocumentAnnotationType());
      ScriptApply apply = block.apply(windowStream, crowd);
      match.addDelegateApply(this, apply);
    }

  }
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

      resetEnvironment(module, cas);
    }
  }

  private void resetEnvironment(RutaModule module, CAS cas) {
    RutaBlock block = module.getBlock(null);
    block.getEnvironment().reset(cas);
    Collection<RutaBlock> blocks = module.getBlocks().values();
    for (RutaBlock each : blocks) {
      each.getEnvironment().reset(cas);
    }
  }
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

    }
  }

  private void initializeTypes(RutaModule script, CAS cas) {
    // TODO find a better solution for telling everyone about the types!
    RutaBlock mainRootBlock = script.getBlock(null);
    mainRootBlock.getEnvironment().initializeTypes(cas);
    Collection<RutaModule> values = script.getScripts().values();
    for (RutaModule eachModule : values) {
      relinkEnvironments(eachModule, mainRootBlock);
      // initializeTypes(eachModule, cas);
    }
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

      // initializeTypes(eachModule, cas);
    }
  }

  private void relinkEnvironments(RutaModule script, RutaBlock mainRootBlock) {
    RutaBlock block = script.getBlock(null);
    block.setParent(mainRootBlock);
    Collection<RutaModule> innerScripts = script.getScripts().values();
    for (RutaModule module : innerScripts) {
      relinkEnvironments(module, mainRootBlock);
    }
  }
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream,
          InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    RutaEnvironment environment = parent.getEnvironment();
    Class<?> clazz = environment.getVariableType(var);
    if (clazz.equals(Integer.class) && expression instanceof NumberExpression) {
      int v = ((NumberExpression) expression).getIntegerValue(parent);
      environment.setVariableValue(var, v);
    } else if (clazz.equals(Double.class) && expression instanceof NumberExpression) {
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

  }

  @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);
    Type type = typeExpr.getType(block);
    Map<String, Integer> map = new HashMap<String, Integer>();
    for (StringExpression each : featureMap.keySet()) {
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

  }

  @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

Examples of org.apache.uima.ruta.RutaBlock

  @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

Examples of org.apache.uima.ruta.RutaBlock

  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream,
          InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    boolean activated = active.getBooleanValue(parent);
    stream.setDynamicAnchoring(activated);
    if (panelty != null) {
      double p = panelty.getDoubleValue(parent);
      stream.setIndexPenalty(p);
View Full Code Here

Examples of org.apache.uima.ruta.RutaBlock

    return typeExpr;
  }

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    RutaBlock parent = element.getParent();
    String featureString = featureStringExpression.getStringValue(parent, match, element, stream);
    List<AnnotationFS> matchedAnnotations = match.getMatchedAnnotationsOf(element);
    for (AnnotationFS annotationFS : matchedAnnotations) {
      Feature feature = annotationFS.getType().getFeatureByBaseName(featureString);
      if (feature != null) {
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.