chunk

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package chunk turns a ParsedDoc into deterministic, line-anchored chunks. Section boundaries (heading, declaration, paragraph) are decided upstream by the parser; this package only windows each section to a token budget (target/overlap) so chunk sizing stays config-driven.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(doc model.ParsedDoc, cfg Config) []model.Chunk

Dispatch turns doc into ordered chunks, windowing each section to cfg's token budget. StructureOnly documents (e.g. OKF index.md) yield no chunks. Deterministic: the same ParsedDoc always yields identical chunks, which keeps re-ingest idempotent and golden tests stable.

Types

type Config

type Config struct {
	TargetTokens  int
	OverlapTokens int
}

Config carries the token budget that bounds chunk sizing. Sections estimated above TargetTokens are split into windows of roughly TargetTokens with OverlapTokens of carry-over; smaller sections stay whole.

func ConfigFrom

func ConfigFrom(targetTokens, overlapTokens int) Config

ConfigFrom builds a Config from target and overlap token counts. It is the single place configuration values become a chunk.Config, so callers (ingest, capture, move, eval) stop re-assembling the struct field by field and the chunk package owns the constructor for its own type.

Jump to

Keyboard shortcuts

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