Package org.apache.uima.ruta.rule

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


  public List<RuleElementMatch> evaluateMatches(List<RuleElementMatch> matches,
          RutaStatement element, InferenceCrowd crowd) {
    int minValue = min.getIntegerValue(element.getParent());
    int maxValue = max.getIntegerValue(element.getParent());
    if (matches.size() > 0) {
      RuleElementMatch ruleElementMatch = matches.get(matches.size() - 1);
      if (!ruleElementMatch.matched()) {
        matches.remove(ruleElementMatch);
      }
    }
    int matchedSize = matches.size();
    boolean result = matchedSize >= minValue && matchedSize <= maxValue;
View Full Code Here


    int matchedSize = list.size();
    if (list == null || list.isEmpty() || matchedSize < minValue) {
      return true;
    }
    RuleElementMatch lastMatch = null;
    if (after) {
      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)
            || (!lastMatch.matched() && matchedSize >= minValue && matchedSize <= maxValue && !nextMatched);
  }
View Full Code Here

        List<RuleElementMatch> tms = getMatchInfo(match, element, reIndexes);
        if (tms.size() == 0) {// do nothing

        } else if (tms.size() == 1) {
          RuleElementMatch tm = tms.get(0);
          List<AnnotationFS> textsMatched = tm.getTextsMatched();
          if (textsMatched.size() == 1) {
            AnnotationFS fs = textsMatched.get(0);
            if (typeSystem.subsumes(jcas.getCasType(FSArray.type), range)) {
              List<AnnotationFS> list = new ArrayList<AnnotationFS>();
              list.add(fs);
View Full Code Here

    Type t = type.getType(element.getParent());
    TypeSystem typeSystem = stream.getCas().getTypeSystem();
    List<AnnotationFS> toRemove = new LinkedList<AnnotationFS>();
    List<List<RuleElementMatch>> matchInfo = match.getMatchInfo(element);
    for (List<RuleElementMatch> l : matchInfo) {
      RuleElementMatch ruleElementMatch = l.get(0);
      List<AnnotationFS> textsMatched = ruleElementMatch.getTextsMatched();
      for (AnnotationFS each : textsMatched) {
        RutaBasic beginAnchor = stream.getBeginAnchor(each.getBegin());
        Set<AnnotationFS> beginAnchors = beginAnchor.getBeginAnchors(t);
        for (AnnotationFS annotationFS : beginAnchors) {
          if (annotationFS.getEnd() == each.getEnd()
View Full Code Here

          RutaBlock parent, RutaStream stream, InferenceCrowd crowd) {
    int minValue = min.getIntegerValue(parent, null, stream);
    int maxValue = max.getIntegerValue(parent, null, stream);

    if (matches.size() > 0) {
      RuleElementMatch ruleElementMatch = matches.get(matches.size() - 1);
      if (!ruleElementMatch.matched()) {
        matches.remove(ruleElementMatch);
      }
    }

    int matchedSize = matches.size();
View Full Code Here

    }
    int matchedSize = list.size();
    if (list == null || list.isEmpty() || matchedSize < minValue) {
      return true;
    }
    RuleElementMatch lastMatch = null;
    if (after) {
      lastMatch = list.get(list.size() - 1);
    } else {
      lastMatch = list.get(0);
    }
    return matchedSize < maxValue
            || (!lastMatch.matched() && matchedSize >= minValue && matchedSize <= maxValue);
  }
View Full Code Here

  public List<RuleElementMatch> evaluateMatches(List<RuleElementMatch> matches,
          RutaBlock parent, RutaStream stream, InferenceCrowd crowd) {
    int minValue = min.getIntegerValue(parent, null, stream);
    int maxValue = max.getIntegerValue(parent, null, stream);
    if (matches.size() > 0) {
      RuleElementMatch ruleElementMatch = matches.get(matches.size() - 1);
      if (!ruleElementMatch.matched()) {
        matches.remove(ruleElementMatch);
      }
    }
    int matchedSize = matches.size();
    boolean result = matchedSize >= minValue && matchedSize <= maxValue;
View Full Code Here

    int matchedSize = list.size();
    if (list == null || list.isEmpty() || matchedSize < minValue) {
      return true;
    }
    RuleElementMatch lastMatch = null;
    if (after) {
      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)
            || (!lastMatch.matched() && matchedSize >= minValue && matchedSize <= maxValue && !nextMatched);
  }
View Full Code Here

    Type t = type.getType(element.getParent());
    TypeSystem typeSystem = stream.getCas().getTypeSystem();
    List<AnnotationFS> toRemove = new LinkedList<AnnotationFS>();
    List<List<RuleElementMatch>> matchInfo = match.getMatchInfo(element);
    for (List<RuleElementMatch> l : matchInfo) {
      RuleElementMatch ruleElementMatch = l.get(0);
      List<AnnotationFS> textsMatched = ruleElementMatch.getTextsMatched();
      for (AnnotationFS each : textsMatched) {
        RutaBasic beginAnchor = stream.getBeginAnchor(each.getBegin());
        Set<AnnotationFS> beginAnchors = beginAnchor.getBeginAnchors(t);
        for (AnnotationFS annotationFS : beginAnchors) {
          if (annotationFS.getEnd() == each.getEnd()
View Full Code Here

        List<RuleElementMatch> tms = getMatchInfo(match, element, reIndexes);
        if (tms.size() == 0) {// do nothing

        } else if (tms.size() == 1) {
          RuleElementMatch tm = tms.get(0);
          List<AnnotationFS> textsMatched = tm.getTextsMatched();
          if (textsMatched.size() == 1) {
            AnnotationFS fs = textsMatched.get(0);
            if (typeSystem.subsumes(jcas.getCasType(FSArray.type), range)) {
              List<AnnotationFS> list = new ArrayList<AnnotationFS>();
              list.add(fs);
View Full Code Here

TOP

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

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.