Package org.apache.tika.inference
Class Chunk
java.lang.Object
org.apache.tika.inference.Chunk
A content chunk with multimodal locators and an optional embedding vector.
The text field holds the textual content of the chunk (may be
null for non-text chunks such as image regions or audio segments).
The Locators object identifies where this chunk comes from in
the original content across multiple modalities (text offsets, page/bbox,
spatial regions, temporal ranges).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe id of the unit this chunk was cut from, assigned by the chunker that defined it, so chunks of one unit written by different bindings (a segment's sound and picture, a region's text and crop) can be grouped; null for a chunk that is its own unit.intConvenience: returns the end offset from the firstTextLocator, or -1 if none.What the engine was shown for this vector; null when the writer did not say.The inference binding that wrote this chunk; null for chunks from other sources.intConvenience: returns the start offset from the firstTextLocator, or -1 if none.getText()float[]voidsetCorrelator(String correlator) voidsetModality(Modality modality) voidsetProducer(String producer) voidsetVector(float[] vector)
-
Constructor Details
-
Chunk
-
Chunk
Convenience constructor for text-only chunks with character offsets.
-
-
Method Details
-
getText
-
getLocators
-
getStartOffset
public int getStartOffset()Convenience: returns the start offset from the firstTextLocator, or -1 if none. -
getEndOffset
public int getEndOffset()Convenience: returns the end offset from the firstTextLocator, or -1 if none. -
getProducer
The inference binding that wrote this chunk; null for chunks from other sources. -
setProducer
-
getModality
What the engine was shown for this vector; null when the writer did not say. -
setModality
-
getCorrelator
The id of the unit this chunk was cut from, assigned by the chunker that defined it, so chunks of one unit written by different bindings (a segment's sound and picture, a region's text and crop) can be grouped; null for a chunk that is its own unit. -
setCorrelator
-
getVector
public float[] getVector() -
setVector
public void setVector(float[] vector)
-