MCPcopy Index your code
hub / github.com/simstudioai/sim / chunk

Method chunk

apps/sim/lib/chunkers/recursive-chunker.ts:129–144  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

127 }
128
129 async chunk(content: string): Promise<Chunk[]> {
130 if (!content?.trim()) {
131 return []
132 }
133
134 const cleaned = cleanText(content)
135 let chunks = this.splitRecursively(cleaned)
136
137 if (this.chunkOverlap > 0) {
138 const overlapChars = tokensToChars(this.chunkOverlap)
139 chunks = addOverlap(chunks, overlapChars)
140 }
141
142 logger.info(`Chunked into ${chunks.length} recursive chunks`)
143 return buildChunks(chunks, this.chunkOverlap)
144 }
145}

Callers

nothing calls this directly

Calls 6

splitRecursivelyMethod · 0.95
cleanTextFunction · 0.90
tokensToCharsFunction · 0.90
addOverlapFunction · 0.90
buildChunksFunction · 0.90
infoMethod · 0.80

Tested by

no test coverage detected