Rag.Chunker.Sentence (rag v0.3.4)

View Source

Sentence-boundary chunking.

Splits text at sentence endings (.!?) and combines sentences to reach target size while respecting max_chars limit.

Options

  • max_chars - Maximum characters per chunk (default: 500)
  • min_chars - Minimum characters per chunk, combines small sentences (default: nil)

Summary

Functions

Split text into sentence-based chunks.

Returns default options for the sentence chunker.

Types

t()

@type t() :: %Rag.Chunker.Sentence{
  max_chars: pos_integer(),
  min_chars: pos_integer() | nil
}

Functions

chunk(chunker, text, opts)

@spec chunk(t(), String.t(), keyword()) :: [Rag.Chunker.Chunk.t()]

Split text into sentence-based chunks.

default_opts()

@spec default_opts() :: keyword()

Returns default options for the sentence chunker.