public class AnnotationUtil extends Object
| Constructor and Description |
|---|
AnnotationUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
contains(Annotation bigAnnotation,
Annotation smallAnnotation) |
static int[] |
getAnnotationsExtent(List<? extends Annotation> annotations) |
static <TOKEN_TYPE extends Annotation> |
getSurroundingText(JCas jCas,
Annotation annotation,
Class<TOKEN_TYPE> tokenClass,
int numberOfTokens,
boolean before)
This method provides a way of getting some text before or after an annotation specified by some
"window" of "tokens".
|
static boolean |
overlaps(Annotation annotation1,
Annotation annotation2) |
static <T extends Annotation> |
selectFirstMatching(JCas jCas,
Class<T> selectedType,
Annotation annotation) |
static <T extends Annotation> |
selectMatching(JCas jCas,
Class<T> selectedType,
Annotation annotation) |
static int |
size(Annotation annotation) |
static <T extends Annotation> |
sort(List<T> annotations) |
public AnnotationUtil()
public static boolean contains(Annotation bigAnnotation, Annotation smallAnnotation)
public static int[] getAnnotationsExtent(List<? extends Annotation> annotations)
public static <TOKEN_TYPE extends Annotation> String getSurroundingText(JCas jCas, Annotation annotation, Class<TOKEN_TYPE> tokenClass, int numberOfTokens, boolean before)
annotation - an annotation to get surrounding/nearby text from. This can be any kind of annotation.tokenClass - the kind of "tokens" to use. This could be any kind of annotation type as well.numberOfTokens - the number of tokens to consider when creating a span of textbefore - determines whether to return text occuring before the annotation or afterpublic static boolean overlaps(Annotation annotation1, Annotation annotation2)
public static <T extends Annotation> T selectFirstMatching(JCas jCas, Class<T> selectedType, Annotation annotation)
public static <T extends Annotation> List<T> selectMatching(JCas jCas, Class<T> selectedType, Annotation annotation)
public static int size(Annotation annotation)
public static <T extends Annotation> void sort(List<T> annotations)
Copyright © 2014. All rights reserved.