Package io.agentscope.core.rag.reader
Enum Class SplitStrategy
- All Implemented Interfaces:
Serializable,Comparable<SplitStrategy>,Constable
Strategy for splitting text into chunks.
Different strategies are suitable for different types of content:
- CHARACTER: Split by character count (simple, fast, may break words)
- PARAGRAPH: Split by paragraphs (preserves semantic units)
- TOKEN: Split by token count (approximates LLM token limits)
- SEMANTIC: Split by semantic boundaries (requires NLP, not yet implemented)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic SplitStrategyReturns the enum constant of this class with the specified name.static SplitStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CHARACTER
Split text by character count.This is the simplest strategy - it splits text into fixed-size chunks based on character count. May break words in the middle.
-
PARAGRAPH
Split text by paragraphs.This strategy splits text at paragraph boundaries (double newlines), preserving semantic units. Chunks may vary in size.
-
TOKEN
Split text by token count (approximate).This strategy attempts to split text based on approximate token count, which is useful for LLM context limits. Uses a simple heuristic: ~4 characters per token.
-
SEMANTIC
Split text by semantic boundaries.This strategy would split text at semantic boundaries (sentences, clauses, etc.) to preserve meaning. Currently not implemented and falls back to PARAGRAPH strategy.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-