Chunker class
Divides text streams into manageable chunks for processing.
The Chunker class is responsible for breaking down large text streams into smaller, consistently sized chunks that can be processed by language models or embedding systems. It ensures chunks are properly sized for model context windows and can create overlapping chunks to preserve context across chunk boundaries.
Constructors
- Chunker.new({int chunkSize = 300})
-
Creates a new Chunker with the specified chunk size.
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform(
Stream< String> rawFeed) → Stream<Chunk> - Transforms a text stream into non-overlapping chunks of approximately equal size.
-
transformWithOverlap(
Stream< String> rawFeed, {int overlap = 50}) → Stream<Chunk> - Transforms a text stream into chunks with overlap between consecutive chunks.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited