Skip to main content

Multi-format document parser and converter (HWP, HWPX, PDF, Image)

Project description

ureca_document_parser

PyPI version Python 3.12+ License: MIT

한국어 워드프로세서 문서(HWP/HWPX)를 Markdown으로 변환하는 파이썬 라이브러리예요. LangChain과 완벽하게 통합되어 RAG 파이프라인 구축에 최적화되어 있어요.

주요 기능

  • HWP/HWPX 지원 — 아래한글 바이너리(HWP) 및 XML(HWPX) 포맷 모두 파싱
  • 📝 Markdown 변환 — 문단, 표, 리스트, 헤딩을 Markdown으로 변환
  • 🔗 LangChain 통합 — RAG 파이프라인을 위한 문서 청킹 기능 내장
  • 🎯 간단한 API — 한 줄로 변환하는 직관적인 인터페이스
  • 🛠️ CLI 도구 — 커맨드라인에서 바로 사용 가능
  • 🔧 확장 가능 — 새로운 포맷 추가가 쉬운 클린 아키텍처

설치

기본 설치 (HWP/HWPX만)

uv add ureca_document_parser

또는 pip 사용:

pip install ureca_document_parser

LangChain 통합 포함

uv add "ureca_document_parser[langchain]"

빠른 시작

Python API

from ureca_document_parser import convert

# 파일로 저장
convert("보고서.hwp", "보고서.md")

# 문자열로 반환
markdown = convert("보고서.hwp")
print(markdown)

# LangChain 청크로 반환 (RAG용)
chunks = convert("보고서.hwp", chunks=True, chunk_size=1000, chunk_overlap=200)
for chunk in chunks:
    print(chunk.page_content)

CLI

# 파일 변환
uv run ureca_document_parser 보고서.hwp -o 보고서.md

# 표준 출력으로
uv run ureca_document_parser 보고서.hwp

# 여러 파일 일괄 변환
for file in *.hwp; do
    uv run ureca_document_parser "$file" -o "${file%.hwp}.md"
done

LangChain과 함께 사용하기

from ureca_document_parser import convert
from langchain_openai import OpenAIEmbeddings
from langchain_chroma import Chroma

# 문서를 청크로 변환
chunks = convert("보고서.hwp", chunks=True)

# 벡터 스토어에 저장
embeddings = OpenAIEmbeddings()
vectorstore = Chroma.from_documents(documents=chunks, embedding=embeddings)

# 검색
results = vectorstore.similarity_search("프로젝트 일정은?", k=3)

지원 포맷

포맷 확장자 설명
HWP .hwp 아래한글 바이너리 포맷 (v5.0+)
HWPX .hwpx 아래한글 XML 포맷 (2014+)

문서

자세한 사용법과 API 문서는 공식 문서를 참고하세요:

제한사항

현재 버전에서는 다음 기능을 지원하지 않아요:

  • 이미지 추출 (대체 텍스트만 표시)
  • 도형 및 차트
  • 머리글/바닥글
  • 각주/미주
  • 복잡한 표 병합 구조

개발

# 개발 환경 설정
git clone https://github.com/ureca-corp/document_parser.git
cd document_parser
uv sync --extra dev

# Git hooks 설치 (린트 자동 검사)
./scripts/setup-hooks.sh

# 테스트 실행
uv run pytest tests/ -v

# 문서 미리보기
uv sync --extra docs
uv run mkdocs serve

Git Hooks

프로젝트는 커밋 전 자동 린트 검사를 위한 Git hooks를 제공해요:

# Hooks 설치
./scripts/setup-hooks.sh

# 설치 후 커밋 시 자동으로 ruff check 실행
git commit -m "message"  # → 자동으로 린트 검사

# 필요시 우회 (권장하지 않음)
git commit --no-verify -m "message"

라이선스

MIT License - 자세한 내용은 LICENSE 파일을 참고하세요.

기여

기여는 언제나 환영이에요! 이슈를 통해 버그 리포트나 기능 제안을 해주세요.

링크

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ureca_document_parser-0.0.6.tar.gz (189.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ureca_document_parser-0.0.6-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file ureca_document_parser-0.0.6.tar.gz.

File metadata

  • Download URL: ureca_document_parser-0.0.6.tar.gz
  • Upload date:
  • Size: 189.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ureca_document_parser-0.0.6.tar.gz
Algorithm Hash digest
SHA256 9b769482813fe2e62552cd1fa6048eb29dad734591c556f630c4e48ff65cfce2
MD5 0f6cf5160ede71386f25500e93c54b08
BLAKE2b-256 989910a7bcf6bc4eaee38dd18d52e3eda97d401e703722f72b5011259366ab75

See more details on using hashes here.

File details

Details for the file ureca_document_parser-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: ureca_document_parser-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ureca_document_parser-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 314a7985c7bf07bce51b3cff84ff79740b8b5ac392923db122f88e0be6a4dd88
MD5 7b054e15e17759156b2429aec5778b9d
BLAKE2b-256 d8ef30919e319e52a9d26285f442662ac5f02d34bc4dd0b8f790438c878141f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page