kordoc 4.18.12 → 4.18.13
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.
- package/README.md +2 -2
- package/dist/{-WZOQMDES.js → -DC2OO5KO.js} +11 -11
- package/dist/{chunk-GZAYV2SV.js → chunk-32ZUIHSY.js} +3 -3
- package/dist/{chunk-OB3GPKKZ.cjs → chunk-3FGHQWJP.cjs} +38 -24
- package/dist/chunk-3FGHQWJP.cjs.map +1 -0
- package/dist/{chunk-PTWSL4FG.js → chunk-6AYTYTFY.js} +3 -3
- package/dist/{chunk-A7VXXIRT.cjs → chunk-6CQZMVXW.cjs} +3 -3
- package/dist/{chunk-A7VXXIRT.cjs.map → chunk-6CQZMVXW.cjs.map} +1 -1
- package/dist/{chunk-5WLN2JNN.cjs → chunk-6FW3AZWN.cjs} +6 -6
- package/dist/{chunk-5WLN2JNN.cjs.map → chunk-6FW3AZWN.cjs.map} +1 -1
- package/dist/{chunk-A72XCFET.js → chunk-7LOD4IGO.js} +4 -4
- package/dist/{chunk-PTLYGMNQ.js → chunk-DHEUQXXR.js} +2 -2
- package/dist/{chunk-APPUKIPQ.js → chunk-EBXJ45VZ.js} +2 -2
- package/dist/{chunk-XRVJ7UHC.js → chunk-EZSWBHHI.js} +2 -2
- package/dist/{chunk-GGX5AA2L.cjs → chunk-GGMIPTM5.cjs} +12 -12
- package/dist/{chunk-GGX5AA2L.cjs.map → chunk-GGMIPTM5.cjs.map} +1 -1
- package/dist/{chunk-XM2ZOOEW.js → chunk-GSW7W7AL.js} +2 -2
- package/dist/{chunk-T3AJHRWN.js → chunk-GUH6HYSZ.js} +10 -10
- package/dist/{chunk-G2PGKJUH.js → chunk-INESPVEV.js} +19 -5
- package/dist/chunk-INESPVEV.js.map +1 -0
- package/dist/{chunk-M7CCB6J3.js → chunk-IRN5SDY2.js} +2 -2
- package/dist/{chunk-CXNMHMPS.js → chunk-ISC2TH24.js} +2 -2
- package/dist/{chunk-MFA3TJWM.js → chunk-JKHU7HID.js} +2 -2
- package/dist/{chunk-FWLSXLDC.js → chunk-JPSLMPFI.js} +2 -2
- package/dist/{chunk-QYT3XW2J.js → chunk-JWTZ3OVZ.js} +2 -2
- package/dist/{chunk-2CMRR7SH.cjs → chunk-K6WSMTVU.cjs} +2 -2
- package/dist/{chunk-2CMRR7SH.cjs.map → chunk-K6WSMTVU.cjs.map} +1 -1
- package/dist/{chunk-MXCQIXGJ.js → chunk-LKA7Z2NH.js} +2 -2
- package/dist/{chunk-A2B5AYXD.js → chunk-PHMWSWHJ.js} +2 -2
- package/dist/{chunk-5V4XXKGX.js → chunk-PN5WWW56.js} +2 -2
- package/dist/{chunk-XRJRZCJA.cjs → chunk-RQEDNI4P.cjs} +3 -3
- package/dist/{chunk-XRJRZCJA.cjs.map → chunk-RQEDNI4P.cjs.map} +1 -1
- package/dist/{chunk-4SKWUNN7.js → chunk-SVIOP7PE.js} +6 -6
- package/dist/{chunk-4RVCC5YD.js → chunk-V7LKQNC4.js} +2 -2
- package/dist/{chunk-C7P6EZHR.js → chunk-VDEENOPW.js} +2 -2
- package/dist/{chunk-R2NGHNS3.js → chunk-XVB3PUPJ.js} +2 -2
- package/dist/{chunk-IRTDNELH.js → chunk-ZNY5BRV6.js} +20 -6
- package/dist/chunk-ZNY5BRV6.js.map +1 -0
- package/dist/chunks-JZW2TXIZ.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-7FODYMWG.js → formula-DAMFHLQO.js} +3 -3
- package/dist/{formula-CAUZGR3C.cjs → formula-HJNQGPRC.cjs} +9 -9
- package/dist/{formula-CAUZGR3C.cjs.map → formula-HJNQGPRC.cjs.map} +1 -1
- package/dist/{formula-VWCF7AV5.js → formula-YCAO5IVW.js} +4 -4
- package/dist/{image-ocr-YLTHT7IE.cjs → image-ocr-AZ25IOC7.cjs} +15 -15
- package/dist/{image-ocr-YLTHT7IE.cjs.map → image-ocr-AZ25IOC7.cjs.map} +1 -1
- package/dist/{image-ocr-UOAHUR4Y.js → image-ocr-PAF76DAW.js} +9 -9
- package/dist/{image-ocr-LFMD7GFW.js → image-ocr-VH54SDZ7.js} +6 -6
- package/dist/index.cjs +277 -277
- package/dist/index.js +5 -5
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-IRGZNITZ.js → model-bundle-53CHDYCG.js} +5 -5
- package/dist/{models-QLW4GG62.js → models-UVLAKK3M.js} +5 -5
- package/dist/{parser-MOZDJZHH.cjs → parser-HWAOPQYK.cjs} +126 -126
- package/dist/{parser-MOZDJZHH.cjs.map → parser-HWAOPQYK.cjs.map} +1 -1
- package/dist/{parser-KPWQK4CU.js → parser-I4D3TRGU.js} +11 -11
- package/dist/{parser-VDZTRLXN.js → parser-Z6PHB54O.js} +8 -8
- package/dist/pdf-ocr-F4ICXO7W.js +20 -0
- package/dist/pdf-ocr-HR6CXGTX.cjs +17 -0
- package/dist/{pdf-ocr-IDZQ2KUS.cjs.map → pdf-ocr-HR6CXGTX.cjs.map} +1 -1
- package/dist/pdf-ocr-JI3K7JIN.js +16 -0
- package/dist/{profile-io-UJWTARCU.js → profile-io-WHCWCOPW.js} +3 -3
- package/dist/{rasterize-2FB766KD.js → rasterize-5DZ3DHGH.js} +3 -3
- package/dist/{redact-doc-J6U6WWKD.js → redact-doc-RNJVMFGQ.js} +11 -11
- package/dist/{render-CCIUMRLV.js → render-NZ6RA6SW.js} +7 -7
- package/dist/seal-WHJ6O5HT.js +10 -0
- package/dist/{setup-EEMGK6BR.js → setup-U3EQNK4Z.js} +3 -3
- package/dist/visual-JDAS4R43.js +20 -0
- package/dist/{watch-6I73YNFW.js → watch-GB2M7XU6.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-G2PGKJUH.js.map +0 -1
- package/dist/chunk-IRTDNELH.js.map +0 -1
- package/dist/chunk-OB3GPKKZ.cjs.map +0 -1
- package/dist/chunks-UQYMW7PG.js +0 -10
- package/dist/pdf-ocr-7MEF7NN4.js +0 -16
- package/dist/pdf-ocr-GO7BGPHA.js +0 -20
- package/dist/pdf-ocr-IDZQ2KUS.cjs +0 -17
- package/dist/seal-NKE6UTJL.js +0 -10
- package/dist/visual-6K3FOUEP.js +0 -20
- /package/dist/{-WZOQMDES.js.map → -DC2OO5KO.js.map} +0 -0
- /package/dist/{chunk-GZAYV2SV.js.map → chunk-32ZUIHSY.js.map} +0 -0
- /package/dist/{chunk-PTWSL4FG.js.map → chunk-6AYTYTFY.js.map} +0 -0
- /package/dist/{chunk-A72XCFET.js.map → chunk-7LOD4IGO.js.map} +0 -0
- /package/dist/{chunk-PTLYGMNQ.js.map → chunk-DHEUQXXR.js.map} +0 -0
- /package/dist/{chunk-APPUKIPQ.js.map → chunk-EBXJ45VZ.js.map} +0 -0
- /package/dist/{chunk-XRVJ7UHC.js.map → chunk-EZSWBHHI.js.map} +0 -0
- /package/dist/{chunk-XM2ZOOEW.js.map → chunk-GSW7W7AL.js.map} +0 -0
- /package/dist/{chunk-T3AJHRWN.js.map → chunk-GUH6HYSZ.js.map} +0 -0
- /package/dist/{chunk-M7CCB6J3.js.map → chunk-IRN5SDY2.js.map} +0 -0
- /package/dist/{chunk-CXNMHMPS.js.map → chunk-ISC2TH24.js.map} +0 -0
- /package/dist/{chunk-MFA3TJWM.js.map → chunk-JKHU7HID.js.map} +0 -0
- /package/dist/{chunk-FWLSXLDC.js.map → chunk-JPSLMPFI.js.map} +0 -0
- /package/dist/{chunk-QYT3XW2J.js.map → chunk-JWTZ3OVZ.js.map} +0 -0
- /package/dist/{chunk-MXCQIXGJ.js.map → chunk-LKA7Z2NH.js.map} +0 -0
- /package/dist/{chunk-A2B5AYXD.js.map → chunk-PHMWSWHJ.js.map} +0 -0
- /package/dist/{chunk-5V4XXKGX.js.map → chunk-PN5WWW56.js.map} +0 -0
- /package/dist/{chunk-4SKWUNN7.js.map → chunk-SVIOP7PE.js.map} +0 -0
- /package/dist/{chunk-4RVCC5YD.js.map → chunk-V7LKQNC4.js.map} +0 -0
- /package/dist/{chunk-C7P6EZHR.js.map → chunk-VDEENOPW.js.map} +0 -0
- /package/dist/{chunk-R2NGHNS3.js.map → chunk-XVB3PUPJ.js.map} +0 -0
- /package/dist/{chunks-UQYMW7PG.js.map → chunks-JZW2TXIZ.js.map} +0 -0
- /package/dist/{formula-7FODYMWG.js.map → formula-DAMFHLQO.js.map} +0 -0
- /package/dist/{formula-VWCF7AV5.js.map → formula-YCAO5IVW.js.map} +0 -0
- /package/dist/{image-ocr-UOAHUR4Y.js.map → image-ocr-PAF76DAW.js.map} +0 -0
- /package/dist/{image-ocr-LFMD7GFW.js.map → image-ocr-VH54SDZ7.js.map} +0 -0
- /package/dist/{model-bundle-IRGZNITZ.js.map → model-bundle-53CHDYCG.js.map} +0 -0
- /package/dist/{models-QLW4GG62.js.map → models-UVLAKK3M.js.map} +0 -0
- /package/dist/{parser-KPWQK4CU.js.map → parser-I4D3TRGU.js.map} +0 -0
- /package/dist/{parser-VDZTRLXN.js.map → parser-Z6PHB54O.js.map} +0 -0
- /package/dist/{pdf-ocr-7MEF7NN4.js.map → pdf-ocr-F4ICXO7W.js.map} +0 -0
- /package/dist/{pdf-ocr-GO7BGPHA.js.map → pdf-ocr-JI3K7JIN.js.map} +0 -0
- /package/dist/{profile-io-UJWTARCU.js.map → profile-io-WHCWCOPW.js.map} +0 -0
- /package/dist/{rasterize-2FB766KD.js.map → rasterize-5DZ3DHGH.js.map} +0 -0
- /package/dist/{redact-doc-J6U6WWKD.js.map → redact-doc-RNJVMFGQ.js.map} +0 -0
- /package/dist/{render-CCIUMRLV.js.map → render-NZ6RA6SW.js.map} +0 -0
- /package/dist/{seal-NKE6UTJL.js.map → seal-WHJ6O5HT.js.map} +0 -0
- /package/dist/{setup-EEMGK6BR.js.map → setup-U3EQNK4Z.js.map} +0 -0
- /package/dist/{visual-6K3FOUEP.js.map → visual-JDAS4R43.js.map} +0 -0
- /package/dist/{watch-6I73YNFW.js.map → watch-GB2M7XU6.js.map} +0 -0
package/README.md
CHANGED
|
@@ -111,11 +111,11 @@ await writeFile("보고서.hwpx", Buffer.from(hwpx))
|
|
|
111
111
|
|
|
112
112
|
## 최근 업데이트
|
|
113
113
|
|
|
114
|
-
최신 배포: **[4.18.
|
|
114
|
+
최신 배포: **[4.18.13](https://github.com/chrisryugj/kordoc/releases/tag/v4.18.13)** · 2026-10-04
|
|
115
115
|
|
|
116
116
|
| 버전 | 주요 변경 |
|
|
117
117
|
| --- | --- |
|
|
118
|
-
| 4.18.12 | PDF 쪽 넘김 문단 잇기 판정을 HWPX 원문 대조로 재조정 — 문장
|
|
118
|
+
| 4.18.12–13 | PDF 쪽 넘김 문단 잇기 판정을 HWPX·DOCX 원문 대조로 재조정 — 문장 끝·들여쓰기·나열 기호·탭 행 근거 (HWPX 쌍 오판 50 → 5) |
|
|
119
119
|
| 4.18.11 | 글꼴 사전 수천 개가 글꼴 파일을 나눠 쓰는 PDF의 메모리 폭주(힙 7GB+ 종료) 수정 (#137) |
|
|
120
120
|
| 4.18.9–10 | PDF 쪽 넘김 문단 잇기: 쪽별 마크다운(`pages`) 쪽 경계 복구(#136), 쪽 첫머리 제목·목차·항목 오결합 방지 |
|
|
121
121
|
| 4.18.8 | HWPX 셀 문단의 CRLF·CR·LF 줄바꿈을 보존하며 같은 줄 수의 텍스트 편집 지원 |
|
|
@@ -51,17 +51,17 @@ import {
|
|
|
51
51
|
unknownFontWarnings,
|
|
52
52
|
usesGaejosikMunche,
|
|
53
53
|
validateHwpx
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-GUH6HYSZ.js";
|
|
55
55
|
import {
|
|
56
56
|
blocksToPages
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-V7LKQNC4.js";
|
|
58
58
|
import {
|
|
59
59
|
applySplices,
|
|
60
60
|
buildParagraphSplices,
|
|
61
61
|
buildRangeSplices,
|
|
62
62
|
placeSealHwpx,
|
|
63
63
|
scanSectionXml
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-6AYTYTFY.js";
|
|
65
65
|
import {
|
|
66
66
|
DEFAULT_REDACT_RULES,
|
|
67
67
|
redactMarkdown,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
} from "./chunk-3WSNLH4B.js";
|
|
70
70
|
import {
|
|
71
71
|
blocksToChunks
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-GSW7W7AL.js";
|
|
73
73
|
import {
|
|
74
74
|
SPACE_EM_FIXED,
|
|
75
75
|
SPACE_EM_FONT,
|
|
@@ -94,20 +94,20 @@ import {
|
|
|
94
94
|
renderSceneToHtml,
|
|
95
95
|
simulateWrap,
|
|
96
96
|
simulateWrapKeepWord
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-SVIOP7PE.js";
|
|
98
98
|
import "./chunk-7FCNOKOR.js";
|
|
99
|
-
import "./chunk-
|
|
99
|
+
import "./chunk-XVB3PUPJ.js";
|
|
100
100
|
import "./chunk-VQFA55IC.js";
|
|
101
|
-
import "./chunk-
|
|
101
|
+
import "./chunk-DHEUQXXR.js";
|
|
102
102
|
import {
|
|
103
103
|
blocksToMarkdown,
|
|
104
104
|
flattenLayoutTables,
|
|
105
105
|
hasStructuredCellContent
|
|
106
|
-
} from "./chunk-
|
|
107
|
-
import "./chunk-
|
|
106
|
+
} from "./chunk-JKHU7HID.js";
|
|
107
|
+
import "./chunk-IRN5SDY2.js";
|
|
108
108
|
import {
|
|
109
109
|
VERSION
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-PN5WWW56.js";
|
|
111
111
|
export {
|
|
112
112
|
BUILTIN_TEMPLATES,
|
|
113
113
|
DEFAULT_REDACT_RULES,
|
|
@@ -198,4 +198,4 @@ export {
|
|
|
198
198
|
usesGaejosikMunche,
|
|
199
199
|
validateHwpx
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=-
|
|
201
|
+
//# sourceMappingURL=-DC2OO5KO.js.map
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
extractPageBlocksWithLines,
|
|
10
10
|
getOcrModelsDir,
|
|
11
11
|
parseCharacterDict
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZNY5BRV6.js";
|
|
13
13
|
import {
|
|
14
14
|
OPTIONAL_DEP_INSTALL_HINT
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EBXJ45VZ.js";
|
|
16
16
|
|
|
17
17
|
// src/ocr/ruling-lines.ts
|
|
18
18
|
var INK_LUMA_MAX = 205;
|
|
@@ -2062,4 +2062,4 @@ export {
|
|
|
2062
2062
|
runPdfOcr,
|
|
2063
2063
|
ocrItemsToBlocks
|
|
2064
2064
|
};
|
|
2065
|
-
//# sourceMappingURL=chunk-
|
|
2065
|
+
//# sourceMappingURL=chunk-32ZUIHSY.js.map
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk6FW3AZWNcjs = require('./chunk-6FW3AZWN.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk6CQZMVXWcjs = require('./chunk-6CQZMVXW.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkK6WSMTVUcjs = require('./chunk-K6WSMTVU.cjs');
|
|
16
16
|
|
|
17
17
|
// src/ocr/models.ts
|
|
18
18
|
var _path = require('path');
|
|
@@ -40,10 +40,10 @@ var OCR_REC_DICT = {
|
|
|
40
40
|
};
|
|
41
41
|
var ALL_OCR_MODELS = [OCR_DET_MODEL, OCR_REC_MODEL, OCR_REC_DICT];
|
|
42
42
|
function getOcrModelsDir() {
|
|
43
|
-
return
|
|
43
|
+
return _chunk6CQZMVXWcjs.getModelsDir.call(void 0, "ppocr");
|
|
44
44
|
}
|
|
45
45
|
async function ensureOcrModels(onProgress) {
|
|
46
|
-
return
|
|
46
|
+
return _chunk6CQZMVXWcjs.ensureModelsIn.call(void 0, getOcrModelsDir(), ALL_OCR_MODELS, onProgress);
|
|
47
47
|
}
|
|
48
48
|
async function ocrModelsCached() {
|
|
49
49
|
const dir = getOcrModelsDir();
|
|
@@ -2091,7 +2091,7 @@ function tagScripts(text, lines) {
|
|
|
2091
2091
|
const [s, e, kind] = marks[m];
|
|
2092
2092
|
out = out.slice(0, s) + `<${kind}>` + out.slice(s, e) + `</${kind}>` + out.slice(e);
|
|
2093
2093
|
}
|
|
2094
|
-
return
|
|
2094
|
+
return _chunk6FW3AZWNcjs.tidyScriptTags.call(void 0, out);
|
|
2095
2095
|
}
|
|
2096
2096
|
|
|
2097
2097
|
// src/pdf/line-wrap.ts
|
|
@@ -2242,8 +2242,10 @@ function wrapJoiner(prevText, nextText, lex) {
|
|
|
2242
2242
|
return " ";
|
|
2243
2243
|
}
|
|
2244
2244
|
var PARA_LAST_LINE = /* @__PURE__ */ new WeakMap();
|
|
2245
|
+
var PARA_FIRST_LEFT = /* @__PURE__ */ new WeakMap();
|
|
2245
2246
|
var PAGE_REF_TAIL = /(?:\t|…|·{2}|\.{3})\s*\d{1,4}(?:\s*\/\s*\d{1,4})?\s*$/;
|
|
2246
2247
|
var PAGE_HEAD_MARK = /^(?:[\u0000-\u001f\ue000-\uf8ff\u25a0-\u25ff\u2750-\u275f<〈《〔\[]|ㅇ\s)/;
|
|
2248
|
+
var PAGE_ITEM_HEAD = /^(?:\S{1,4}\t|\.\d{1,3}\s)/;
|
|
2247
2249
|
var SENTENCE_END = /[.?!。][”"’」』)]?$/;
|
|
2248
2250
|
var titleLike = (text) => {
|
|
2249
2251
|
const t = text.replace(MARKUP, "").trim();
|
|
@@ -2256,6 +2258,11 @@ function joinPageBreakWraps(blocks, lex) {
|
|
|
2256
2258
|
if (b.type !== "paragraph" || !b.bbox || !b.pageNumber) continue;
|
|
2257
2259
|
pageRight.set(b.pageNumber, Math.max(_nullishCoalesce(pageRight.get(b.pageNumber), () => ( -Infinity)), b.bbox.x + b.bbox.width));
|
|
2258
2260
|
}
|
|
2261
|
+
const pageLeft = /* @__PURE__ */ new Map();
|
|
2262
|
+
for (const b of blocks) {
|
|
2263
|
+
if (b.type !== "paragraph" || !b.bbox || !b.pageNumber) continue;
|
|
2264
|
+
pageLeft.set(b.pageNumber, Math.min(_nullishCoalesce(pageLeft.get(b.pageNumber), () => ( Infinity)), b.bbox.x));
|
|
2265
|
+
}
|
|
2259
2266
|
for (let i = blocks.length - 1; i > 0; i--) {
|
|
2260
2267
|
const a = blocks[i - 1], b = blocks[i];
|
|
2261
2268
|
if (!a.pageNumber || b.pageNumber !== a.pageNumber + 1 || !a.text || !b.text) continue;
|
|
@@ -2263,9 +2270,14 @@ function joinPageBreakWraps(blocks, lex) {
|
|
|
2263
2270
|
const last = a.bbox && PARA_LAST_LINE.get(a.bbox), fs = last ? last.fontSize : 0;
|
|
2264
2271
|
if (!last || fs <= 0 || (_nullishCoalesce(pageRight.get(a.pageNumber), () => ( Infinity))) - last.right >= BODY_FULL_TOL * fs) continue;
|
|
2265
2272
|
if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _56 => _56.style, 'optionalAccess', _57 => _57.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
|
|
2266
|
-
|
|
2267
|
-
if (
|
|
2273
|
+
const bt = b.text.replace(MARKUP, "");
|
|
2274
|
+
if (startsNewItem(a.text, b.text) || PAGE_REF_TAIL.test(a.text) || PAGE_ITEM_HEAD.test(bt)) continue;
|
|
2275
|
+
if (PAGE_HEAD_MARK.test(bt) && !(/^[\u25a0-\u25ff]/.test(bt) && a.text.includes(bt[0]))) continue;
|
|
2276
|
+
const firstLeft = b.bbox && PARA_FIRST_LEFT.get(b.bbox);
|
|
2277
|
+
const indented = firstLeft === void 0 || firstLeft - (_nullishCoalesce(pageLeft.get(b.pageNumber), () => ( firstLeft))) >= 0.3 * fs;
|
|
2278
|
+
if (indented && SENTENCE_END.test(a.text.replace(MARKUP, "").trimEnd())) continue;
|
|
2268
2279
|
if (Math.round(_nullishCoalesce(_optionalChain([b, 'access', _58 => _58.style, 'optionalAccess', _59 => _59.fontSize]), () => ( 0))) !== Math.round(fs) && titleLike(b.text)) continue;
|
|
2280
|
+
if (/\t/.test(a.text.slice(a.text.lastIndexOf("\n") + 1).replace(/^\S{1,8}\t/, "")) && titleLike(bt.trim().split("\n")[0])) continue;
|
|
2269
2281
|
const head = a.text, joiner = wrapJoiner(a.text, b.text, lex);
|
|
2270
2282
|
a.text += joiner + b.text;
|
|
2271
2283
|
const later = b.bbox && PAGE_BREAK_JOINS.get(b.bbox) || [];
|
|
@@ -3633,6 +3645,7 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
|
|
|
3633
3645
|
joins[1] = "\n";
|
|
3634
3646
|
}
|
|
3635
3647
|
for (let i = 0; i < lines.length; ) {
|
|
3648
|
+
const first2 = i;
|
|
3636
3649
|
let text = lines[i].text;
|
|
3637
3650
|
const items = [...lines[i].items];
|
|
3638
3651
|
const srcLines = [lines[i].items];
|
|
@@ -3647,6 +3660,7 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
|
|
|
3647
3660
|
for (const it of items) faces.set(it.fontName, (_nullishCoalesce(faces.get(it.fontName), () => ( 0))) + it.text.length);
|
|
3648
3661
|
FACE_CHARS.set(block, faces);
|
|
3649
3662
|
PARA_LAST_LINE.set(block.bbox, { right: geo[i].right, width: geo[i].right - geo[i].left, fontSize: geo[i].fontSize });
|
|
3663
|
+
PARA_FIRST_LEFT.set(block.bbox, geo[first2].left);
|
|
3650
3664
|
out.push(block);
|
|
3651
3665
|
i++;
|
|
3652
3666
|
}
|
|
@@ -3675,9 +3689,9 @@ function detectHeadings(blocks, medianFontSize) {
|
|
|
3675
3689
|
if (/^\d+$/.test(text) && !isChapterNumber(block, blocks[bi + 1], medianFontSize)) continue;
|
|
3676
3690
|
const ratio = block.style.fontSize / medianFontSize;
|
|
3677
3691
|
let level = 0;
|
|
3678
|
-
if (ratio >=
|
|
3679
|
-
else if (ratio >=
|
|
3680
|
-
else if (ratio >=
|
|
3692
|
+
if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H1) level = 1;
|
|
3693
|
+
else if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H2) level = 2;
|
|
3694
|
+
else if (ratio >= _chunk6FW3AZWNcjs.HEADING_RATIO_H3) level = 3;
|
|
3681
3695
|
if (level > 0) {
|
|
3682
3696
|
block.type = "heading";
|
|
3683
3697
|
block.level = level;
|
|
@@ -3690,7 +3704,7 @@ function isChapterNumber(block, next, medianFontSize) {
|
|
|
3690
3704
|
const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _98 => _98.style, 'optionalAccess', _99 => _99.fontSize]), () => ( 0));
|
|
3691
3705
|
const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _100 => _100.text, 'optionalAccess', _101 => _101.trim, 'call', _102 => _102()]), () => ( ""));
|
|
3692
3706
|
const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _103 => _103.bbox]);
|
|
3693
|
-
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _104 => _104.text, 'optionalAccess', _105 => _105.trim, 'call', _106 => _106()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize *
|
|
3707
|
+
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _104 => _104.text, 'optionalAccess', _105 => _105.trim, 'call', _106 => _106()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunk6FW3AZWNcjs.HEADING_RATIO_H1 && text.length > 0 && text.length <= 80 && !/^[\d\s.]+$/.test(text) && !!a && !!b && a.y > b.y && a.y - (b.y + b.height) <= size * 2;
|
|
3694
3708
|
}
|
|
3695
3709
|
function mergeStackedHeadingLines(blocks, medianFontSize) {
|
|
3696
3710
|
for (let i = 0; i < blocks.length - 1; ) {
|
|
@@ -6002,16 +6016,16 @@ function isProseSpread(items) {
|
|
|
6002
6016
|
for (let i = 1; i < sorted.length; i++) {
|
|
6003
6017
|
gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
|
|
6004
6018
|
}
|
|
6005
|
-
const maxGap =
|
|
6019
|
+
const maxGap = _chunkK6WSMTVUcjs.safeMax.call(void 0, gaps);
|
|
6006
6020
|
const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
|
|
6007
6021
|
if (items.length >= 4 && maxGap < 40 && avgLen < 5) return true;
|
|
6008
|
-
const minGap =
|
|
6022
|
+
const minGap = _chunkK6WSMTVUcjs.safeMin.call(void 0, gaps);
|
|
6009
6023
|
return minGap > 0 && maxGap - minGap <= Math.max(2, maxGap * 0.15) && items.filter((i) => /^\P{L}*\p{Ll}/u.test(i.text)).length * 2 >= items.length;
|
|
6010
6024
|
}
|
|
6011
6025
|
function detectColumns(yLines) {
|
|
6012
6026
|
const allItems = yLines.flat();
|
|
6013
6027
|
if (allItems.length === 0) return null;
|
|
6014
|
-
const pageWidth =
|
|
6028
|
+
const pageWidth = _chunkK6WSMTVUcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkK6WSMTVUcjs.safeMin.call(void 0, allItems.map((i) => i.x));
|
|
6015
6029
|
if (pageWidth < 100) return null;
|
|
6016
6030
|
let bigoLineIdx = -1;
|
|
6017
6031
|
for (let i = 0; i < yLines.length; i++) {
|
|
@@ -6481,12 +6495,12 @@ function recordClipCellEdges(grids, horizontals, verticals, nonRules) {
|
|
|
6481
6495
|
}
|
|
6482
6496
|
function takeClipCellEdges(from, to) {
|
|
6483
6497
|
const e = CLIP_CELL_EDGES.get(from);
|
|
6484
|
-
if (e)
|
|
6498
|
+
if (e) _chunk6FW3AZWNcjs.CELL_EDGES.set(to, e);
|
|
6485
6499
|
}
|
|
6486
6500
|
function joinCellEdges(a, b) {
|
|
6487
|
-
const u =
|
|
6501
|
+
const u = _chunk6FW3AZWNcjs.CELL_EDGES.get(a), d = _chunk6FW3AZWNcjs.CELL_EDGES.get(b);
|
|
6488
6502
|
if (!u || !d) return;
|
|
6489
|
-
|
|
6503
|
+
_chunk6FW3AZWNcjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
|
|
6490
6504
|
}
|
|
6491
6505
|
|
|
6492
6506
|
// src/pdf/table-unit-row.ts
|
|
@@ -6502,7 +6516,7 @@ function rebuildUnitLine(items, grid) {
|
|
|
6502
6516
|
function prependUnitRow(cells, cols, line, usedItems) {
|
|
6503
6517
|
const text = cleanCellText(line.map((item) => item.text).join(""));
|
|
6504
6518
|
cells.unshift(Array.from({ length: cols }, (_, c) => ({ text: c === 0 ? text : "", colSpan: c === 0 ? cols : 1, rowSpan: 1 })));
|
|
6505
|
-
for (const cell of cells[0])
|
|
6519
|
+
for (const cell of cells[0]) _chunk6FW3AZWNcjs.CELL_EDGES.set(cell, NO_EDGES);
|
|
6506
6520
|
for (const item of line) usedItems.add(item);
|
|
6507
6521
|
}
|
|
6508
6522
|
function attachUnitRow(items, grid, cells, cols, usedItems) {
|
|
@@ -7032,7 +7046,7 @@ function recordFrameTitle(table, source, pageNum) {
|
|
|
7032
7046
|
const [label, spacer, title] = cells;
|
|
7033
7047
|
if (!/^(?:붙임|별첨|첨부|부록)\s*\d{1,3}$/.test(label.text.trim()) || spacer.text.trim() || !title.text.trim()) return;
|
|
7034
7048
|
if (cells.some((c) => {
|
|
7035
|
-
const e =
|
|
7049
|
+
const e = _chunk6FW3AZWNcjs.CELL_EDGES.get(c);
|
|
7036
7050
|
return !e || e.t || e.b || e.l || e.r;
|
|
7037
7051
|
})) return;
|
|
7038
7052
|
const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _326 => _326.fontSize]), () => ( 0));
|
|
@@ -7944,7 +7958,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
7944
7958
|
groupSizes.push(1);
|
|
7945
7959
|
}
|
|
7946
7960
|
const allY = remaining.map((i) => i.y);
|
|
7947
|
-
const pageH =
|
|
7961
|
+
const pageH = _chunkK6WSMTVUcjs.safeMax.call(void 0, allY) - _chunkK6WSMTVUcjs.safeMin.call(void 0, allY);
|
|
7948
7962
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
7949
7963
|
const sides = frameColumnTextBands(remaining, spanning, gx);
|
|
7950
7964
|
const textBlocks = [];
|
|
@@ -7960,7 +7974,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
7960
7974
|
finalTextBlocks.push(...detectListBlocks(textBlocks));
|
|
7961
7975
|
} else {
|
|
7962
7976
|
const allY = remaining.map((i) => i.y);
|
|
7963
|
-
const pageH =
|
|
7977
|
+
const pageH = _chunkK6WSMTVUcjs.safeMax.call(void 0, allY) - _chunkK6WSMTVUcjs.safeMin.call(void 0, allY);
|
|
7964
7978
|
const groups = xyCutOrder(remaining, Math.max(15, pageH * 0.03));
|
|
7965
7979
|
const textBlocks = [];
|
|
7966
7980
|
for (const group of groups) {
|
|
@@ -8285,7 +8299,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
|
|
|
8285
8299
|
blocks.push(...columnTextToBlocks(tableText, pageNum, bbox, dominantStyle(items)));
|
|
8286
8300
|
} else {
|
|
8287
8301
|
const allY = items.map((i) => i.y);
|
|
8288
|
-
const pageHeight =
|
|
8302
|
+
const pageHeight = _chunkK6WSMTVUcjs.safeMax.call(void 0, allY) - _chunkK6WSMTVUcjs.safeMin.call(void 0, allY);
|
|
8289
8303
|
const gapThreshold = Math.max(15, pageHeight * 0.03);
|
|
8290
8304
|
const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold);
|
|
8291
8305
|
for (const group of orderedGroups) {
|
|
@@ -8364,4 +8378,4 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
|
|
|
8364
8378
|
|
|
8365
8379
|
|
|
8366
8380
|
exports.OCR_DET_MODEL = OCR_DET_MODEL; exports.OCR_REC_MODEL = OCR_REC_MODEL; exports.OCR_REC_DICT = OCR_REC_DICT; exports.getOcrModelsDir = getOcrModelsDir; exports.ensureOcrModels = ensureOcrModels; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; exports.extractLines = extractLines; exports.extractImageRegions = extractImageRegions; exports.filterHiddenText = filterHiddenText; exports.collapseEvenSpacing = collapseEvenSpacing; exports.computeBBox = computeBBox; exports.dominantStyle = dominantStyle; exports.normalizeItems = normalizeItems; exports.groupByY = groupByY; exports.mergeLineSimple = mergeLineSimple; exports.WrapLexicon = WrapLexicon; exports.startsNewItem = startsNewItem; exports.wrapJoiner = wrapJoiner; exports.joinPageBreakWraps = joinPageBreakWraps; exports.splitPageBreakWraps = splitPageBreakWraps; exports.latinSoftWrap = latinSoftWrap; exports.TOC_BLOCKS = TOC_BLOCKS; exports.computeMedianFontSizeFromFreq = computeMedianFontSizeFromFreq; exports.detectHeadings = detectHeadings; exports.mergeStackedHeadingLines = mergeStackedHeadingLines; exports.detectTypographyHeadings = detectTypographyHeadings; exports.detectDocumentStyleHeadings = detectDocumentStyleHeadings; exports.detectSiblingStyleHeadings = detectSiblingStyleHeadings; exports.detectRepeatedPageLabels = detectRepeatedPageLabels; exports.detectPageLeadHeadings = detectPageLeadHeadings; exports.refineDocumentStyleHeadings = refineDocumentStyleHeadings; exports.detectMarkerHeadings = detectMarkerHeadings; exports.detectTableCaptions = detectTableCaptions; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks; exports.CLIP_TABLES = CLIP_TABLES; exports.FRAME_TITLE_BLOCKS = FRAME_TITLE_BLOCKS; exports.TABLE_COLXS = TABLE_COLXS; exports.TABLE_ROWYS = TABLE_ROWYS; exports.TABLE_TAIL = TABLE_TAIL; exports.PART_COLXS = PART_COLXS; exports.EMPTY_PARTS = EMPTY_PARTS; exports.IMAGE_CELLS = IMAGE_CELLS; exports.FILLER_CELLS = FILLER_CELLS; exports.CONT_PARTS = CONT_PARTS; exports.CELL_LINES = CELL_LINES; exports.ROW_RULES = ROW_RULES; exports.trimTrailingEmptyTableCols = trimTrailingEmptyTableCols; exports.NO_EDGES = NO_EDGES; exports.joinCellEdges = joinCellEdges; exports.FRAME_READING_UNITS = FRAME_READING_UNITS; exports.recordFrameReadingUnit = recordFrameReadingUnit; exports.restoreImageBullets = restoreImageBullets; exports.detectRightArrowRegions = detectRightArrowRegions; exports.removeSideTabs = removeSideTabs; exports.extractPageBlocksWithLines = extractPageBlocksWithLines;
|
|
8367
|
-
//# sourceMappingURL=chunk-
|
|
8381
|
+
//# sourceMappingURL=chunk-3FGHQWJP.cjs.map
|