Word is a word processor developed by Microsoft.This covers how to load Word documents into a document format that we can use downstream.Using Docx2txt‚ÄãLoad .docx using Docx2txt into a document.pip install docx2txtfrom langchain.document_loaders import Docx2txtLoaderloader = Docx2txtLoader("example_data/fake.docx")data = loader.load()data    [Document(page_content='Lorem ipsum dolor sit amet.', metadata={'source': 'example_data/fake.docx'})]Using Unstructured‚Äãfrom langchain.document_loaders import UnstructuredWordDocumentLoaderloader = UnstructuredWordDocumentLoader("example_data/fake.docx")data = loader.load()data    [Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': '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 = UnstructuredWordDocumentLoader("example_data/fake.docx", mode="elements")data = loader.load()data[0]    Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': 'fake.docx', 'filename': 'fake.docx', 'category': 'Title'}, lookup_index=0)PreviousMicrosoft SharePointNextModern TreasuryUsing Docx2txtUsing UnstructuredRetain ElementsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Microsoft Word is a word processor developed by Microsoft.
Microsoft Word is a word processor developed by Microsoft. ->: Word is a word processor developed by Microsoft.This covers how to load Word documents into a document format that we can use downstream.Using Docx2txt‚ÄãLoad .docx using Docx2txt into a document.pip install docx2txtfrom langchain.document_loaders import Docx2txtLoaderloader = Docx2txtLoader("example_data/fake.docx")data = loader.load()data    [Document(page_content='Lorem ipsum dolor sit amet.', metadata={'source': 'example_data/fake.docx'})]Using Unstructured‚Äãfrom langchain.document_loaders import UnstructuredWordDocumentLoaderloader = UnstructuredWordDocumentLoader("example_data/fake.docx")data = loader.load()data    [Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': '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 = UnstructuredWordDocumentLoader("example_data/fake.docx", mode="elements")data = loader.load()data[0]    Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': 'fake.docx', 'filename': 'fake.docx', 'category': 'Title'}, lookup_index=0)PreviousMicrosoft SharePointNextModern TreasuryUsing Docx2txtUsing UnstructuredRetain ElementsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.