E - The annotation type the index should be over.public class JCoReOverlapAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation> extends Object implements JCoReAnnotationIndex<E>
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).
Note: If it can be guaranteed that the index elements do not overlap
themselves, a JCoReSetAnnotationIndex with an
Comparators.overlapComparator() should be used instead of this class.
This index allows to index annotations and then retrieve all those annotations overlapping in any way with another annotation or an arbitrary given pair of begin and end offsets. Each search has the complexity O(n/2) where n is the size of the index. This rather bad complexity class stems from the fast that this class handles the general case of overlapping: Suppose we search for an annotation a that happens to be in the middle of the document. The only thing we know is that we can rule out all index elements then begin after a and those that end before a. All other annotations might still overlap a. We have to compare to all index elements from the beginning (or the end) up to the point where we know that we can omit the rest of the index elements. Those are - in the case a lies in the middle of the index elements - n/2.
| Constructor and Description |
|---|
JCoReOverlapAnnotationIndex() |
JCoReOverlapAnnotationIndex(org.apache.uima.jcas.JCas jcas,
int type) |
JCoReOverlapAnnotationIndex(org.apache.uima.jcas.JCas jcas,
org.apache.uima.cas.Type type) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(E a) |
void |
freeze() |
void |
index(E annotation) |
void |
index(org.apache.uima.jcas.JCas jCas,
int type)
Indexes the whole contents of the CAS annotation index of type
type.
|
void |
index(org.apache.uima.jcas.JCas jCas,
org.apache.uima.cas.Type type)
Indexes the whole contents of the CAS annotation index of type
type.
|
void |
melt()
Un-freeze the index to allow new elements to be added.
|
<T extends org.apache.uima.jcas.tcas.Annotation> |
search(T a)
Returns all annotation in the index overlapping in any way with a
(embedded, covering, partial overlappings).
|
public JCoReOverlapAnnotationIndex()
public JCoReOverlapAnnotationIndex(org.apache.uima.jcas.JCas jcas,
int type)
public JCoReOverlapAnnotationIndex(org.apache.uima.jcas.JCas jcas,
org.apache.uima.cas.Type type)
public void index(org.apache.uima.jcas.JCas jCas,
int type)
#indexTermGenerator is
used to create terms with which the annotation will be associated in the
index and can be retrieved by a search method.index in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>jCas - A CAS instance.type - The annotation type to index.public void index(org.apache.uima.jcas.JCas jCas,
org.apache.uima.cas.Type type)
#indexTermGenerator is
used to create terms with which the annotation will be associated in the
index and can be retrieved by a search method.index in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>jCas - A CAS instance.type - The annotation type to index.public void index(E annotation)
index in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>public void freeze()
public <T extends org.apache.uima.jcas.tcas.Annotation> java.util.stream.Stream<E> search(T a)
a - The annotation to retrieve overlapping annotations from the
index for.public void melt()
public void add(E a)
add in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>Copyright © 2018 JULIE Lab Jena, Germany. All rights reserved.