Package sk.iway.iwcm.rag.indexing
Class MarkdownChunker
java.lang.Object
sk.iway.iwcm.rag.indexing.MarkdownChunker
Splits Markdown at block boundaries, preserving fitting structures and their heading context.
-
Constructor Summary
ConstructorsConstructorDescriptionMarkdownChunker(MarkdownContentExtractor extractor, SlidingWindowChunker fallback) -
Method Summary
Modifier and TypeMethodDescriptionchunkWithOffsets(String text) Splits cleaned Markdown using the configured size and overlap.chunkWithOffsets(String text, int chunkSize, int overlap) Groups fitting subsections and adjacent short level-two sections, preserving their structures.
-
Constructor Details
-
MarkdownChunker
-
-
Method Details
-
chunkWithOffsets
Splits cleaned Markdown using the configured size and overlap.- Parameters:
text- cleaned Markdown- Returns:
- chunks with source offsets compatible with heading-context extraction
-
chunkWithOffsets
Groups fitting subsections and adjacent short level-two sections, preserving their structures. Level-one headings remain boundaries; overlap resets between unmerged sections. Blocks larger than the 50% size allowance use the ordinary bounded text splitter.- Parameters:
text- cleaned Markdown; code indentation is preservedchunkSize- target body size; nonpositive values disable splittingoverlap- target overlap within a section; one whole trailing block may exceed it- Returns:
- passages with offsets in the normalized, trimmed source, excluding heading prefixes
-