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

Method chunk

apps/sim/lib/chunkers/text-chunker.ts:93–107  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

91 }
92
93 async chunk(text: string): Promise<Chunk[]> {
94 if (!text?.trim()) {
95 return []
96 }
97
98 const cleaned = cleanText(text)
99 let chunks = this.splitRecursively(cleaned)
100
101 if (this.chunkOverlap > 0) {
102 const overlapChars = tokensToChars(this.chunkOverlap)
103 chunks = addOverlap(chunks, overlapChars)
104 }
105
106 return buildChunks(chunks, this.chunkOverlap)
107 }
108}

Callers 9

applyStrategyFunction · 0.95
processDocumentFunction · 0.95
splitContentMethod · 0.45

Calls 5

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

Tested by

no test coverage detected