Modifier and Type | Method and Description |
---|---|
static boolean |
contains(JCas jCas,
AnnotationFS coveringAnnotation,
Class<? extends Annotation> type)
Check if the given annotation contains any annotation of the given type.
|
static <T extends TOP> |
exists(JCas aJCas,
Class<T> aType)
Test if a JCas contains an annotation of the given type.
|
static Type |
getAnnotationType(JCas jCas,
Class<?> type)
Get the CAS type for the given JCas wrapper class type making sure it inherits from
Annotation . |
static Type |
getType(JCas jCas,
Class<?> type)
Get the CAS type for the given JCas wrapper class type.
|
static JCas |
getView(JCas jcas,
String viewName,
boolean create)
Convenience method to get the specified view or create a new view if the requested view does
not exist.
|
static JCas |
getView(JCas jcas,
String viewName,
JCas fallback)
Convenience method to get the specified view or a default view if the requested view does not
exist.
|
static <T extends Annotation,S extends Annotation> |
indexCovered(JCas jCas,
Class<T> type,
Class<S> coveredType)
Create an index for quickly lookup up the annotations covered by a particular annotation.
|
static <T extends Annotation,S extends Annotation> |
indexCovering(JCas jCas,
Class<T> type,
Class<S> coveringType)
Create an index for quickly lookup up the annotations covering a particular annotation.
|
static <T extends AnnotationFS> |
iterator(AnnotationFS container,
Class<T> type,
boolean ambiguous,
boolean strict)
Convenience method to get a sub-iterator for the specified type.
|
static <T extends TOP> |
iterator(JCas jCas,
Class<T> type)
Get an iterator over the given feature structure type.
|
static <T extends TOP> |
select(FSArray array,
Class<T> type)
Convenience method select all feature structure from the given type from an array.
|
static <T extends TOP> |
select(FSList list,
Class<T> type)
Convenience method select all feature structure from the given type from a list.
|
static <T extends TOP> |
select(JCas jCas,
Class<T> type)
Convenience method to iterator over all features structures of a given type.
|
static Collection<TOP> |
selectAll(JCas jCas)
Convenience method to iterator over all features structures.
|
static <T extends Annotation> |
selectBetween(Class<T> type,
AnnotationFS ann1,
AnnotationFS ann2)
Get a list of annotations of the given annotation type located between two annotations.
|
static <T extends Annotation> |
selectBetween(JCas jCas,
Class<T> type,
AnnotationFS ann1,
AnnotationFS ann2)
Get a list of annotations of the given annotation type located between two annotations.
|
static <T extends Annotation> |
selectByIndex(JCas jCas,
Class<T> cls,
int index)
This method exists simply as a convenience method for unit testing.
|
static <T extends AnnotationFS> |
selectCovered(Class<T> type,
AnnotationFS coveringAnnotation)
Get a list of annotations of the given annotation type constrained by a 'covering' annotation.
|
static <T extends Annotation> |
selectCovered(JCas jCas,
Class<T> type,
AnnotationFS coveringAnnotation)
Get a list of annotations of the given annotation type constrained by a 'covering' annotation.
|
static <T extends Annotation> |
selectCovered(JCas jCas,
Class<T> type,
int begin,
int end)
Get a list of annotations of the given annotation type constrained by a 'covering' annotation.
|
static <T extends Annotation> |
selectCovering(Class<T> type,
AnnotationFS coveredAnnotation)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static <T extends Annotation> |
selectCovering(JCas jCas,
Class<T> type,
AnnotationFS coveredAnnotation)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static <T extends Annotation> |
selectCovering(JCas jCas,
Class<T> type,
int begin,
int end)
Get a list of annotations of the given annotation type constraint by a certain annotation.
|
static <T extends Annotation> |
selectFollowing(Class<T> aType,
AnnotationFS annotation,
int count)
Returns the n annotations following the given annotation
|
static <T extends Annotation> |
selectFollowing(JCas aJCas,
Class<T> aType,
AnnotationFS annotation,
int count)
Returns the n annotations following the given annotation
|
static <T extends Annotation> |
selectPreceding(Class<T> aType,
AnnotationFS annotation,
int count)
Returns the n annotations preceding the given annotation
|
static <T extends Annotation> |
selectPreceding(JCas aJCas,
Class<T> aType,
AnnotationFS annotation,
int count)
Returns the n annotations preceding the given annotation
|
static <T extends TOP> |
selectSingle(JCas jCas,
Class<T> type)
Get the single instance of the specified type from the JCas.
|
static <T extends Annotation> |
selectSingleRelative(Class<T> aType,
AnnotationFS annotation,
int index)
Return an annotation preceding or following of a given reference annotation.
|
static <T extends Annotation> |
selectSingleRelative(JCas aJCas,
Class<T> aType,
AnnotationFS annotation,
int index)
Return an annotation preceding or following of a given reference annotation.
|
static <T extends Annotation> |
subiterate(JCas jCas,
Class<T> type,
AnnotationFS container,
boolean ambiguous,
boolean strict)
Convenience method to iterator over all annotations of a given type occurring within the scope
of a provided annotation (sub-iteration).
|
static <T extends AnnotationFS> |
toText(Iterable<T> iterable)
Fetch the text covered by the specified annotations and return it as a list of strings.
|
public static <T extends Annotation> Iterable<T> subiterate(JCas jCas, Class<T> type, AnnotationFS container, boolean ambiguous, boolean strict)
T
- the iteration type.jCas
- a JCas.container
- the containing annotation.type
- the type.ambiguous
- If set to false
, resulting iterator will be unambiguous.strict
- Controls if annotations that overlap to the right are considered in or out.AnnotationIndex.subiterator(AnnotationFS, boolean, boolean)
,
Order of selected feature structurespublic static <T extends TOP> Iterator<T> iterator(JCas jCas, Class<T> type)
T
- the JCas type.jCas
- a JCas.type
- a type.public static <T extends AnnotationFS> Iterator<T> iterator(AnnotationFS container, Class<T> type, boolean ambiguous, boolean strict)
T
- the iteration type.container
- the containing annotation.type
- the type.ambiguous
- If set to false
, resulting iterator will be unambiguous.strict
- Controls if annotations that overlap to the right are considered in or out.public static Type getType(JCas jCas, Class<?> type)
jCas
- the JCas containing the type system.type
- the JCas wrapper class type.public static Type getAnnotationType(JCas jCas, Class<?> type)
Annotation
.jCas
- the JCas containing the type system.type
- the JCas wrapper class type.public static <T extends TOP> Collection<T> select(FSArray array, Class<T> type)
T
- the JCas type.array
- a feature structure array.type
- the type.public static <T extends TOP> Collection<T> select(FSList list, Class<T> type)
T
- the JCas type.list
- a feature structure list.type
- the type.public static <T extends TOP> Collection<T> select(JCas jCas, Class<T> type)
T
- the iteration type.jCas
- the JCas containing the type system.type
- the type.public static Collection<TOP> selectAll(JCas jCas)
jCas
- the JCas containing the type system. the type.public static <T extends Annotation> List<T> selectBetween(Class<T> type, AnnotationFS ann1, AnnotationFS ann2)
type
- a UIMA type.ann1
- the first boundary annotation.ann2
- the second boundary annotation.Subiterator
,
Order of selected feature structurespublic static <T extends Annotation> List<T> selectBetween(JCas jCas, Class<T> type, AnnotationFS ann1, AnnotationFS ann2)
jCas
- a JCas containing the annotation.type
- a UIMA type.ann1
- the first boundary annotation.ann2
- the second boundary annotation.Subiterator
,
Order of selected feature structurespublic static <T extends AnnotationFS> List<T> selectCovered(Class<T> type, AnnotationFS coveringAnnotation)
T
- the JCas type.type
- a UIMA type.coveringAnnotation
- the covering annotation.Subiterator
,
Order of selected feature structurespublic static <T extends Annotation> List<T> selectCovered(JCas jCas, Class<T> type, AnnotationFS coveringAnnotation)
T
- the JCas type.jCas
- a JCas containing the annotation.type
- a UIMA type.coveringAnnotation
- the covering annotation.Subiterator
,
Order of selected feature structurespublic static <T extends Annotation> List<T> selectCovered(JCas jCas, Class<T> type, int begin, int end)
Note: this is significantly slower than using
selectCovered(JCas, Class, AnnotationFS)
. It is possible to use
selectCovered(jCas, cls, new Annotation(jCas, int, int))
, but that will allocate memory
in the jCas for the new annotation. If you do that repeatedly many times, memory may fill up.
T
- the JCas type.jCas
- a JCas containing the annotation.type
- a UIMA type.begin
- begin offset.end
- end offset.public static <T extends Annotation> List<T> selectCovering(Class<T> type, AnnotationFS coveredAnnotation)
Note: this is REALLY SLOW! You don't want to use this. Instead, consider using
indexCovering(JCas, Class, Class)
or a ContainmentIndex
.
T
- the JCas type.type
- a UIMA type.coveredAnnotation
- the covered annotation.public static <T extends Annotation> List<T> selectCovering(JCas jCas, Class<T> type, AnnotationFS coveredAnnotation)
Note: this is REALLY SLOW! You don't want to use this. Instead, consider using
indexCovering(JCas, Class, Class)
or a ContainmentIndex
.
T
- the JCas type.jCas
- a CAS.type
- a UIMA type.coveredAnnotation
- the covered annotation.public static <T extends Annotation> List<T> selectCovering(JCas jCas, Class<T> type, int begin, int end)
Note: this is REALLY SLOW! You don't want to use this. Instead, consider using
indexCovering(JCas, Class, Class)
or a ContainmentIndex
.
T
- the JCas type.jCas
- a CAS.type
- a UIMA type.begin
- begin offset.end
- end offset.public static <T extends Annotation,S extends Annotation> Map<T,Collection<S>> indexCovering(JCas jCas, Class<T> type, Class<S> coveringType)
selectCovering(JCas, Class, int, int)
because the overhead of
scanning the CAS occurs only when the index is build. Subsequent lookups to the index are fast.T
- the JCas type.jCas
- a JCas.type
- type to create the index for - this is used in lookups.coveringType
- type of covering annotations.public static <T extends Annotation,S extends Annotation> Map<T,Collection<S>> indexCovered(JCas jCas, Class<T> type, Class<S> coveredType)
selectCovered(JCas, Class, int, int)
because the overhead of
scanning the CAS occurs only when the index is build. Subsequent lookups to the index are fast.T
- the JCas type.jCas
- a JCas.type
- type to create the index for - this is used in lookups.coveredType
- type of covered annotations.public static boolean contains(JCas jCas, AnnotationFS coveringAnnotation, Class<? extends Annotation> type)
jCas
- a JCas containing the annotation.coveringAnnotation
- the covering annotation.type
- a UIMA type.public static <T extends Annotation> T selectByIndex(JCas jCas, Class<T> cls, int index)
It is intentional that this method only allows annotation types. The CAS indexing mechanisms are not well defined for non-annotation types. There are no reliably, built-in indexes for non-annotation types.
T
- JCas wrapper type.jCas
- a JCas containing the annotation.cls
- a UIMA type.index
- this can be either positive (0 corresponds to the first annotation of a type) or
negative (-1 corresponds to the last annotation of a type.)public static <T extends TOP> T selectSingle(JCas jCas, Class<T> type)
T
- JCas wrapper type.jCas
- a JCas containing the annotation.type
- a UIMA type.public static <T extends Annotation> T selectSingleRelative(Class<T> aType, AnnotationFS annotation, int index)
T
- the JCas type.aType
- a type.annotation
- anchor annotationindex
- relative position to access. A negative value selects a preceding annotation while a
positive number selects a following annotation.IndexOutOfBoundsException
- if the relative index points beyond the type index bounds.public static <T extends Annotation> T selectSingleRelative(JCas aJCas, Class<T> aType, AnnotationFS annotation, int index)
T
- the JCas type.aJCas
- a JCas.aType
- a type.annotation
- anchor annotationindex
- relative position to access. A negative value selects a preceding annotation while a
positive number selects a following annotation.IndexOutOfBoundsException
- if the relative index points beyond the type index bounds.public static <T extends Annotation> List<T> selectPreceding(Class<T> aType, AnnotationFS annotation, int count)
T
- the JCas type.aType
- a type.annotation
- anchor annotationcount
- number of annotations to collectpublic static <T extends Annotation> List<T> selectPreceding(JCas aJCas, Class<T> aType, AnnotationFS annotation, int count)
T
- the JCas type.aJCas
- a JCas.aType
- a type.annotation
- anchor annotationcount
- number of annotations to collectpublic static <T extends Annotation> List<T> selectFollowing(Class<T> aType, AnnotationFS annotation, int count)
T
- the JCas type.aType
- a type.annotation
- anchor annotationcount
- number of annotations to collectpublic static <T extends Annotation> List<T> selectFollowing(JCas aJCas, Class<T> aType, AnnotationFS annotation, int count)
T
- the JCas type.aJCas
- a JCas.aType
- a type.annotation
- anchor annotationcount
- number of annotations to collectpublic static <T extends TOP> boolean exists(JCas aJCas, Class<T> aType)
T
- the annotation type.aJCas
- a JCas.aType
- a annotation class.true
if there is at least one annotation of the given type in the JCas.public static JCas getView(JCas jcas, String viewName, JCas fallback)
null
.jcas
- a JCasviewName
- the requested view.fallback
- the default view if the requested view does not exist.IllegalStateException
- if the JCas wrapper cannot be obtained.public static JCas getView(JCas jcas, String viewName, boolean create)
jcas
- a JCasviewName
- the requested view.create
- the view is created if it does not exist.IllegalStateException
- if the JCas wrapper cannot be obtained.public static <T extends AnnotationFS> List<String> toText(Iterable<T> iterable)
T
- UIMA JCas type.iterable
- annotation container.Copyright © 2012–2013 The Apache Software Foundation. All rights reserved.