Returns both chunks and cleaned content so header extraction uses aligned positions.
(
content: string
)
| 191 | |
| 192 | /** Returns both chunks and cleaned content so header extraction uses aligned positions. */ |
| 193 | private async splitContent( |
| 194 | content: string |
| 195 | ): Promise<{ chunks: string[]; cleanedContent: string }> { |
| 196 | const cleanedContent = this.cleanContent(content) |
| 197 | |
| 198 | const tableBoundaries = this.detectTableBoundaries(cleanedContent) |
| 199 | |
| 200 | const chunks = await this.textChunker.chunk(cleanedContent) |
| 201 | |
| 202 | const processedChunks = this.mergeTableChunks( |
| 203 | chunks.map((chunk) => chunk.text), |
| 204 | tableBoundaries, |
| 205 | cleanedContent |
| 206 | ) |
| 207 | |
| 208 | const finalChunks = this.enforceSizeLimit(processedChunks) |
| 209 | |
| 210 | return { chunks: finalChunks, cleanedContent } |
| 211 | } |
| 212 | |
| 213 | private cleanContent(content: string): string { |
| 214 | return content |
no test coverage detected