Class UIMAUtils


  • public class UIMAUtils
    extends Object
    copied from Ph. Ogren TODO correct reference!
    • Constructor Summary

      Constructors 
      Constructor Description
      UIMAUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends org.apache.uima.jcas.tcas.Annotation>
      List<T>
      getAnnotations​(org.apache.uima.jcas.JCas jCas, org.apache.uima.jcas.tcas.Annotation windowAnnotation, Class<T> cls)
      This method returns all annotations (in order) that are inside a "window" annotation of a particular kind.
      static <T extends org.apache.uima.jcas.tcas.Annotation>
      T
      getContainingAnnotation​(org.apache.uima.jcas.JCas jCas, org.apache.uima.jcas.tcas.Annotation focusAnnotation, Class<T> cls)
      This method finds the smallest annotation of containingType that begins before or at the same character as the focusAnnotation and ends after or at the same character as the focusAnnotation.
    • Constructor Detail

      • UIMAUtils

        public UIMAUtils()
    • Method Detail

      • getAnnotations

        public static <T extends org.apache.uima.jcas.tcas.Annotation> List<T> getAnnotations​(org.apache.uima.jcas.JCas jCas,
                                                                                              org.apache.uima.jcas.tcas.Annotation windowAnnotation,
                                                                                              Class<T> cls)
        This method returns all annotations (in order) that are inside a "window" annotation of a particular kind. The functionality provided is similar to using AnnotationIndex.subiterator(), however we found the use of type priorities which is documented in detail in their javadocs to be distasteful. This method does not require that type priorities be set in order to work as expected for the condition where the window annotation and the "windowed" annotation have the same size and location.
        Type Parameters:
        T - determines the return type of the method
        Parameters:
        jCas - the current jCas or view
        windowAnnotation - an annotation that defines a window
        cls - determines the return type of the method
        Returns:
        a list of annotations of type cls that are "inside" the window
        See Also:
        AnnotationIndex.subiterator(org.apache.uima.cas.text.AnnotationFS)
      • getContainingAnnotation

        public static <T extends org.apache.uima.jcas.tcas.Annotation> T getContainingAnnotation​(org.apache.uima.jcas.JCas jCas,
                                                                                                 org.apache.uima.jcas.tcas.Annotation focusAnnotation,
                                                                                                 Class<T> cls)
        This method finds the smallest annotation of containingType that begins before or at the same character as the focusAnnotation and ends after or at the same character as the focusAnnotation.
        Type Parameters:
        T -
        Parameters:
        jCas -
        focusAnnotation -
        cls - the type of annotation you want returned
        Returns:
        an annotation of type containingType that contains the focus annotation or null it one does not exist.