langchain_community.document_loaders.csv_loader
.UnstructuredCSVLoader¶
- class langchain_community.document_loaders.csv_loader.UnstructuredCSVLoader(file_path: str, mode: str = 'single', **unstructured_kwargs: Any)[source]¶
使用`Unstructured`加载`CSV`文件。
像其他Unstructured加载器一样,UnstructuredCSVLoader可以在“single”和“elements”模式下使用。如果您在“elements”模式下使用加载器,则CSV文件将成为单个Unstructured表元素。如果您在“elements”模式下使用加载器,则表的HTML表示将在文档元数据中的“text_as_html”键中可用。
from langchain_community.document_loaders.csv_loader import UnstructuredCSVLoader
loader = UnstructuredCSVLoader(“stanley-cups.csv”, mode=”elements”) docs = loader.load()
参数: file_path: CSV文件的路径。 mode: 加载CSV文件时要使用的模式。
可选。默认为”single”。
**unstructured_kwargs: 要传递给unstructured的关键字参数。
Methods
__init__
(file_path[, mode])参数: file_path: CSV文件的路径。 mode: 加载CSV文件时要使用的模式。 可选。默认为"single"。 **unstructured_kwargs: 要传递给unstructured的关键字参数。
一个用于文档的惰性加载器。
aload
()将数据加载到文档对象中。
加载文件。
load
()将数据加载到文档对象中。
load_and_split
([text_splitter])加载文档并分割成块。块作为文档返回。
- Parameters
file_path (str) –
mode (str) –
unstructured_kwargs (Any) –
- __init__(file_path: str, mode: str = 'single', **unstructured_kwargs: Any)[source]¶
参数: file_path: CSV文件的路径。 mode: 加载CSV文件时要使用的模式。
可选。默认为”single”。
**unstructured_kwargs: 要传递给unstructured的关键字参数。
- Parameters
file_path (str) –
mode (str) –
unstructured_kwargs (Any) –
- load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document] ¶
加载文档并分割成块。块作为文档返回。
不要覆盖此方法。应该被视为已弃用!
- 参数:
- text_splitter: 用于分割文档的TextSplitter实例。
默认为RecursiveCharacterTextSplitter。
- 返回:
文档列表。
- Parameters
text_splitter (Optional[TextSplitter]) –
- Return type
List[Document]