Package de.julielab.jcore.utility.index
In the this package, a range of
JCoReAnnotationIndex implementations
can be found.
These classes leverage the Map and TreeSet classes to structure
a given set of annotations
by some comparator, e.g. start offset comparator. After a first run where a concrete index
implementation is filled with the annotations from a CAS, the CAS annotation indices can be left
alone and the index can be consulted efficiently for specific annotations. This is used, for example,
using the overlap comparator defined in Comparators.
With this comparator, one can find annotations overlapping a given annotation.
When using a map annotation index, the map keys are so-called IndexTerms.
Consult the TermGenerators class for predefined index
term generators which are used for indexing and for searching. Index terms can be long numbers
encoding start and end offsets of annotations, for example, allowing for a very efficient
retrieval of overlapping annotations.-
Interface Summary Interface Description IndexTermGenerator<K extends java.lang.Comparable<K>> An interface that defines a way to construct index or search terms from an annotation a.JCoReAnnotationIndex<T extends org.apache.uima.jcas.tcas.Annotation> A common interface for JCoRe annotation indexes. -
Class Summary Class Description Comparators This class offers some commonly used comparators on annotations.JCoReCoverIndex<E extends org.apache.uima.jcas.tcas.Annotation> Use when: You need access to annotations between a given begin- and end-offset or completely covered by another annotation.JCoReHashMapAnnotationIndex<K extends java.lang.Comparable<K>,T extends org.apache.uima.jcas.tcas.Annotation> Use when: You basically just need a map that maps from some key to annotations associated with that key.JCoReMapAnnotationIndex<K extends java.lang.Comparable<K>,T extends org.apache.uima.jcas.tcas.Annotation> Use when: You want to access annotations by an some arbitrary key that should be computed once and then only used for access.JCoReOverlapAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation> Use when: You need to access arbitrary annotations that are in any way overlapped by an input annotation (warning: these quite loose restrictions cause a relatively high search complexity, see below).JCoReSetAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation> Use when: You just want an ordered set of annotations that can be retrieved according to anComparator.JCoReTreeMapAnnotationIndex<K extends java.lang.Comparable<K>,T extends org.apache.uima.jcas.tcas.Annotation> Use when: You want a fuzzy search on the index keys (please see the note in the next paragraph) or ou specifically need aTreeMapinstead of aHashMap(if not, refer toJCoReHashMapAnnotationIndex) for some other reason.TermGenerators This class offers a range of predefined term generators (to be used as a constructor argument toJCoReMapAnnotationIndexthat might be useful in a range of applications.TermGenerators.LongOffsetIndexTermGenerator