AS AgentScopeAPI 手册 / API Reference

TextChunker

public final class TextChunker
源码Source io/agentscope/core/rag/reader/TextChunker.java:28–195

文本切分器,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.reader 包。核心成员包括 chunkText。

Utility class for chunking text into smaller pieces.

This class provides methods to split text according to different strategies, with support for overlap between chunks to preserve context.

方法摘要Method Summary

方法Method说明Description
public static List<String> chunkText(String text, int chunkSize, SplitStrategy strategy, int overlapSize)
static
执行分块文本相关操作。
Chunks text according to the specified strategy.

方法详情Method Detail

chunkText

public static List<String> chunkText(String text, int chunkSize, SplitStrategy strategy, int overlapSize)
static

执行分块文本相关操作。

Chunks text according to the specified strategy.

参数Parameters
名称Name类型Type说明Description
textString文本到分块。the text to chunk
chunkSizeint分块大小(类型 `int`)。the target size for each chunk (interpreted based on strategy)
strategySplitStrategystrategy(类型 `SplitStrategy`)。the splitting strategy
overlapSizeintoverlap 大小(类型 `int`)。the number of characters/tokens to overlap between chunks
返回Returns List<String>
返回列出。a list of text chunks
源码Source io/agentscope/core/rag/reader/TextChunker.java:46–71
基于官方固定版本源码静态生成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.