org.apache.ctakes.sideeffect.util
Class SEUtil

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

public class SEUtil
extends Object

Utility methods used in the project

Author:
Mayo Clinic

Constructor Summary
SEUtil()
           
 
Method Summary
static int contains(int b1, int e1, int b2, int e2)
          Returns 1 if 1 contains 2 Returns 2 if 2 contains 1 Returns 0 otherwise
static List getDrugsInSpan(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return the List of drug IdentifiedAnnotation within the span
static org.apache.uima.jcas.JCas getJCasViewWithDefault(org.apache.uima.cas.CAS cas, String name)
          helper to look for plain text view for CDA processing or else use the default view.
static int getNumOfWordTokensInSpan(org.apache.uima.jcas.JCas jcas, int begin, int end)
          return the number of words except for "and" "or" in span
static int getNumOfWordTokensInSpanExceptGivenNE(org.apache.uima.jcas.JCas jcas, int begin, int end, int neType)
          return the number of words in span except for "and" "or" and given NE
static String getSegmentID(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return segmentID contain the given span
static String getSegmentIDOfSpan(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return segmentID of the sentence containing the given span
static int getSentenceNumContainingGivenSpan(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return sentenceNumber of the sentence containing the given span
static int[] getSentenceSpanContainingGivenSpan(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return sentence span containing the span (begin & end)
static int[] getSentenceSpanOfGivenSentenceNum(org.apache.uima.jcas.JCas jcas, int senNum)
          Return sentence span of the given sentence number
static String getSentenceTextContainingGivenSpan(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return sentence text containing the span (begin & end)
static boolean intersects(int b1, int e1, int b2, int e2)
          Returns true if one span intersects with the other
static boolean isDrugBetween(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return true if a drug is between begin and end
static boolean isInUpperCaseStringLine(org.apache.uima.jcas.JCas jcas, IdentifiedAnnotation nea)
          Return true if the given NE belongs to the line consisting of a upper-cased string without " - "
static boolean isPSEBetween(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return true if a sign/symptom or disease/disorder is between begin and end
static boolean isSpanInSameLine(org.apache.uima.jcas.JCas jcas, int begin, int end)
          Return true if the given offsets are in the same line
static boolean isUpperCaseString(String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SEUtil

public SEUtil()
Method Detail

getSentenceSpanContainingGivenSpan

public static int[] getSentenceSpanContainingGivenSpan(org.apache.uima.jcas.JCas jcas,
                                                       int begin,
                                                       int end)
Return sentence span containing the span (begin & end)

Parameters:
jcas -
begin -
end -
Returns:
int[] - int[0] is begin offset and int[1] is end offset

getSentenceTextContainingGivenSpan

public static String getSentenceTextContainingGivenSpan(org.apache.uima.jcas.JCas jcas,
                                                        int begin,
                                                        int end)
Return sentence text containing the span (begin & end)

Parameters:
jcas -
begin -
end -
Returns:
int[] - int[0] is begin offset and int[1] is end offset

getSentenceSpanOfGivenSentenceNum

public static int[] getSentenceSpanOfGivenSentenceNum(org.apache.uima.jcas.JCas jcas,
                                                      int senNum)
Return sentence span of the given sentence number

Parameters:
jcas -
senNum -
Returns:
int[] - int[0] is begin offset and int[1] is end offset

getSegmentIDOfSpan

public static String getSegmentIDOfSpan(org.apache.uima.jcas.JCas jcas,
                                        int begin,
                                        int end)
Return segmentID of the sentence containing the given span

Parameters:
jcas -
begin - - begin offset
end - - end offset
Returns:

getSegmentID

public static String getSegmentID(org.apache.uima.jcas.JCas jcas,
                                  int begin,
                                  int end)
Return segmentID contain the given span

Parameters:
jcas -
begin -
end -
Returns:

contains

public static int contains(int b1,
                           int e1,
                           int b2,
                           int e2)
Returns 1 if 1 contains 2 Returns 2 if 2 contains 1 Returns 0 otherwise


intersects

public static boolean intersects(int b1,
                                 int e1,
                                 int b2,
                                 int e2)
Returns true if one span intersects with the other


getDrugsInSpan

public static List getDrugsInSpan(org.apache.uima.jcas.JCas jcas,
                                  int begin,
                                  int end)
Return the List of drug IdentifiedAnnotation within the span

Parameters:
jcas -
begin -
end -
Returns:

getSentenceNumContainingGivenSpan

public static int getSentenceNumContainingGivenSpan(org.apache.uima.jcas.JCas jcas,
                                                    int begin,
                                                    int end)
Return sentenceNumber of the sentence containing the given span

Parameters:
jcas -
begin -
end -
Returns:
sentenceNumber of the sentence containing the given span

getNumOfWordTokensInSpan

public static int getNumOfWordTokensInSpan(org.apache.uima.jcas.JCas jcas,
                                           int begin,
                                           int end)
return the number of words except for "and" "or" in span

Parameters:
jcas -
begin -
end -
Returns:

getNumOfWordTokensInSpanExceptGivenNE

public static int getNumOfWordTokensInSpanExceptGivenNE(org.apache.uima.jcas.JCas jcas,
                                                        int begin,
                                                        int end,
                                                        int neType)
return the number of words in span except for "and" "or" and given NE

Parameters:
jcas -
begin -
end -
Returns:

isUpperCaseString

public static boolean isUpperCaseString(String str)

isInUpperCaseStringLine

public static boolean isInUpperCaseStringLine(org.apache.uima.jcas.JCas jcas,
                                              IdentifiedAnnotation nea)
Return true if the given NE belongs to the line consisting of a upper-cased string without " - "

Parameters:
jcas -
nea -
Returns:

isSpanInSameLine

public static boolean isSpanInSameLine(org.apache.uima.jcas.JCas jcas,
                                       int begin,
                                       int end)
Return true if the given offsets are in the same line

Parameters:
jcas -
begin -
end -
Returns:

isDrugBetween

public static boolean isDrugBetween(org.apache.uima.jcas.JCas jcas,
                                    int begin,
                                    int end)
Return true if a drug is between begin and end

Parameters:
jcas -
begin -
end -
Returns:

isPSEBetween

public static boolean isPSEBetween(org.apache.uima.jcas.JCas jcas,
                                   int begin,
                                   int end)
Return true if a sign/symptom or disease/disorder is between begin and end

Parameters:
jcas -
begin -
end -
Returns:

getJCasViewWithDefault

public static org.apache.uima.jcas.JCas getJCasViewWithDefault(org.apache.uima.cas.CAS cas,
                                                               String name)
                                                        throws org.apache.uima.cas.CASException
helper to look for plain text view for CDA processing or else use the default view.

Parameters:
cas -
name -
Returns:
Throws:
org.apache.uima.cas.CASException


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