public boolean checkPosConstraint(Sentence s,String posConstraint,MatchResult m,JCas jcas){
  Pattern paConstraint=Pattern.compile("group\\(([0-9]+)\\):(.*?):");
  for (  MatchResult mr : Toolbox.findMatches(paConstraint,posConstraint)) {
    int groupNumber=Integer.parseInt(mr.group(1));
    int tokenBegin=s.getBegin() + m.start(groupNumber);
    int tokenEnd=s.getBegin() + m.end(groupNumber);
    String pos=mr.group(2);
    String pos_as_is=getPosFromMatchResult(tokenBegin,tokenEnd,s,jcas);
    if (pos_as_is.matches(pos)) {
      Logger.printDetail("POS CONSTRAINT IS VALID: pos should be " + pos + " and is "+ pos_as_is);
    }
 else {
      return false;
    }
  }
  return true;
}

public boolean checkPosConstraint ( Sentence s , String posConstraint , MatchResult m , JCas jcas ) { Pattern paConstraint = Pattern . compile ( "group\\(([0-9]+)\\):(.*?):" ) ; for ( MatchResult mr : Toolbox . findMatches ( paConstraint , posConstraint ) ) { int groupNumber = Integer . parseInt ( mr . group ( 1 ) ) ; int tokenBegin = s . getBegin ( ) + m . start ( groupNumber ) ; int tokenEnd = s . getBegin ( ) + m . end ( groupNumber ) ; String pos = mr . group ( 2 ) ; String pos_as_is = getPosFromMatchResult ( tokenBegin , tokenEnd , s , jcas ) ; if ( pos_as_is . matches ( pos ) ) { Logger . printDetail ( "POS CONSTRAINT IS VALID: pos should be " + pos + " and is " + pos_as_is ) ; } else { return false ; } } return true ; }
check whether the part of speech constraint defined in a rule is satisfied .
