Metadata-Version: 2.4
Name: langchain-hwp-hwpx-loader
Version: 0.1.0
Summary: LangChain document loaders for HWP/HWPX using hwp-hwpx-parser
Project-URL: Homepage, https://github.com/jeounghopark/HWP-Loader
Project-URL: Repository, https://github.com/jeounghopark/HWP-Loader
Project-URL: Issues, https://github.com/jeounghopark/HWP-Loader/issues
Author: HWP Loader Contributors
License: MIT License
        
        Copyright (c) 2026 jaypakdevkr
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: hwp,hwpx,langchain,loader,rag
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: <4.0,>=3.10
Requires-Dist: hwp-hwpx-parser<2.0.0,>=1.0.0
Requires-Dist: langchain-core<2.0.0,>=1.0.0
Provides-Extra: dev
Requires-Dist: black>=24.8.0; extra == 'dev'
Requires-Dist: mypy>=1.11.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.7.0; extra == 'dev'
Description-Content-Type: text/markdown

# LangChain HWP/HWPX Loader

`langchain-hwp-hwpx-loader` is a pure-Python LangChain loader for Korean
`.hwp` and `.hwpx` documents, powered by
[`hwp-hwpx-parser`](https://pypi.org/project/hwp-hwpx-parser/).

It is built for offline/on-prem RAG indexing and keeps body text, tables,
footnotes/endnotes, memos, and hyperlinks with configurable policies.

## Installation

```bash
pip install langchain-hwp-hwpx-loader
```

## Quickstart

### Single document mode

```python
from pathlib import Path

from hwp_hwpx_parser import ExtractOptions, ImageMarkerStyle, TableStyle
from langchain_hwp_hwpx import HwpHwpxLoader

options = ExtractOptions(
    table_style=TableStyle.MARKDOWN,
    image_marker=ImageMarkerStyle.SIMPLE,
)

loader = HwpHwpxLoader(
    file_path=Path("docs/sample.hwp"),
    mode="single",
    extract_options=options,
    include_tables=True,
    include_notes=True,
    include_memos=True,
    include_hyperlinks=True,
)

docs = loader.load()
print(docs[0].page_content[:400])
print(docs[0].metadata)
```

### Elements mode

```python
from langchain_hwp_hwpx import HwpHwpxLoader

loader = HwpHwpxLoader("docs/sample.hwpx", mode="elements")
for doc in loader.lazy_load():
    print(doc.metadata["element_type"], doc.metadata["element_index"])
```

### Directory loading

```python
from langchain_hwp_hwpx import HwpHwpxDirectoryLoader

directory_loader = HwpHwpxDirectoryLoader(
    dir_path="docs",
    glob="**/*",
    recursive=True,
    mode="single",
    on_error="warn",
)

docs = directory_loader.load()
print(len(docs))
```

## Main Options

- `mode`: `"single"` or `"elements"`
- `include_tables`, `include_notes`, `include_memos`, `include_hyperlinks`
- `include_images`, `images_dir`, `image_document_mode`
- `on_encrypted`: `"raise" | "skip" | "placeholder"`
- `on_invalid`: `"raise" | "skip" | "placeholder"`
- `on_error`: `"raise" | "skip" | "warn"`

`extract_options` accepts `hwp_hwpx_parser.ExtractOptions`.

## Metadata

All returned documents include common metadata:

- `source`, `file_name`, `file_type`
- `loader`, `parser`
- `extracted_at` (UTC ISO timestamp by default)

`mode="elements"` adds:

- `element_type`, `element_index`
- table fields: `row_count`, `col_count`
- note fields: `note_type`, `note_number`
- optional memo/hyperlink/image specific fields when available

## Limitations

- Encrypted documents are only detectable. Decryption is not supported.
- OCR and visual layout reconstruction are out of scope.
- Parsing quality depends on `hwp-hwpx-parser` capabilities.

## Compatibility

- Python: `>=3.10,<4.0`
- `langchain-core>=1.0.0,<2.0.0`
- `hwp-hwpx-parser>=1.0.0,<2.0.0`
