Class Chunk
java.lang.Object
ai.docling.serve.api.chunk.response.Chunk
Represents a chunk of a document after it has been processed by a Docling chunker.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull Chunk.Builderbuilder()List of captions for this chunk (e.g.intIndex of this chunk within the document.List of doc items references.Filename of the source document.List of headings for this chunk.Additional metadata associated with this chunk.Number of tokens in the text, if the chunker is aware of tokens.Page numbers where this chunk content appears.@Nullable StringRaw chunk text without additional formatting or context.getText()The chunk text with structural context (headers, formatting).@NonNull Chunk.Builder@NonNull StringtoString()
-
Method Details
-
builder
-
toBuilder
-
getFilename
Filename of the source document.- Returns:
- the filename of the source document
-
getChunkIndex
public int getChunkIndex()Index of this chunk within the document.- Returns:
- the zero-based chunk index
-
getText
The chunk text with structural context (headers, formatting).- Returns:
- the formatted chunk text
-
getRawText
Raw chunk text without additional formatting or context.- Returns:
- the raw chunk text, or null if not included
-
getNumTokens
Number of tokens in the text, if the chunker is aware of tokens.- Returns:
- the number of tokens, or null if not calculated
-
getHeadings
List of headings for this chunk.- Returns:
- the list of headings
-
getCaptions
List of captions for this chunk (e.g. for pictures and tables).- Returns:
- the list of captions
-
getDocItems
List of doc items references.- Returns:
- the list of document item references
-
getPageNumbers
Page numbers where this chunk content appears.- Returns:
- the list of page numbers
-
getMetadata
Additional metadata associated with this chunk.- Returns:
- the metadata map
-
toString
-