SoftadminUtil.String_Chunk
Type:
Table-valued function
Divides the supplied string into several chunks of similar size with a given overlap between them. Each chunk is returned on a separate row in the resultset.
If the supplied value is NULL then no rows are returned.
Example
SoftadminUtil.String_Chunk('Once upon a midnight dreary, while I pondered, weak and weary,', 'The Raven', 20, 5)
| ChunkIndex |
ChunkText |
| 0 |
The Raven Once upon a midnight |
| 1 |
The Raven night dreary, while |
| 2 |
The Raven hile I pondered, wea |
| 3 |
The Raven , weak and weary, |
Parameters
@Text
mandatory
nvarchar(max)
The text to chunk.
@ChunkPrefix
optional
nvarchar(max)
If specified, chunks will be prefixed with this value and a line break. Usually this will help LLMs to understand context and the embedding models to generate better embeddings.
Prefer descriptive and specific titles/sections over generic titles. For example: "Title: API Authentication, Section: Token Lifecycle" is better than "Introduction".
@ChunkSize
mandatory
int
Number of characters in each chunk.
@Overlap
mandatory
int
How many characters from the previous chunk to include in this chunk.