AS AgentScopeAPI 手册 / API Reference

AbstractChunkingReader

public abstract class AbstractChunkingReader implements Reader
源码Source 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
chunkSize
final
int
分块大小字段。
The chunk size field.
splitStrategy
final
SplitStrategy
`splitStrategy` 字段。
The split strategy field.
overlapSize
final
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
final

分块大小字段。声明为 protected final int chunkSize。

The chunk size field.

源码Source io/agentscope/core/rag/reader/AbstractChunkingReader.java:30

splitStrategy

protected final SplitStrategy splitStrategy
final

splitStrategy 字段。声明为 protected final SplitStrategy splitStrategy。

The split strategy field.

源码Source io/agentscope/core/rag/reader/AbstractChunkingReader.java:31

overlapSize

protected final int overlapSize
final

overlapSize 字段。声明为 protected final int overlapSize。

The overlap size field.

源码Source 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.

参数Parameters
名称Name类型Type说明Description
chunkSizeint分块大小(类型 `int`)。the target size for each chunk (interpreted based on strategy)
splitStrategySplitStrategy已拆分 Strategy(类型 `SplitStrategy`)。the strategy for splitting text
overlapSizeintoverlap 大小(类型 `int`)。the number of characters/tokens to overlap between chunks
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if parameters are invalid
源码Source io/agentscope/core/rag/reader/AbstractChunkingReader.java:42–47

方法详情Method Detail

validateChunkingParameters

protected static void validateChunkingParameters(int chunkSize, SplitStrategy splitStrategy, int overlapSize)
static

校验 validateChunkingParameters。

Validates chunking parameters.

参数Parameters
名称Name类型Type说明Description
chunkSizeint分块大小到校验。the chunk size to validate
splitStrategySplitStrategy已拆分 Strategy(类型 `SplitStrategy`)。the split strategy to validate
overlapSizeintoverlap 大小(类型 `int`)。the overlap size to validate
抛出Throws
  • IllegalArgumentException 当if 任意参数是无效时抛出 `IllegalArgumentException`。if any parameter is invalid
源码Source io/agentscope/core/rag/reader/AbstractChunkingReader.java:57–71

getChunkSize

public int getChunkSize()

获取分块大小。

Gets the chunk size.

返回Returns int
分块大小。the chunk size
源码Source io/agentscope/core/rag/reader/AbstractChunkingReader.java:78–80

getSplitStrategy

public SplitStrategy getSplitStrategy()

获取 getSplitStrategy。

Gets the split strategy.

返回Returns SplitStrategy
返回SplitStrategy。the split strategy
源码Source io/agentscope/core/rag/reader/AbstractChunkingReader.java:87–89

getOverlapSize

public int getOverlapSize()

获取 getOverlapSize。

Gets the overlap size.

返回Returns int
返回数值结果。the overlap size
源码Source io/agentscope/core/rag/reader/AbstractChunkingReader.java:96–98

继承成员Inherited Members

继承自Methods inherited from Reader
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.