textchunk

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkByTokenCount

func ChunkByTokenCount(text string, maxTokens, overlap int, countTokens CountFunc) ([]string, error)

ChunkByTokenCount deterministically splits text into chunks that fit within maxTokens according to the supplied token counter.

Types

type CountFunc

type CountFunc func(text string) (int, error)

CountFunc returns the token count for the provided text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL