PPTX Loader
PPTX Loader¶
PowerPointLoader ¶
Bases: UnstructuredLoader
从PPT文档中读取数据
Attributes:
| Name | Type | Description |
|---|---|---|
mime_types |
set[Literal[PPT, PPTX]]
|
支持的mime类型 默认值为 {PPT, PPTX} |
extract_images |
bool
|
是否提取图片(默认: False) |
extract_image_block_output_dir |
Optional[str]
|
图片输出目录(默认: None,表示使用 base64 模式) |
load ¶
load(
path_or_uri: str,
*,
file: bytes | IO[bytes] | None = None,
content_type: Optional[str] = None,
extract_images: Optional[bool] = None,
**kwargs: Any
) -> Document
从给定的 URI 或文件对象加载文档并返回 Document 对象 / Load document from the given URI or file object and return Document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_or_uri
|
str
|
文档的路径或 URI (必填)/ File path or uri (required) |
required |
file
|
bytes | IO[bytes] | None
|
文件内容,可以是 bytes 或 IO[bytes] 对象(与 path_or_uri 参数二选一)/ File content as bytes or IO[bytes] (mutually exclusive with path_or_uri). |
None
|
content_type
|
Optional[str]
|
文档的内容类型(MIME 类型),如果不提供则尝试自动检测 / The content type (MIME type), auto-detected if not provided. |
None
|
extract_images
|
Optional[bool]
|
是否提取文档中的图片(覆盖类属性配置)/ Whether to extract images from the document (overrides class attribute). Default is None (use class attribute). |
None
|
**kwargs
|
Any
|
其他可选参数,传递给底层的分片函数 / Additional keyword arguments passed to the partition function. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Document |
Document
|
返回一个包含文档内容的 Document 对象 / The loaded document. |
Raises:
| Type | Description |
|---|---|
ValueError
|
如果 path_or_uri 和 file 都未提供,或都提供了 / If neither or both path_or_uri and file are provided. |
Source code in tfrobot/utils/document_loaders/pptx.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |