Package de.julielab.jcore.utility.index
Interface IndexTermGenerator<K extends Comparable<K>>
-
- Type Parameters:
K- The type of index terms that should be created for an annotation, for example a String or an Integer. This type is also used by the index map for the keys, where the generated index terms will go to.
- All Known Implementing Classes:
TermGenerators.LongOffsetIndexTermGenerator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface IndexTermGenerator<K extends Comparable<K>>
An interface that defines a way to construct index or search terms from an annotation a. Implementations are given to the constructor of
JCoReMapAnnotationIndexand are then internally used to create index terms from annotations.The class
TermGeneratorsoffers a range of predefined term generators.- Author:
- faessler
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default KasKey(org.apache.uima.jcas.tcas.Annotation a)Use this method when you know that this term generator returns single key values.default Stream<K>asStream(org.apache.uima.jcas.tcas.Annotation a)Use this method when you know that this term generator returns a stream.ObjectgenerateIndexTerms(org.apache.uima.jcas.tcas.Annotation a)Generates a single index term or a stream of index terms for the annotation a.
-
-
-
Method Detail
-
generateIndexTerms
Object generateIndexTerms(org.apache.uima.jcas.tcas.Annotation a)
Generates a single index term or a stream of index terms for the annotation a. If it is known in advance if single terms or a stream is returned, the methodsasKey(Annotation)orasStream(Annotation)might be used instead.- Parameters:
a- The annotation to generate terms for.- Returns:
- The generated terms. Might be a single term of type K or a stream of terms.
-
asStream
default Stream<K> asStream(org.apache.uima.jcas.tcas.Annotation a)
Use this method when you know that this term generator returns a stream.- Returns:
- The search terms as a stream.
-
asKey
default K asKey(org.apache.uima.jcas.tcas.Annotation a)
Use this method when you know that this term generator returns single key values.- Returns:
- The search term.
-
-