split

package
v1.795.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 4 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractMarkdownTree

func ExtractMarkdownTree(markdownText string) map[string]string

func ExtractTablesAndRemainder

func ExtractTablesAndRemainder(markdownText string) (string, []string, error)

func ExtractTablesWithContext

func ExtractTablesWithContext(markdownText string, contextKey string) (string, []string, error)

Types

type BasicSplitProvider

type BasicSplitProvider struct{}

func NewBasicSplitProvider

func NewBasicSplitProvider() (*BasicSplitProvider, error)

func (*BasicSplitProvider) SplitText

func (p *BasicSplitProvider) SplitText(text string) ([]string, error)

type DefaultSplitProvider

type DefaultSplitProvider struct {
	TextType string
}

func NewDefaultSplitProvider

func NewDefaultSplitProvider(textType string) (*DefaultSplitProvider, error)

func (*DefaultSplitProvider) SplitText

func (p *DefaultSplitProvider) SplitText(text string) ([]string, error)

type MarkdownSplitProvider

type MarkdownSplitProvider struct{}

func NewMarkdownSplitProvider

func NewMarkdownSplitProvider() (*MarkdownSplitProvider, error)

func (*MarkdownSplitProvider) SplitText

func (p *MarkdownSplitProvider) SplitText(text string) ([]string, error)

type QaSplitProvider

type QaSplitProvider struct{}

QaSplitProvider structure

func NewQaSplitProvider

func NewQaSplitProvider() (*QaSplitProvider, error)

NewQaSplitProvider creates a new instance of QaSplitProvider

func (*QaSplitProvider) SplitText

func (p *QaSplitProvider) SplitText(text string) ([]string, error)

SplitText method splits the text into question-answer pairs

type RecursiveSplitProvider added in v1.790.2

type RecursiveSplitProvider struct {
	ChunkSize    int
	ChunkOverlap int
	Separators   []string
}

RecursiveSplitProvider is a character-based recursive text splitter with the same contract as LangChain's RecursiveCharacterTextSplitter: it splits on a cascade of separators (paragraph → line → word → char), keeping each chunk at or below ChunkSize characters and overlapping consecutive chunks by ChunkOverlap characters.

It exists so the Hanzo RAG surface (/v1/rag/*, controllers/rag.go → object.Rag*) chunks documents identically to the retired standalone rag-api (danny-avila fork), which configured RecursiveCharacterTextSplitter with CHUNK_SIZE=1500 / CHUNK_OVERLAP=100. Chunking is a splitting concern, so it lives here in the ONE splitting home rather than being reinvented in the RAG module — GetSplitProvider("Recursive") returns it.

func NewRecursiveSplitProvider added in v1.790.2

func NewRecursiveSplitProvider(chunkSize, chunkOverlap int) (*RecursiveSplitProvider, error)

NewRecursiveSplitProvider builds a recursive splitter. Non-positive chunkSize falls back to 1500 and a negative overlap to 100 — the retired rag-api defaults — so a zero-value construction is still the parity configuration. Overlap is clamped strictly below chunkSize (an overlap ≥ size cannot make progress and would loop).

func (*RecursiveSplitProvider) SplitText added in v1.790.2

func (p *RecursiveSplitProvider) SplitText(text string) ([]string, error)

type SplitProvider

type SplitProvider interface {
	SplitText(text string) ([]string, error)
}

func GetSplitProvider

func GetSplitProvider(typ string) (SplitProvider, error)

Jump to

Keyboard shortcuts

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