chunking

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	DocID      string
	ChunkIndex int
	Heading    string
	Content    string
}

type Chunker

type Chunker struct {
	SplitOn        []string
	MaxChunkTokens int
	OverlapTokens  int
	Counter        TokenCounter
}

func New

func New(splitOn []string, maxChunkTokens, overlapTokens int, counter TokenCounter) *Chunker

func (*Chunker) Chunk

func (c *Chunker) Chunk(docID string, content string) ([]Chunk, error)

type TokenCounter

type TokenCounter interface {
	CountTokens(text string) int
}

Jump to

Keyboard shortcuts

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