org.apache.ctakes.sideeffect.util
Class PatternMatch

java.lang.Object
  extended by org.apache.ctakes.sideeffect.util.PatternMatch

public class PatternMatch
extends Object

Regular expression pattern match class used in SideEffectAnnotaor: Constructor: PatternMatch(String expr, String in, List kw): "expr" is an regular expression. Note that "KW" will be replaced by the list of kw argument; "in" is a string to match; "kw" is a list of keywords; PatternMatch(String expr, String in): "expr" is an regular expression; "in" is a string to match.

Author:
Mayo Clinic

Field Summary
 Matcher mat
           
 Pattern pat
           
 
Constructor Summary
PatternMatch(String expr, String in)
           
PatternMatch(String expr, String in, List<String> kw)
           
 
Method Summary
 boolean isDistantBetween(int begin, int end)
          Return true if exist other than "and" "or" "," (ignoring DRUG and PSE) in input.substring(begin, end)
 boolean isDrugBetween(int begin, int end)
          Return true if finds "DRUG" in input.substring(begin, end)
 boolean isDrugBetween(int begin, int end, int[] span)
          Return true if finds "DRUG" in input.substring(begin, end) and assign offsets of DRUG to span
 boolean isPseBetween(int begin, int end)
          Return true if finds "PSE" in input.substring(begin, end)
 boolean isPseBetween(int begin, int end, int[] span)
          Return true if finds "PSE" in input.substring(begin, end) and assign offsets of PSE to span
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pat

public Pattern pat

mat

public Matcher mat
Constructor Detail

PatternMatch

public PatternMatch(String expr,
                    String in,
                    List<String> kw)

PatternMatch

public PatternMatch(String expr,
                    String in)
Method Detail

isDrugBetween

public boolean isDrugBetween(int begin,
                             int end)
Return true if finds "DRUG" in input.substring(begin, end)

Parameters:
begin -
end -

isDrugBetween

public boolean isDrugBetween(int begin,
                             int end,
                             int[] span)
Return true if finds "DRUG" in input.substring(begin, end) and assign offsets of DRUG to span

Parameters:
begin -
end -
span - offset of the first DRUG in "input"
Returns:

isPseBetween

public boolean isPseBetween(int begin,
                            int end)
Return true if finds "PSE" in input.substring(begin, end)

Parameters:
begin -
end -

isPseBetween

public boolean isPseBetween(int begin,
                            int end,
                            int[] span)
Return true if finds "PSE" in input.substring(begin, end) and assign offsets of PSE to span

Parameters:
begin -
end -
span - offset of the first PSE in "input"
Returns:

isDistantBetween

public boolean isDistantBetween(int begin,
                                int end)
Return true if exist other than "and" "or" "," (ignoring DRUG and PSE) in input.substring(begin, end)

Parameters:
begin -
end -
Returns:


Copyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.