Package org.apache.uima.ruta.rule

Examples of org.apache.uima.ruta.rule.RuleElement


          InferenceCrowd crowd) {
    if(annotation == null) {
      // do not try to continue a match that totally failed
      return false;
    }
    RuleElement nextElement = ruleElement.getContainer().getNextElement(after, ruleElement);
    if (nextElement == null) {
      return false;
    }
    ComposedRuleElementMatch extendedContainerMatch = containerMatch.copy();
    RuleMatch extendedMatch = ruleMatch.copy(extendedContainerMatch);
    nextElement.continueMatch(after, annotation, extendedMatch, null, extendedContainerMatch, null,
            nextElement, stream, crowd);
    List<RuleElementMatch> nextList = extendedContainerMatch.getInnerMatches().get(nextElement);
    return nextList == null || nextList.isEmpty() || !nextList.get(nextList.size() - 1).matched();
  }
View Full Code Here


      lastMatch = list.get(list.size() - 1);
    } else {
      lastMatch = list.get(0);
    }

    RuleElement nextElement = ruleElement.getContainer().getNextElement(after, ruleElement);
    if (nextElement == null) {
      return false;
    }
    ComposedRuleElementMatch extendedContainerMatch = containerMatch.copy();
    RuleMatch extendedMatch = ruleMatch.copy(extendedContainerMatch);
    nextElement.continueMatch(after, annotation, extendedMatch, null, extendedContainerMatch, null,
            nextElement, stream, crowd);
    List<RuleElementMatch> nextList = extendedContainerMatch.getInnerMatches().get(nextElement);
    boolean nextMatched = (nextList != null && !nextList.isEmpty());

    return (matchedSize < maxValue && matchedSize >= minValue && !nextMatched)
View Full Code Here

    List<RuleElementMatch> ownList = containerMatch.getInnerMatches().get(ruleElement);
    if (ownList == null || ownList.isEmpty()) {
      return true;
    }

    RuleElement nextElement = ruleElement.getContainer().getNextElement(after, ruleElement);
    if (nextElement == null) {
      return false;
    }
    ComposedRuleElementMatch extendedContainerMatch = containerMatch.copy();
    RuleMatch extendedMatch = ruleMatch.copy(extendedContainerMatch);
    nextElement.continueMatch(after, annotation, extendedMatch, null, extendedContainerMatch, null,
            nextElement, stream, crowd);
    List<RuleElementMatch> nextList = extendedContainerMatch.getInnerMatches().get(nextElement);
    return nextList == null || nextList.isEmpty() || !nextList.get(nextList.size() - 1).matched();
  }
View Full Code Here

    List<RuleElementMatch> ownList = containerMatch.getInnerMatches().get(ruleElement);
    if (ownList != null && !ownList.isEmpty()) {
      return false;
    }

    RuleElement nextElement = ruleElement.getContainer().getNextElement(after, ruleElement);
    if (nextElement == null) {
      return false;
    }
    ComposedRuleElementMatch extendedContainerMatch = containerMatch.copy();
    RuleMatch extendedMatch = ruleMatch.copy(extendedContainerMatch);
    nextElement.continueMatch(after, annotation, extendedMatch, null, extendedContainerMatch, null,
            nextElement, stream, crowd);
    List<RuleElementMatch> nextList = extendedContainerMatch.getInnerMatches().get(nextElement);
    return nextList == null || nextList.isEmpty() || !nextList.get(nextList.size() - 1).matched();
  }
View Full Code Here

        List<RuleElement> list = map.get(conCounter);
        if (list == null) {
          list = new ArrayList<RuleElement>();
          map.put(conCounter, list);
        }
        RuleElement e = reList.get(reCounter);
        list.add(e);
        reCounter++;
      } else {
        connectors.add(token.getText());
        conCounter++;
View Full Code Here

    }
    List<RuleElement> ruleElements = element.getContainer().getRuleElements();
    for (Integer each : indexes) {
      if (each > 0 && each <= ruleElements.size()) {
        Type type = getRandomType(stream);
        RuleElement ruleElement = ruleElements.get(each - 1);
        List<AnnotationFS> matchedAnnotationsOf = match.getMatchedAnnotationsOf(ruleElement);
        for (AnnotationFS eachMatched : matchedAnnotationsOf) {
          AnnotationFS newAFS = stream.getCas().createAnnotation(type, eachMatched.getBegin(),
                  eachMatched.getEnd());
          stream.addAnnotation(newAFS, true, match);
View Full Code Here

          ComposedRuleElementMatch rootMatch) {
    Set<Entry<RuleElement, List<RuleElementMatch>>> entrySet = rootMatch.getInnerMatches()
            .entrySet();
    List<DebugRuleElementMatches> ruleElementMatches = new ArrayList<DebugRuleElementMatches>();
    for (Entry<RuleElement, List<RuleElementMatch>> entry : entrySet) {
      RuleElement re = entry.getKey();
      List<RuleElementMatch> rems = entry.getValue();
      ruleElementMatches.add(createDebugRuleElementMatches(re, rems, stream, addToIndex));
    }

    drm.setElements(UIMAUtils.toFSArray(cas, ruleElementMatches));
View Full Code Here

          DebugRuleElementMatch drm, ComposedRuleElementMatch rootMatch) {
    Set<Entry<RuleElement, List<RuleElementMatch>>> entrySet = rootMatch.getInnerMatches()
            .entrySet();
    List<DebugRuleElementMatches> ruleElementMatches = new ArrayList<DebugRuleElementMatches>();
    for (Entry<RuleElement, List<RuleElementMatch>> entry : entrySet) {
      RuleElement re = entry.getKey();
      List<RuleElementMatch> rems = entry.getValue();
      ruleElementMatches.add(createDebugRuleElementMatches(re, rems, stream, addToIndex));
    }
    drm.setElements(UIMAUtils.toFSArray(cas, ruleElementMatches));
  }
View Full Code Here

    JCas cas = stream.getJCas();
    DebugRuleElementMatch drem = new DebugRuleElementMatch(cas);

    DebugEvaluatedCondition base = new DebugEvaluatedCondition(cas);
    base.setValue(rem.isBaseConditionMatched());
    RuleElement ruleElement = rem.getRuleElement();
    String baseString = "";
    if (ruleElement instanceof RutaRuleElement) {
      baseString = verbalizer.verbalizeMatcher((RutaRuleElement) ruleElement);
    } else if (ruleElement instanceof ComposedRuleElement) {
      baseString = verbalizer.verbalizeComposed((ComposedRuleElement) ruleElement);
View Full Code Here

          List<Number> reIndexes) {
    List<RuleElementMatch> result = new ArrayList<RuleElementMatch>();
    List<RuleElement> elements = element.getContainer().getRuleElements();
    for (Number eachNumber : reIndexes) {
      int eachInt = eachNumber.intValue();
      RuleElement ruleElement = elements.get(eachInt - 1);
      List<List<RuleElementMatch>> matchInfo = match.getMatchInfo(ruleElement);
      for (List<RuleElementMatch> list : matchInfo) {
        result.addAll(list);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.rule.RuleElement

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.