extract-hwp 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,197 @@
1
+ Metadata-Version: 2.4
2
+ Name: extract-hwp
3
+ Version: 0.1.0
4
+ Summary: Python library for extracting text from Korean HWP files (HWP 5.0 and HWPX formats)
5
+ Project-URL: Homepage, https://github.com/thlee/extract-hwp
6
+ Project-URL: Bug Reports, https://github.com/thlee/extract-hwp/issues
7
+ Project-URL: Source, https://github.com/thlee/extract-hwp
8
+ Author-email: extract-hwp <extract-hwp@example.com>
9
+ License: BSD-3-Clause
10
+ License-File: LICENSE
11
+ Keywords: document,hwp,hwpx,korean,text-extraction
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: BSD License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: Text Processing
25
+ Requires-Python: >=3.8
26
+ Requires-Dist: olefile>=0.46
27
+ Description-Content-Type: text/markdown
28
+
29
+ # extract-hwp
30
+
31
+ 한글과컴퓨터의 HWP 파일(HWP 5.0 및 HWPX 형식)에서 텍스트를 추출하는 Python 라이브러리입니다.
32
+
33
+ ## 특징
34
+
35
+ - **다중 포맷 지원**: HWP 5.0 (OLE) 및 HWPX (ZIP/XML) 파일 모두 지원
36
+ - **암호화 파일 감지**: 처리하기 전에 암호로 보호된 파일을 감지
37
+ - **구조화된 추출**: 텍스트 추출 시 단락 구조 보존
38
+ - **견고한 오류 처리**: 손상되거나 잘못된 파일에 대한 방어적 처리
39
+ - **유니코드 지원**: 한글 및 다국어 텍스트 완전 지원
40
+
41
+ ## 설치
42
+
43
+ ```bash
44
+ pip install extract-hwp
45
+ ```
46
+
47
+ ## 사용법
48
+
49
+ ### 기본 사용법
50
+
51
+ ```python
52
+ from extract_hwp import extract_text_from_hwp
53
+
54
+ # HWP 또는 HWPX 파일에서 텍스트 추출
55
+ text, error = extract_text_from_hwp("document.hwp")
56
+ if error is None:
57
+ print(text)
58
+ else:
59
+ print(f"오류: {error}")
60
+ ```
61
+
62
+ ### 포맷별 추출
63
+
64
+ ```python
65
+ from extract_hwp import extract_text_from_hwpx, extract_text_from_hwp5
66
+
67
+ # HWPX 파일 전용
68
+ hwpx_text = extract_text_from_hwpx("document.hwpx")
69
+
70
+ # HWP 5.0 파일 전용
71
+ hwp5_text = extract_text_from_hwp5("document.hwp")
72
+ ```
73
+
74
+ ### 암호화 파일 감지
75
+
76
+ ```python
77
+ from extract_hwp import is_hwp_file_password_protected
78
+
79
+ if is_hwp_file_password_protected("document.hwp"):
80
+ print("파일이 암호로 보호되어 있습니다.")
81
+ else:
82
+ text, error = extract_text_from_hwp("document.hwp")
83
+ ```
84
+
85
+ ## API 참조
86
+
87
+ ### 핵심 함수
88
+
89
+ #### `extract_text_from_hwp(filepath)`
90
+
91
+ HWP/HWPX 파일에서 텍스트를 추출합니다 (통합 인터페이스).
92
+
93
+ **매개변수:**
94
+ - `filepath` (str): HWP 또는 HWPX 파일 경로
95
+
96
+ **반환값:**
97
+ - `tuple`: (추출된_텍스트, 오류_메시지). 성공시 오류_메시지는 None
98
+
99
+ **예외:**
100
+ - `FileNotFoundError`: 파일을 찾을 수 없음
101
+ - `PermissionError`: 파일 접근 권한이 없음
102
+ - `ValueError`: 지원하지 않는 파일 형식
103
+
104
+ ### 포맷별 함수
105
+
106
+ #### `extract_text_from_hwpx(hwpx_file_path)`
107
+
108
+ HWPX 파일에서 텍스트를 추출합니다.
109
+
110
+ **매개변수:**
111
+ - `hwpx_file_path` (str): HWPX 파일 경로
112
+
113
+ **반환값:**
114
+ - `str`: 추출된 텍스트 (오류 시 빈 문자열)
115
+
116
+ #### `extract_text_from_hwp5(filepath)`
117
+
118
+ HWP 5.0 (OLE) 파일에서 텍스트를 추출합니다.
119
+
120
+ **매개변수:**
121
+ - `filepath` (str): HWP 파일 경로
122
+
123
+ **반환값:**
124
+ - `str`: 추출된 텍스트 (오류 시 빈 문자열)
125
+
126
+ ### 암호화 감지 함수
127
+
128
+ #### `is_hwp_file_password_protected(filepath)`
129
+
130
+ HWP/HWPX 파일이 암호로 보호되어 있는지 확인합니다.
131
+
132
+ **매개변수:**
133
+ - `filepath` (str): 확인할 파일 경로
134
+
135
+ **반환값:**
136
+ - `bool`: 암호로 보호된 경우 True, 그렇지 않으면 False
137
+
138
+ ## 지원 포맷
139
+
140
+ ### HWP 5.0 (OLE 포맷)
141
+ - 확장자: `.hwp`
142
+ - 구조: OLE 복합 문서 형식
143
+ - 압축: zlib 압축 지원
144
+ - 특징: 바이너리 구조 분석을 통한 텍스트 추출
145
+
146
+ ### HWPX (ZIP/XML 포맷)
147
+ - 확장자: `.hwpx`
148
+ - 구조: XML 문서가 포함된 ZIP 아카이브
149
+ - 특징: 구조화된 텍스트 추출을 위한 XML 파싱
150
+
151
+ ## 의존성
152
+
153
+ - `olefile>=0.46`: HWP 5.0 OLE 파일 처리
154
+
155
+ ## 개발
156
+
157
+ ### 개발 환경 설정
158
+
159
+ ```bash
160
+ # 저장소 복제
161
+ git clone https://github.com/thlee/extract-hwp.git
162
+ cd extract-hwp
163
+
164
+ # 의존성 설치
165
+ uv sync
166
+
167
+ # 개발 의존성 포함 설치
168
+ uv sync --extra dev
169
+ ```
170
+
171
+ ### 테스트
172
+
173
+ ```bash
174
+ # 테스트 실행
175
+ pytest
176
+
177
+ # 커버리지 포함
178
+ pytest --cov=src/extract_hwp
179
+ ```
180
+
181
+ ### 코드 품질
182
+
183
+ ```bash
184
+ # 코드 포맷팅
185
+ black src/ tests/
186
+
187
+ # 타입 검사
188
+ mypy src/
189
+ ```
190
+
191
+ ## 라이선스
192
+
193
+ BSD 3-Clause License - 자세한 내용은 [LICENSE](LICENSE) 파일을 참조하세요.
194
+
195
+ ## 변경사항
196
+
197
+ 버전 히스토리는 [CHANGELOG.md](CHANGELOG.md)에서 확인할 수 있습니다.
@@ -0,0 +1,4 @@
1
+ extract_hwp-0.1.0.dist-info/METADATA,sha256=c6_aqe-hR970jqIraoe_a4i_8XdHxgvWMuRSfDYrOAE,4931
2
+ extract_hwp-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
3
+ extract_hwp-0.1.0.dist-info/licenses/LICENSE,sha256=s1kR80l9e8tnCQ4z_cqQ9tHy8JE4TXrQgL3kk83u6jI,1540
4
+ extract_hwp-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, thlee
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.