T - The annotation type the index is over.K - The key type used to index the annotations.public class JCoReTreeMapAnnotationIndex<K extends Comparable<K>,T extends org.apache.uima.jcas.tcas.Annotation> extends JCoReMapAnnotationIndex<K,T>
Use when: You want a fuzzy search on the index keys (please see the note in
the next paragraph) or ou specifically need a TreeMap instead of a
HashMap (if not, refer to JCoReHashMapAnnotationIndex) for
some other reason. This only makes sense when you need to impose a specific
ordering on the map keys that is useful for one of the searchFuzzy
methods (e.g. searchFuzzy(Annotation)). This index allows to match
multiple map keys with a single input key, for example by using a
Comparators.longOverlapComparator() for the TreeMap and
TermGenerators.longOffsetTermGenerator() for the keys.
PLEASE NOTE: In order to retrieve the correct results, the index
TreeSet comparator must be consistent with equals with regards
to the index keys (see the JavaDoc to Comparator). That means,
it does not need to be consistent with equals for the search key (in fact,
not being consistent with the search key is the trick) but results will be
undefined if the comparator is not consistent with equals with regards to the
keys in the index.
JCoReMapAnnotationIndex that uses a HashMap
index.index, indexAnnotationStorageSupplier, indexTermGenerator, searchTermGenerator| Constructor and Description |
|---|
JCoReTreeMapAnnotationIndex(Comparator<K> comparator,
IndexTermGenerator<K> indexTermGenerator,
IndexTermGenerator<K> searchTermGenerator) |
JCoReTreeMapAnnotationIndex(Comparator<K> comparator,
IndexTermGenerator<K> indexTermGenerator,
IndexTermGenerator<K> searchTermGenerator,
org.apache.uima.jcas.JCas jCas,
int type) |
JCoReTreeMapAnnotationIndex(Comparator<K> comparator,
IndexTermGenerator<K> indexTermGenerator,
IndexTermGenerator<K> searchTermGenerator,
org.apache.uima.jcas.JCas jCas,
org.apache.uima.cas.Type type) |
JCoReTreeMapAnnotationIndex(IndexTermGenerator<K> indexTermGenerator,
IndexTermGenerator<K> searchTermGenerator) |
JCoReTreeMapAnnotationIndex(IndexTermGenerator<K> indexTermGenerator,
IndexTermGenerator<K> searchTermGenerator,
org.apache.uima.jcas.JCas jCas,
int type) |
JCoReTreeMapAnnotationIndex(IndexTermGenerator<K> indexTermGenerator,
IndexTermGenerator<K> searchTermGenerator,
org.apache.uima.jcas.JCas jCas,
org.apache.uima.cas.Type type) |
| Modifier and Type | Method and Description |
|---|---|
java.util.stream.Stream<T> |
searchFuzzy(org.apache.uima.jcas.tcas.Annotation a) |
java.util.stream.Stream<T> |
searchFuzzy(K key)
Returns all annotations associated with an index key that is equal to the
given key by means of the comparator given to the
TreeMap that is used as an index.
|
java.util.stream.Stream<T> |
searchFuzzy(java.util.stream.Stream<K> searchTerms) |
public JCoReTreeMapAnnotationIndex(IndexTermGenerator<K> indexTermGenerator, IndexTermGenerator<K> searchTermGenerator)
public JCoReTreeMapAnnotationIndex(IndexTermGenerator<K> indexTermGenerator, IndexTermGenerator<K> searchTermGenerator, org.apache.uima.jcas.JCas jCas, org.apache.uima.cas.Type type)
public JCoReTreeMapAnnotationIndex(IndexTermGenerator<K> indexTermGenerator, IndexTermGenerator<K> searchTermGenerator, org.apache.uima.jcas.JCas jCas, int type)
public JCoReTreeMapAnnotationIndex(Comparator<K> comparator, IndexTermGenerator<K> indexTermGenerator, IndexTermGenerator<K> searchTermGenerator)
public JCoReTreeMapAnnotationIndex(Comparator<K> comparator, IndexTermGenerator<K> indexTermGenerator, IndexTermGenerator<K> searchTermGenerator, org.apache.uima.jcas.JCas jCas, org.apache.uima.cas.Type type)
public JCoReTreeMapAnnotationIndex(Comparator<K> comparator, IndexTermGenerator<K> indexTermGenerator, IndexTermGenerator<K> searchTermGenerator, org.apache.uima.jcas.JCas jCas, int type)
public java.util.stream.Stream<T> searchFuzzy(org.apache.uima.jcas.tcas.Annotation a)
public java.util.stream.Stream<T> searchFuzzy(java.util.stream.Stream<K> searchTerms)
public java.util.stream.Stream<T> searchFuzzy(K key)
Returns all annotations associated with an index key that is equal to the given key by means of the comparator given to the TreeMap that is used as an index.
If that comparator is consistent with equals (see the JavaDoc to
Comparator) the index will basically return the same results how
a HashMap would. However, if the comparator is in general not
consistent with equals, but it is for all elements in the index, and the
index keys for which holds
index.comparator().compare(indexkey, key) == 0 are
located in the index without a gap between them (i.e. no indexkey that
would not return 0 on comparison with key), then this method
will return all annotations for the matching keys. This can be used to
retrieve overlapping annotations, for example.
key - The key to retrieve annotations for.index.comparator().compare(indexkey, key) ==
0.Copyright © 2018 JULIE Lab Jena, Germany. All rights reserved.