chunking

package
v0.0.0-...-235531b Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ASTChunker

func ASTChunker(code []byte, lang *sitter.Language) []string

ASTChunker splits source code into function/method/class-level chunks using tree-sitter AST parsing. It preserves scope integrity by never splitting inside a function body.

func SemanticChunker

func SemanticChunker(text string, embedder func(string) ([]float32, error), threshold float32) ([]string, error)

SemanticChunker splits text into semantically coherent chunks using cosine similarity valley detection between adjacent sentence embeddings.

Uses neurosnap/sentences (English tokenizer with built-in training data) for production-grade sentence boundary detection that correctly handles abbreviations (Dr., Mr., U.S.), decimal numbers (3.14), URLs, and Unicode.

Types

This section is empty.

Jump to

Keyboard shortcuts

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