langchain_community.document_loaders.odt.UnstructuredODTLoader

class langchain_community.document_loaders.odt.UnstructuredODTLoader(file_path: Union[str, Path], mode: str = 'single', **unstructured_kwargs: Any)[source]

使用`Unstructured`加载`OpenOffice ODT`文件。

您可以在两种模式中的一种中运行加载程序:”single”和”elements”。 如果使用”single”模式,则文档将作为单个`langchain Document`对象返回。 如果使用”elements”模式,则`unstructured`库将文档拆分为诸如Title和NarrativeText之类的元素。 您可以在模式之后传递额外的`unstructured kwargs`以应用不同的`unstructured settings`。

```python from langchain_community.document_loaders import UnstructuredODTLoader

loader = UnstructuredODTLoader(

“example.odt”, mode=”elements”, strategy=”fast”,

) docs = loader.load() ```

https://unstructured-io.github.io/unstructured/bricks.html#partition-odt

参数: file_path:要加载的文件路径。 mode:加载文件时要使用的模式。可以是”single”、”multi”或”all”之一。默认为”single”。 **unstructured_kwargs:要传递给非结构化函数的任何kwargs。

Methods

__init__(file_path[, mode])

参数: file_path:要加载的文件路径。 mode:加载文件时要使用的模式。可以是"single"、"multi"或"all"之一。默认为"single"。 **unstructured_kwargs:要传递给非结构化函数的任何kwargs。

alazy_load()

一个用于文档的惰性加载器。

aload()

将数据加载到文档对象中。

lazy_load()

加载文件。

load()

将数据加载到文档对象中。

load_and_split([text_splitter])

加载文档并分割成块。块作为文档返回。

Parameters
  • file_path (Union[str, Path]) –

  • mode (str) –

  • unstructured_kwargs (Any) –

__init__(file_path: Union[str, Path], mode: str = 'single', **unstructured_kwargs: Any)[source]

参数: file_path:要加载的文件路径。 mode:加载文件时要使用的模式。可以是”single”、”multi”或”all”之一。默认为”single”。 **unstructured_kwargs:要传递给非结构化函数的任何kwargs。

Parameters
  • file_path (Union[str, Path]) –

  • mode (str) –

  • unstructured_kwargs (Any) –

async alazy_load() AsyncIterator[Document]

一个用于文档的惰性加载器。

Return type

AsyncIterator[Document]

async aload() List[Document]

将数据加载到文档对象中。

Return type

List[Document]

lazy_load() Iterator[Document]

加载文件。

Return type

Iterator[Document]

load() List[Document]

将数据加载到文档对象中。

Return type

List[Document]

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]

加载文档并分割成块。块作为文档返回。

不要覆盖此方法。应该被视为已弃用!

参数:
text_splitter: 用于分割文档的TextSplitter实例。

默认为RecursiveCharacterTextSplitter。

返回:

文档列表。

Parameters

text_splitter (Optional[TextSplitter]) –

Return type

List[Document]

Examples using UnstructuredODTLoader