AS AgentScopeAPI 手册 / API Reference

WordReader

public class WordReader extends AbstractChunkingReader
源码Source io/agentscope/core/rag/reader/WordReader.java:68–552

Word 读取器,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.reader 包,继承自 AbstractChunkingReader。核心成员包括 read、getSupportedFormats、isIncludeImage、isSeparateTable、getTableFormat、WordReader。

Word document reader that extracts text, tables, and images from Word files.

This reader supports comprehensive extraction of content from Word documents (.docx), including:

  • Text extraction from paragraphs

  • Table extraction with Markdown or JSON formatting

  • Image extraction with Base64 encoding

  • Configurable chunking strategies

Dependencies: Requires Apache POI (poi-ooxml) to be available on the classpath.

Example usage:

`WordReader reader = new WordReader(512, SplitStrategy.PARAGRAPH, 50,
true, false, TableFormat.MARKDOWN);
ReaderInput input = ReaderInput.fromString("path/to/document.docx");
List<Document> documents = reader.read(input).block();
`

构造器摘要Constructor Summary

构造器Constructor说明Description
public WordReader(int chunkSize, SplitStrategy splitStrategy, int overlapSize, boolean includeImage, boolean separateTable, TableFormat tableFormat)
初始化 `WordReader` 实例。
Creates a new WordReader with full configuration.
public WordReader()
创建新的WordReader 使用默认设置。
Creates a new WordReader with default settings.

方法摘要Method Summary

方法Method说明Description
public Mono<List<Document>> read(ReaderInput input)
设置读取。
Performs the read operation.
public List<String> getSupportedFormats()
获取 `getSupportedFormats`。
Returns the supported formats.
public boolean isIncludeImage()
判断是否 `isIncludeImage`。
Checks if image extraction is enabled.
public boolean isSeparateTable()
判断是否 `isSeparateTable`。
Checks if tables are separated into individual chunks.
public TableFormat getTableFormat()
获取 `getTableFormat`。
Gets the table format.

构造器详情Constructor Detail

WordReader

public WordReader(int chunkSize, SplitStrategy splitStrategy, int overlapSize, boolean includeImage, boolean separateTable, TableFormat tableFormat)

初始化 WordReader 实例。

Creates a new WordReader with full configuration.

参数Parameters
名称Name类型Type说明Description
chunkSizeint目标大小用于每个分块。the target size for each chunk
splitStrategySplitStrategy已拆分 Strategy(类型 `SplitStrategy`)。the strategy for splitting text
overlapSizeintoverlap 大小(类型 `int`)。the number of characters to overlap between chunks
includeImagebooleaninclude 图像(类型 `boolean`)。whether to extract and include images from the document
separateTablebooleanseparate Table(类型 `boolean`)。whether to treat tables as separate chunks
tableFormatTableFormattable 格式(类型 `TableFormat`)。the format for extracted tables (MARKDOWN or JSON)
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if parameters are invalid
源码Source io/agentscope/core/rag/reader/WordReader.java:85–99

WordReader

public WordReader()

创建新的WordReader 使用默认设置。

Creates a new WordReader with default settings.

源码Source io/agentscope/core/rag/reader/WordReader.java:114–116

方法详情Method Detail

read

public Mono<List<Document>> read(ReaderInput input)

设置读取。

Performs the read operation.

参数Parameters
名称Name类型Type说明Description
inputReaderInput输入消息(类型 `ReaderInput`)。The input.
返回Returns Mono<List<Document>>
返回Mono>。Returns mono.
源码Source io/agentscope/core/rag/reader/WordReader.java:118–185

getSupportedFormats

public List<String> getSupportedFormats()

获取 getSupportedFormats。

Returns the supported formats.

返回Returns List<String>
返回列出。Returns list.
源码Source io/agentscope/core/rag/reader/WordReader.java:187–190

isIncludeImage

public boolean isIncludeImage()

判断是否 isIncludeImage。

Checks if image extraction is enabled.

返回Returns boolean
返回布尔值,表示判断结果。true if images are extracted
源码Source io/agentscope/core/rag/reader/WordReader.java:531–533

isSeparateTable

public boolean isSeparateTable()

判断是否 isSeparateTable。

Checks if tables are separated into individual chunks.

返回Returns boolean
返回布尔值,表示判断结果。true if tables are separated
源码Source io/agentscope/core/rag/reader/WordReader.java:540–542

getTableFormat

public TableFormat getTableFormat()

获取 getTableFormat。

Gets the table format.

返回Returns TableFormat
返回TableFormat。the table format (MARKDOWN or JSON)
源码Source io/agentscope/core/rag/reader/WordReader.java:549–551

继承成员Inherited Members

基于官方固定版本源码静态生成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.