EverNoteLoader#
- class langchain_community.document_loaders.evernote.EverNoteLoader(
- file_path: str | Path,
- load_single_document: bool = True,
Document loader for EverNote ENEX export files.
Loads EverNote notebook export files (
.enex
format) into LangChain Documents. Extracts plain text content from HTML and preserves note metadata including titles, timestamps, and attachments. Uses secure XML parsing to prevent vulnerabilities.The loader supports two modes: - Single document: Concatenates all notes into one Document (default) - Multiple documents: Creates separate Documents for each note
Instructions for creating ENEX files
Example:
from langchain_community.document_loaders import EverNoteLoader # Load all notes as a single document loader = EverNoteLoader("my_notebook.enex") documents = loader.load() # Load each note as a separate document: # documents = [ document1, document2, ... ] loader = EverNoteLoader("my_notebook.enex", load_single_document=False) documents = loader.load() # Lazy loading for large files for doc in loader.lazy_load(): print(f"Title: {doc.metadata.get('title', 'Untitled')}") print(f"Content: {doc.page_content[:100]}...")
Note
Requires the
lxml
andhtml2text
packages to be installed. Install with:pip install lxml html2text
Initialize the EverNote loader.
- Parameters:
file_path (str | Path) – Path to the EverNote export file (
.enex
extension).load_single_document (bool) – Whether to concatenate all notes into a single Document. If
True
, only thesource
metadata is preserved. IfFalse
, each note becomes a separate Document with its own metadata.
Methods
__init__
(file_path[, load_single_document])Initialize the EverNote loader.
A lazy loader for Documents.
aload
()Load data into Document objects.
Load documents from EverNote export file.
load
()Load data into Document objects.
load_and_split
([text_splitter])Load Documents and split into chunks.
- __init__(
- file_path: str | Path,
- load_single_document: bool = True,
Initialize the EverNote loader.
- Parameters:
file_path (str | Path) – Path to the EverNote export file (
.enex
extension).load_single_document (bool) – Whether to concatenate all notes into a single Document. If
True
, only thesource
metadata is preserved. IfFalse
, each note becomes a separate Document with its own metadata.
- async alazy_load() AsyncIterator[Document] #
A lazy loader for Documents.
- Return type:
AsyncIterator[Document]
- lazy_load() Iterator[Document] [source]#
Load documents from EverNote export file.
Depending on the
load_single_document
setting, either yields individual Documents for each note or a single Document containing all notes.- Yields:
Document – Either individual note Documents or a single combined Document.
- Return type:
Iterator[Document]
- load_and_split(
- text_splitter: TextSplitter | None = None,
Load Documents and split into chunks. Chunks are returned as Documents.
Do not override this method. It should be considered to be deprecated!
- Parameters:
text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.
- Returns:
List of Documents.
- Return type:
list[Document]
Examples using EverNoteLoader