Chunker class abstract
Splits a source text into Chunks.
Implement this to plug a custom splitting strategy into Retriever, or use one of the built-in strategies: Chunker.fixed, Chunker.paragraphs, or Chunker.sentences.
Constructors
- Chunker()
-
Allows subclasses to have const constructors.
const
- Chunker.fixed({int maxChars = 1000, int overlap = 200})
-
A character-window chunker that snaps cut points to word boundaries.
factory
- Chunker.paragraphs({int maxChars = 2000})
-
A chunker that splits on blank lines.
factory
- Chunker.sentences({int maxChars = 1000, int overlap = 1})
-
A chunker that packs whole sentences into chunks of at most
maxCharscharacters.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
chunk(
String text) → List< Chunk> -
Splits
textinto chunks. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited