Files
langchain/docs/extras/integrations/document_loaders/microsoft_powerpoint.ipynb
T

3.4 KiB

Microsoft PowerPoint

Microsoft PowerPoint is a presentation program by Microsoft.

This covers how to load Microsoft PowerPoint documents into a document format that we can use downstream.

In [1]:
from langchain.document_loaders import UnstructuredPowerPointLoader
In [2]:
loader = UnstructuredPowerPointLoader("example_data/fake-power-point.pptx")
In [3]:
data = loader.load()
In [4]:
data
Out [4]:
[Document(page_content='Adding a Bullet Slide\n\nFind the bullet slide layout\n\nUse _TextFrame.text for first bullet\n\nUse _TextFrame.add_paragraph() for subsequent bullets\n\nHere is a lot of text!\n\nHere is some text in a text box!', metadata={'source': 'example_data/fake-power-point.pptx'})]

Retain Elements

Under the hood, Unstructured creates different "elements" for different chunks of text. By default we combine those together, but you can easily keep that separation by specifying mode="elements".

In [2]:
loader = UnstructuredPowerPointLoader(
    "example_data/fake-power-point.pptx", mode="elements"
)
In [3]:
data = loader.load()
In [4]:
data[0]
Out [4]:
Document(page_content='Adding a Bullet Slide', lookup_str='', metadata={'source': 'example_data/fake-power-point.pptx'}, lookup_index=0)
In [ ]: