(options: RecursiveChunkerOptions = {})
| 58 | private readonly separators: string[] |
| 59 | |
| 60 | constructor(options: RecursiveChunkerOptions = {}) { |
| 61 | const resolved = resolveChunkerOptions(options) |
| 62 | this.chunkSize = resolved.chunkSize |
| 63 | this.chunkOverlap = resolved.chunkOverlap |
| 64 | |
| 65 | if (options.separators && options.separators.length > 0) { |
| 66 | this.separators = options.separators |
| 67 | } else { |
| 68 | const recipe = options.recipe ?? 'plain' |
| 69 | this.separators = [...RECIPES[recipe]] |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | private splitRecursively(text: string, separatorIndex = 0): string[] { |
| 74 | const tokenCount = estimateTokens(text) |
nothing calls this directly
no test coverage detected