AbstractChunkingReader
public abstract class AbstractChunkingReader implements Reader
io/agentscope/core/rag/reader/AbstractChunkingReader.java:28–99抽象 Chunking 读取器,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.reader 包,实现 Reader。核心成员包括 validateChunkingParameters、getChunkSize、getSplitStrategy、getOverlapSize、AbstractChunkingReader、chunkSize。
Abstract base class for readers that support text chunking.
This class provides common functionality for document readers that split content into chunks based on a chunking strategy. It handles parameter validation and provides shared access to chunk size, split strategy, and overlap size settings.
Subclasses should implement the Reader interface to provide specific
reading logic for different file formats.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
chunkSizefinal | int | 分块大小字段。 The chunk size field. |
splitStrategyfinal | SplitStrategy | `splitStrategy` 字段。 The split strategy field. |
overlapSizefinal | int | `overlapSize` 字段。 The overlap size field. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
protected AbstractChunkingReader(int chunkSize, SplitStrategy splitStrategy, int overlapSize) | 初始化 `AbstractChunkingReader` 实例。 Creates a new AbstractChunkingReader with the specified configuration. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
protected static void validateChunkingParameters(int chunkSize, SplitStrategy splitStrategy, int overlapSize)static | 校验 `validateChunkingParameters`。 Validates chunking parameters. |
public int getChunkSize() | 获取分块大小。 Gets the chunk size. |
public SplitStrategy getSplitStrategy() | 获取 `getSplitStrategy`。 Gets the split strategy. |
public int getOverlapSize() | 获取 `getOverlapSize`。 Gets the overlap size. |
字段详情Field Detail
chunkSize
protected final int chunkSize
分块大小字段。声明为 protected final int chunkSize。
The chunk size field.
io/agentscope/core/rag/reader/AbstractChunkingReader.java:30splitStrategy
protected final SplitStrategy splitStrategy
splitStrategy 字段。声明为 protected final SplitStrategy splitStrategy。
The split strategy field.
io/agentscope/core/rag/reader/AbstractChunkingReader.java:31overlapSize
protected final int overlapSize
overlapSize 字段。声明为 protected final int overlapSize。
The overlap size field.
io/agentscope/core/rag/reader/AbstractChunkingReader.java:32构造器详情Constructor Detail
AbstractChunkingReader
protected AbstractChunkingReader(int chunkSize, SplitStrategy splitStrategy, int overlapSize)
初始化 AbstractChunkingReader 实例。
Creates a new AbstractChunkingReader with the specified configuration.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
chunkSize | int | 分块大小(类型 `int`)。the target size for each chunk (interpreted based on strategy) |
splitStrategy | SplitStrategy | 已拆分 Strategy(类型 `SplitStrategy`)。the strategy for splitting text |
overlapSize | int | overlap 大小(类型 `int`)。the number of characters/tokens to overlap between chunks |
IllegalArgumentException可能抛出 `IllegalArgumentException`。if parameters are invalid
io/agentscope/core/rag/reader/AbstractChunkingReader.java:42–47方法详情Method Detail
validateChunkingParameters
protected static void validateChunkingParameters(int chunkSize, SplitStrategy splitStrategy, int overlapSize)
校验 validateChunkingParameters。
Validates chunking parameters.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
chunkSize | int | 分块大小到校验。the chunk size to validate |
splitStrategy | SplitStrategy | 已拆分 Strategy(类型 `SplitStrategy`)。the split strategy to validate |
overlapSize | int | overlap 大小(类型 `int`)。the overlap size to validate |
IllegalArgumentException当if 任意参数是无效时抛出 `IllegalArgumentException`。if any parameter is invalid
io/agentscope/core/rag/reader/AbstractChunkingReader.java:57–71getChunkSize
public int getChunkSize()
获取分块大小。
Gets the chunk size.
intio/agentscope/core/rag/reader/AbstractChunkingReader.java:78–80getSplitStrategy
public SplitStrategy getSplitStrategy()
获取 getSplitStrategy。
Gets the split strategy.
SplitStrategyio/agentscope/core/rag/reader/AbstractChunkingReader.java:87–89getOverlapSize
public int getOverlapSize()
获取 getOverlapSize。
Gets the overlap size.
intio/agentscope/core/rag/reader/AbstractChunkingReader.java:96–98