Class UIMAUtils
- java.lang.Object
-
- de.julielab.jcore.ae.jpos.postagger.UIMAUtils
-
public class UIMAUtils extends Object
TODO this tools should be added to JULES Utils
-
-
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>
List<T>getExactAnnotations(org.apache.uima.jcas.JCas jCas, org.apache.uima.jcas.tcas.Annotation windowAnnotation, Class<T> cls)same as getAnnotations however boundaries for windowAnnotation and cls must exactly match!static booleanhasSameOffset(org.apache.uima.jcas.tcas.Annotation a, org.apache.uima.jcas.tcas.Annotation b)check whether two annotation have exactly the same offset
-
-
-
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 viewwindowAnnotation- an annotation that defines a windowcls- 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)
-
getExactAnnotations
public static <T extends org.apache.uima.jcas.tcas.Annotation> List<T> getExactAnnotations(org.apache.uima.jcas.JCas jCas, org.apache.uima.jcas.tcas.Annotation windowAnnotation, Class<T> cls)
same as getAnnotations however boundaries for windowAnnotation and cls must exactly match!- Type Parameters:
T-- Parameters:
jCas-windowAnnotation-cls-- Returns:
- list of annotations of type cls
-
hasSameOffset
public static boolean hasSameOffset(org.apache.uima.jcas.tcas.Annotation a, org.apache.uima.jcas.tcas.Annotation b)check whether two annotation have exactly the same offset- Parameters:
a- annotation 1b- annotation 2- Returns:
- true or false
-
-