.ipynb
.pdf
Microsoft Word
 Contents 
Retain Elements
Microsoft Word#
This notebook shows how to load text from Microsoft word documents.
from langchain.document_loaders import UnstructuredDocxLoader
loader = UnstructuredDocxLoader('example_data/fake.docx')
data = loader.load()
data
[Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': 'example_data/fake.docx'}, lookup_index=0)]
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".
loader = UnstructuredDocxLoader('example_data/fake.docx', mode="elements")
data = loader.load()
data
[Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': 'example_data/fake.docx'}, lookup_index=0)]
previous
Markdown
next
Notebook
 Contents
  
Retain Elements
By Harrison Chase
    
      © Copyright 2023, Harrison Chase.
      
  Last updated on Mar 22, 2023.