kordoc 4.21.4 → 4.21.6

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.
Files changed (137) hide show
  1. package/README.md +5 -3
  2. package/dist/{-IBP3RM4A.js → -PYF2SQLE.js} +11 -11
  3. package/dist/{chunk-2ZYID24K.js → chunk-4GYF7QLL.js} +2 -2
  4. package/dist/{chunk-MMLYLOOV.js → chunk-6W63S5PN.js} +2 -2
  5. package/dist/{chunk-WOLREUXZ.js → chunk-767BPQJ6.js} +2 -2
  6. package/dist/{chunk-WW5CXYGM.js → chunk-7BSIBMZI.js} +3 -3
  7. package/dist/{chunk-GO7QZN2J.js → chunk-7H5MZODE.js} +52 -20
  8. package/dist/{chunk-GO7QZN2J.js.map → chunk-7H5MZODE.js.map} +1 -1
  9. package/dist/{chunk-2PLRKSH4.js → chunk-7YHL3V6Y.js} +7 -6
  10. package/dist/chunk-7YHL3V6Y.js.map +1 -0
  11. package/dist/{chunk-4UNQHMSM.js → chunk-BYFHFPFU.js} +2 -2
  12. package/dist/{chunk-JMTPUQZT.js → chunk-CBNCY2FW.js} +2892 -2727
  13. package/dist/chunk-CBNCY2FW.js.map +1 -0
  14. package/dist/{chunk-AQU7T5F5.js → chunk-CG67VRRD.js} +2891 -2726
  15. package/dist/chunk-CG67VRRD.js.map +1 -0
  16. package/dist/{chunk-NZXBOZFQ.js → chunk-D4S56ZJ3.js} +2 -2
  17. package/dist/{chunk-3X7Q5MY7.js → chunk-DCLGPCFY.js} +51 -19
  18. package/dist/{chunk-3X7Q5MY7.js.map → chunk-DCLGPCFY.js.map} +1 -1
  19. package/dist/{chunk-5LQNUCZM.cjs → chunk-DNJLSCXO.cjs} +3 -3
  20. package/dist/{chunk-5LQNUCZM.cjs.map → chunk-DNJLSCXO.cjs.map} +1 -1
  21. package/dist/{chunk-KSAF4BEU.cjs → chunk-H3J34LYX.cjs} +60 -28
  22. package/dist/chunk-H3J34LYX.cjs.map +1 -0
  23. package/dist/{chunk-UBPTX4QY.js → chunk-IT745HGE.js} +3 -3
  24. package/dist/{chunk-BNZVI4NT.js → chunk-JLPQE6XO.js} +7 -6
  25. package/dist/chunk-JLPQE6XO.js.map +1 -0
  26. package/dist/{chunk-C2K7QER2.js → chunk-L7IML7OB.js} +7 -6
  27. package/dist/chunk-L7IML7OB.js.map +1 -0
  28. package/dist/{chunk-MU3ZMGDH.js → chunk-NSNAUPBG.js} +2 -2
  29. package/dist/{chunk-FRSDLU2Z.js → chunk-NWICNM5B.js} +2 -2
  30. package/dist/{chunk-I5DBY6CO.js → chunk-OKMQZ7AJ.js} +2 -2
  31. package/dist/{chunk-ED4EV6TP.js → chunk-OLMHNZSA.js} +135 -28
  32. package/dist/chunk-OLMHNZSA.js.map +1 -0
  33. package/dist/{chunk-ABBY5G4Z.js → chunk-OSPZIIBQ.js} +2 -2
  34. package/dist/{chunk-NTKXF4BJ.cjs → chunk-QWVFNDYE.cjs} +3 -3
  35. package/dist/{chunk-NTKXF4BJ.cjs.map → chunk-QWVFNDYE.cjs.map} +1 -1
  36. package/dist/{chunk-2B7OKGDK.cjs → chunk-RDQKMXGA.cjs} +2 -2
  37. package/dist/{chunk-2B7OKGDK.cjs.map → chunk-RDQKMXGA.cjs.map} +1 -1
  38. package/dist/{chunk-DE2HO6IA.js → chunk-RI44MWSE.js} +2 -2
  39. package/dist/{chunk-XP5TUBUZ.cjs → chunk-SMJNI27Q.cjs} +42 -41
  40. package/dist/chunk-SMJNI27Q.cjs.map +1 -0
  41. package/dist/{chunk-XSB4KRYA.js → chunk-T7XK5N2O.js} +2 -2
  42. package/dist/{chunk-7VBN5D6A.js → chunk-TMUYIO4M.js} +2 -2
  43. package/dist/{chunk-5C2NFB6W.cjs → chunk-Z2TCS52O.cjs} +2895 -2730
  44. package/dist/chunk-Z2TCS52O.cjs.map +1 -0
  45. package/dist/{chunk-EE2RDJTZ.js → chunk-ZDUUAGLW.js} +2 -2
  46. package/dist/chunks-LCDLRARG.js +10 -0
  47. package/dist/cli.js +30 -30
  48. package/dist/{formula-ZOF2HAPU.js → formula-CD3IZ5A6.js} +22 -5
  49. package/dist/formula-CD3IZ5A6.js.map +1 -0
  50. package/dist/{formula-OGRBB353.cjs → formula-KG3YGA3H.cjs} +28 -11
  51. package/dist/formula-KG3YGA3H.cjs.map +1 -0
  52. package/dist/{formula-SHBDVYSF.js → formula-S6KM7YB5.js} +23 -6
  53. package/dist/formula-S6KM7YB5.js.map +1 -0
  54. package/dist/{image-ocr-4XGHFEPA.js → image-ocr-7IVTPHV7.js} +6 -6
  55. package/dist/{image-ocr-R4PIFMDY.js → image-ocr-MVHSJVOU.js} +9 -9
  56. package/dist/{image-ocr-3PB7HVFG.cjs → image-ocr-VYO5CO5F.cjs} +15 -15
  57. package/dist/{image-ocr-3PB7HVFG.cjs.map → image-ocr-VYO5CO5F.cjs.map} +1 -1
  58. package/dist/index.cjs +741 -638
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.js +126 -23
  61. package/dist/index.js.map +1 -1
  62. package/dist/mcp.js +22 -22
  63. package/dist/{model-bundle-Z7AFLFE5.js → model-bundle-VYLKXY5U.js} +5 -5
  64. package/dist/{models-IBZDCIMO.js → models-CTJJINLS.js} +5 -5
  65. package/dist/{parse-worker-v2-EKR4GWZN.js → parse-worker-v2-XY6CPTID.js} +12 -12
  66. package/dist/{parser-QUF7IMZ3.js → parser-EFJJUWFR.js} +40 -142
  67. package/dist/parser-EFJJUWFR.js.map +1 -0
  68. package/dist/{parser-6UCW24GT.js → parser-LRLWCDYI.js} +43 -145
  69. package/dist/parser-LRLWCDYI.js.map +1 -0
  70. package/dist/{parser-QZNFJQMO.cjs → parser-OYDVWW4I.cjs} +280 -382
  71. package/dist/parser-OYDVWW4I.cjs.map +1 -0
  72. package/dist/pdf-ocr-EYHIKREJ.js +18 -0
  73. package/dist/pdf-ocr-GCD7IKJA.cjs +19 -0
  74. package/dist/{pdf-ocr-KO2SCEO2.cjs.map → pdf-ocr-GCD7IKJA.cjs.map} +1 -1
  75. package/dist/pdf-ocr-GUTPYF2G.js +22 -0
  76. package/dist/{profile-io-TVZ3CKUX.js → profile-io-3Z6PFT23.js} +3 -3
  77. package/dist/{rasterize-2RC5STNH.js → rasterize-GIBOPBR3.js} +3 -3
  78. package/dist/{redact-doc-XTTWTSWY.js → redact-doc-4AID7KCY.js} +11 -11
  79. package/dist/{render-U7KDS2D4.js → render-PWSMRIBW.js} +7 -7
  80. package/dist/seal-62UIFL64.js +10 -0
  81. package/dist/{setup-5PSQE4HW.js → setup-ABGF732T.js} +3 -3
  82. package/dist/visual-KSY4PXPT.js +20 -0
  83. package/dist/{watch-2V3QI26Z.js → watch-BBEAGY4B.js} +12 -12
  84. package/package.json +1 -1
  85. package/dist/chunk-2PLRKSH4.js.map +0 -1
  86. package/dist/chunk-5C2NFB6W.cjs.map +0 -1
  87. package/dist/chunk-AQU7T5F5.js.map +0 -1
  88. package/dist/chunk-BNZVI4NT.js.map +0 -1
  89. package/dist/chunk-C2K7QER2.js.map +0 -1
  90. package/dist/chunk-ED4EV6TP.js.map +0 -1
  91. package/dist/chunk-JMTPUQZT.js.map +0 -1
  92. package/dist/chunk-KSAF4BEU.cjs.map +0 -1
  93. package/dist/chunk-XP5TUBUZ.cjs.map +0 -1
  94. package/dist/chunks-PYPJY7PF.js +0 -10
  95. package/dist/formula-OGRBB353.cjs.map +0 -1
  96. package/dist/formula-SHBDVYSF.js.map +0 -1
  97. package/dist/formula-ZOF2HAPU.js.map +0 -1
  98. package/dist/parser-6UCW24GT.js.map +0 -1
  99. package/dist/parser-QUF7IMZ3.js.map +0 -1
  100. package/dist/parser-QZNFJQMO.cjs.map +0 -1
  101. package/dist/pdf-ocr-7FM6F3E5.js +0 -18
  102. package/dist/pdf-ocr-KO2SCEO2.cjs +0 -19
  103. package/dist/pdf-ocr-UCBN5CQE.js +0 -22
  104. package/dist/seal-MWFG6VSV.js +0 -10
  105. package/dist/visual-CEMBA3ZT.js +0 -20
  106. /package/dist/{-IBP3RM4A.js.map → -PYF2SQLE.js.map} +0 -0
  107. /package/dist/{chunk-2ZYID24K.js.map → chunk-4GYF7QLL.js.map} +0 -0
  108. /package/dist/{chunk-MMLYLOOV.js.map → chunk-6W63S5PN.js.map} +0 -0
  109. /package/dist/{chunk-WOLREUXZ.js.map → chunk-767BPQJ6.js.map} +0 -0
  110. /package/dist/{chunk-WW5CXYGM.js.map → chunk-7BSIBMZI.js.map} +0 -0
  111. /package/dist/{chunk-4UNQHMSM.js.map → chunk-BYFHFPFU.js.map} +0 -0
  112. /package/dist/{chunk-NZXBOZFQ.js.map → chunk-D4S56ZJ3.js.map} +0 -0
  113. /package/dist/{chunk-UBPTX4QY.js.map → chunk-IT745HGE.js.map} +0 -0
  114. /package/dist/{chunk-MU3ZMGDH.js.map → chunk-NSNAUPBG.js.map} +0 -0
  115. /package/dist/{chunk-FRSDLU2Z.js.map → chunk-NWICNM5B.js.map} +0 -0
  116. /package/dist/{chunk-I5DBY6CO.js.map → chunk-OKMQZ7AJ.js.map} +0 -0
  117. /package/dist/{chunk-ABBY5G4Z.js.map → chunk-OSPZIIBQ.js.map} +0 -0
  118. /package/dist/{chunk-DE2HO6IA.js.map → chunk-RI44MWSE.js.map} +0 -0
  119. /package/dist/{chunk-XSB4KRYA.js.map → chunk-T7XK5N2O.js.map} +0 -0
  120. /package/dist/{chunk-7VBN5D6A.js.map → chunk-TMUYIO4M.js.map} +0 -0
  121. /package/dist/{chunk-EE2RDJTZ.js.map → chunk-ZDUUAGLW.js.map} +0 -0
  122. /package/dist/{chunks-PYPJY7PF.js.map → chunks-LCDLRARG.js.map} +0 -0
  123. /package/dist/{image-ocr-4XGHFEPA.js.map → image-ocr-7IVTPHV7.js.map} +0 -0
  124. /package/dist/{image-ocr-R4PIFMDY.js.map → image-ocr-MVHSJVOU.js.map} +0 -0
  125. /package/dist/{model-bundle-Z7AFLFE5.js.map → model-bundle-VYLKXY5U.js.map} +0 -0
  126. /package/dist/{models-IBZDCIMO.js.map → models-CTJJINLS.js.map} +0 -0
  127. /package/dist/{parse-worker-v2-EKR4GWZN.js.map → parse-worker-v2-XY6CPTID.js.map} +0 -0
  128. /package/dist/{pdf-ocr-7FM6F3E5.js.map → pdf-ocr-EYHIKREJ.js.map} +0 -0
  129. /package/dist/{pdf-ocr-UCBN5CQE.js.map → pdf-ocr-GUTPYF2G.js.map} +0 -0
  130. /package/dist/{profile-io-TVZ3CKUX.js.map → profile-io-3Z6PFT23.js.map} +0 -0
  131. /package/dist/{rasterize-2RC5STNH.js.map → rasterize-GIBOPBR3.js.map} +0 -0
  132. /package/dist/{redact-doc-XTTWTSWY.js.map → redact-doc-4AID7KCY.js.map} +0 -0
  133. /package/dist/{render-U7KDS2D4.js.map → render-PWSMRIBW.js.map} +0 -0
  134. /package/dist/{seal-MWFG6VSV.js.map → seal-62UIFL64.js.map} +0 -0
  135. /package/dist/{setup-5PSQE4HW.js.map → setup-ABGF732T.js.map} +0 -0
  136. /package/dist/{visual-CEMBA3ZT.js.map → visual-KSY4PXPT.js.map} +0 -0
  137. /package/dist/{watch-2V3QI26Z.js.map → watch-BBEAGY4B.js.map} +0 -0
package/README.md CHANGED
@@ -11,7 +11,7 @@ HWP 3.x·5.x, HWPX, HWPML, PDF, XLS·XLSX, DOCX, PPTX, PNG·JPG·WebP를 Markdow
11
11
 
12
12
  [English](README-EN.md) · [상세 사용법](docs/usage.md) · [벤치마크](docs/benchmarks.md) · [변경 이력](CHANGELOG.md)
13
13
 
14
- - 📊 **PDF 공개 벤치 종합 0.960** — opendataloader-bench 200문서. 공개 12개 파서 비교 1위(2026-09-29 기록). [측정 조건](docs/benchmarks.md)
14
+ - 📊 **PDF 공개 벤치 종합 0.963** — opendataloader-bench 200문서. 공개 12개 파서 비교 1위(2026-09-29 기록). [측정 조건](docs/benchmarks.md)
15
15
  - 🇰🇷 **한국 공문서 표 구조 100%** — 원본 HWPX 2,286문서의 보이는 표 **9,865개 전부 구조 일치**. [4.18.8 검증](docs/release-4.18.8.json)
16
16
 
17
17
  [![Kordoc 활용하기 — 영상 보기](./docs/video-demo.jpg)](https://youtu.be/Q13GmgDcIw0)
@@ -109,14 +109,16 @@ await writeFile("보고서.hwpx", Buffer.from(hwpx))
109
109
 
110
110
  표 구조 점수와 셀 내용·화면 재현은 별도 지표입니다. 채점 범위·제외 기준·OCR 결과는 [벤치마크 상세](docs/benchmarks.md), 실제 게시 검증은 [4.18.8 기록](docs/release-4.18.8.json)에 있습니다.
111
111
 
112
- 외부 PDF 벤치 **opendataloader-bench 200문서**는 4.18.6 별도 측정에서 기본값 종합 **0.960**, OCR 끔 **0.937**입니다. [옵션별 결과와 재현 방법](docs/benchmarks.md#pdf--markdown--opendataloader-bench)
112
+ 외부 PDF 벤치 **opendataloader-bench 200문서**는 4.21.5 별도 측정에서 기본값 종합 **0.963**, OCR 끔 **0.939**입니다. [옵션별 결과와 재현 방법](docs/benchmarks.md#pdf--markdown--opendataloader-bench)
113
113
 
114
114
  ## 최근 업데이트
115
115
 
116
- 최신 배포: **[4.21.4](https://github.com/chrisryugj/kordoc/releases/tag/v4.21.4)** · 2026-10-09
116
+ 최신 배포: **[4.21.6](https://github.com/chrisryugj/kordoc/releases/tag/v4.21.6)** · 2026-10-09
117
117
 
118
118
  | 버전 | 주요 변경 |
119
119
  | --- | --- |
120
+ | 4.21.6 | 연락처 표 부서별 병합·여러 사람 칸 분할(PDF 표 구조 일치 97.94→97.98%), XLSX·XLS 200열 밖 칸 유실 수리, HWP3 포함 그림 추출, 수식 OCR LaTeX 명령 쪼개기·영역 상한 수리, PPTX 서식 트랙·코퍼스 보강(HWP3 75·서식 58·rhwp 230) |
121
+ | 4.21.5 | PDF 품질 묶음 — OCR 두 단 가짜 표(#141 부작용)·그림 OCR 라벨 묶음·한 자리 눈금, 주소 링크·벡터 차트 값 축·단 끝줄·각주 순서 (ODL 기본 0.958 → 0.963, 문서별 하락 0) · 개조식·보고서 요약 상자가 md→hwpx→md→hwpx 왕복에서 유지 |
120
122
  | 4.21.4 | MCP `fill_form` 값 파일 입력 `fields_file`(값이 대화에 안 남고 응답은 글자 수만), 전 벤치 묶음 러너·문서별 비교기 `bench/suite.mjs` |
121
123
  | 4.21.3 | PDF 수식 OCR 의 짝 없는 `\left`·`\right` 정리 |
122
124
  | 4.21.2 | 개조식 제목 뒤 요약이 1×1 요약 상자로(종전 ※ 참고)·요약 3줄·한 문장 검사, HWP3 중첩 한도·암호 HWPX 누적 압축 해제 상한 |
@@ -54,17 +54,17 @@ import {
54
54
  unknownFontWarnings,
55
55
  usesGaejosikMunche,
56
56
  validateHwpx
57
- } from "./chunk-ED4EV6TP.js";
57
+ } from "./chunk-OLMHNZSA.js";
58
58
  import {
59
59
  blocksToPages
60
- } from "./chunk-2ZYID24K.js";
60
+ } from "./chunk-4GYF7QLL.js";
61
61
  import {
62
62
  applySplices,
63
63
  buildParagraphSplices,
64
64
  buildRangeSplices,
65
65
  placeSealHwpx,
66
66
  scanSectionXml
67
- } from "./chunk-WW5CXYGM.js";
67
+ } from "./chunk-7BSIBMZI.js";
68
68
  import {
69
69
  DEFAULT_REDACT_RULES,
70
70
  redactMarkdown,
@@ -72,7 +72,7 @@ import {
72
72
  } from "./chunk-3WSNLH4B.js";
73
73
  import {
74
74
  blocksToChunks
75
- } from "./chunk-MMLYLOOV.js";
75
+ } from "./chunk-6W63S5PN.js";
76
76
  import {
77
77
  SPACE_EM_FIXED,
78
78
  SPACE_EM_FONT,
@@ -97,20 +97,20 @@ import {
97
97
  renderSceneToHtml,
98
98
  simulateWrap,
99
99
  simulateWrapKeepWord
100
- } from "./chunk-2PLRKSH4.js";
100
+ } from "./chunk-7YHL3V6Y.js";
101
101
  import "./chunk-7FCNOKOR.js";
102
- import "./chunk-DE2HO6IA.js";
102
+ import "./chunk-RI44MWSE.js";
103
103
  import "./chunk-VQFA55IC.js";
104
- import "./chunk-NZXBOZFQ.js";
104
+ import "./chunk-D4S56ZJ3.js";
105
105
  import {
106
106
  blocksToMarkdown,
107
107
  flattenLayoutTables,
108
108
  hasStructuredCellContent
109
- } from "./chunk-BNZVI4NT.js";
110
- import "./chunk-EE2RDJTZ.js";
109
+ } from "./chunk-JLPQE6XO.js";
110
+ import "./chunk-ZDUUAGLW.js";
111
111
  import {
112
112
  VERSION
113
- } from "./chunk-FRSDLU2Z.js";
113
+ } from "./chunk-NWICNM5B.js";
114
114
  export {
115
115
  AGENCY_COMMON_NAME,
116
116
  BUILTIN_TEMPLATES,
@@ -204,4 +204,4 @@ export {
204
204
  usesGaejosikMunche,
205
205
  validateHwpx
206
206
  };
207
- //# sourceMappingURL=-IBP3RM4A.js.map
207
+ //# sourceMappingURL=-PYF2SQLE.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  blocksToMarkdown
4
- } from "./chunk-BNZVI4NT.js";
4
+ } from "./chunk-JLPQE6XO.js";
5
5
 
6
6
  // src/page-markdown.ts
7
7
  function blocksToPages(blocks, render = blocksToMarkdown) {
@@ -29,4 +29,4 @@ function blocksToPages(blocks, render = blocksToMarkdown) {
29
29
  export {
30
30
  blocksToPages
31
31
  };
32
- //# sourceMappingURL=chunk-2ZYID24K.js.map
32
+ //# sourceMappingURL=chunk-4GYF7QLL.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  assignTableIds,
4
4
  blocksToMarkdown
5
- } from "./chunk-BNZVI4NT.js";
5
+ } from "./chunk-JLPQE6XO.js";
6
6
 
7
7
  // src/chunks.ts
8
8
  var LIST_MARKER_RE = /^(?:[□■◇◆○◎●◦ㅇ•▪▸▶※-]|\d{1,3}[.)]|[가나다라마바사아자차카타파하][.)]|\([가나다라마바사아자차카타파하0-9]{1,3}\)|[①-⑳㉮-㉻㈎-㈛])\s/;
@@ -82,4 +82,4 @@ function blocksToChunks(blocks, options) {
82
82
  export {
83
83
  blocksToChunks
84
84
  };
85
- //# sourceMappingURL=chunk-MMLYLOOV.js.map
85
+ //# sourceMappingURL=chunk-6W63S5PN.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  blocksToMarkdown
3
- } from "./chunk-C2K7QER2.js";
3
+ } from "./chunk-L7IML7OB.js";
4
4
 
5
5
  // src/page-markdown.ts
6
6
  function blocksToPages(blocks, render = blocksToMarkdown) {
@@ -167,4 +167,4 @@ export {
167
167
  inlineImagesIntoMarkdown,
168
168
  blocksToPages
169
169
  };
170
- //# sourceMappingURL=chunk-WOLREUXZ.js.map
170
+ //# sourceMappingURL=chunk-767BPQJ6.js.map
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  parseRenderStyles
4
- } from "./chunk-NZXBOZFQ.js";
4
+ } from "./chunk-D4S56ZJ3.js";
5
5
  import {
6
6
  KordocError,
7
7
  precheckZipSize
8
- } from "./chunk-FRSDLU2Z.js";
8
+ } from "./chunk-NWICNM5B.js";
9
9
 
10
10
  // src/form/seal.ts
11
11
  import JSZip from "jszip";
@@ -1076,4 +1076,4 @@ export {
1076
1076
  patchZipEntries,
1077
1077
  placeSealHwpx
1078
1078
  };
1079
- //# sourceMappingURL=chunk-WW5CXYGM.js.map
1079
+ //# sourceMappingURL=chunk-7BSIBMZI.js.map
@@ -3,8 +3,9 @@ import {
3
3
  disableOrtTelemetry
4
4
  } from "./chunk-6H25SXDI.js";
5
5
  import {
6
+ UNRULED_REGION_TABLES,
6
7
  extractPageBlocksWithLines
7
- } from "./chunk-AQU7T5F5.js";
8
+ } from "./chunk-CG67VRRD.js";
8
9
  import {
9
10
  OCR_DET_MODEL,
10
11
  OCR_REC_DICT,
@@ -12,10 +13,10 @@ import {
12
13
  ensureOcrModels,
13
14
  getOcrModelsDir,
14
15
  parseCharacterDict
15
- } from "./chunk-MU3ZMGDH.js";
16
+ } from "./chunk-NSNAUPBG.js";
16
17
  import {
17
18
  OPTIONAL_DEP_INSTALL_HINT
18
- } from "./chunk-FRSDLU2Z.js";
19
+ } from "./chunk-NWICNM5B.js";
19
20
 
20
21
  // src/ocr/ruling-lines.ts
21
22
  var INK_LUMA_MAX = 205;
@@ -1947,7 +1948,14 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
1947
1948
  let own = items.filter((it) => inside(it, r));
1948
1949
  const near = reads[k];
1949
1950
  if (near?.length && meanConfidence(near) > meanConfidence(own)) own = near;
1950
- return own.length ? ocrItemsToBlocks(own, pageNo, pdfW, pdfH, scale, ruling && rulingToPdfLines(ruling, scale, pdfH), detectTables) : [];
1951
+ if (!own.length) return [];
1952
+ const blocks = ocrItemsToBlocks(own, pageNo, pdfW, pdfH, scale, ruling && rulingToPdfLines(ruling, scale, pdfH), detectTables, void 0, true);
1953
+ const x1 = r.x1 * scale - 2, x2 = r.x2 * scale + 2, y1 = (pdfH - r.y2) * scale - 2, y2 = (pdfH - r.y1) * scale + 2;
1954
+ const columnRules = ruling?.verticals.filter((s) => Math.min(s.x1, s.x2) >= x1 && Math.max(s.x1, s.x2) <= x2 && Math.min(s.y1, s.y2) >= y1 && Math.max(s.y1, s.y2) <= y2).length ?? 0;
1955
+ if (columnRules < 2) {
1956
+ for (const b of blocks) if (b.type === "table") UNRULED_REGION_TABLES.add(b);
1957
+ }
1958
+ return blocks;
1951
1959
  });
1952
1960
  }
1953
1961
  if (vectorOps) return ocrItemsToBlocks(items, pageNo, pdfW, pdfH, scale, void 0, detectTables, vectorOps);
@@ -2003,28 +2011,52 @@ async function closerReads(rgba, rw, rh, pdfH, hi, regions, engine) {
2003
2011
  }
2004
2012
  return out;
2005
2013
  }
2006
- function groupOcrLines(items) {
2014
+ var proseBox = (b) => {
2015
+ const t = b.text.replace(/\s/g, "");
2016
+ return b.w >= b.h * 7 && (t.match(/\d/g)?.length ?? 0) < t.length * 0.3;
2017
+ };
2018
+ function groupOcrLines(items, figureRegion = false) {
2007
2019
  const order = items.map((_, i) => i).sort((a, b) => items[a].y + items[a].h / 2 - (items[b].y + items[b].h / 2));
2020
+ const accepts = (l, i) => {
2021
+ const it = items[i], c = it.y + it.h / 2;
2022
+ const lc = l.reduce((s, j) => s + items[j].y + items[j].h / 2, 0) / l.length;
2023
+ const minH = Math.min(it.h, ...l.map((j) => items[j].h));
2024
+ if (Math.abs(c - lc) > minH / 2) return false;
2025
+ const hs = l.map((j) => items[j].h).sort((a, b) => a - b), med = hs[hs.length >> 1];
2026
+ const weak = it.confidence < 0.8 || l.some((j) => items[j].confidence < 0.8);
2027
+ if (weak && Math.max(it.h, med) > Math.min(it.h, med) * 2) return false;
2028
+ let nearLong = 0, gap = Infinity;
2029
+ for (const j of l) {
2030
+ const o = items[j];
2031
+ const ov = Math.min(it.x + it.w, o.x + o.w) - Math.max(it.x, o.x);
2032
+ if (ov >= Math.min(it.w, o.w) / 2) return false;
2033
+ gap = Math.min(gap, Math.max(0, -ov));
2034
+ if (proseBox(it) && proseBox(o)) nearLong = Math.min(nearLong || Infinity, Math.max(0, -ov) / Math.min(it.h, o.h));
2035
+ }
2036
+ if (figureRegion && gap > 8 * minH && Math.abs(c - lc) > minH * 0.35) return false;
2037
+ return nearLong <= 5;
2038
+ };
2008
2039
  const lines = [];
2009
2040
  for (const i of order) {
2010
- const it = items[i], c = it.y + it.h / 2;
2011
- const line = lines.find((l) => {
2012
- const lc = l.reduce((s, j) => s + items[j].y + items[j].h / 2, 0) / l.length;
2013
- const minH = Math.min(it.h, ...l.map((j) => items[j].h));
2014
- return Math.abs(c - lc) <= minH / 2 && l.every((j) => {
2015
- const ov = Math.min(it.x + it.w, items[j].x + items[j].w) - Math.max(it.x, items[j].x);
2016
- return ov < Math.min(it.w, items[j].w) / 2;
2017
- });
2018
- });
2041
+ const line = lines.find((l) => accepts(l, i));
2019
2042
  if (line) line.push(i);
2020
2043
  else lines.push([i]);
2021
2044
  }
2022
- return lines;
2045
+ for (let k = 0; k < lines.length; k++) {
2046
+ if (lines[k].length !== 1) continue;
2047
+ const i = lines[k][0];
2048
+ const target = lines.find((l, m) => m !== k && l.length > 0 && accepts(l, i));
2049
+ if (target) {
2050
+ target.push(i);
2051
+ lines[k] = [];
2052
+ }
2053
+ }
2054
+ return lines.filter((l) => l.length > 0);
2023
2055
  }
2024
- function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, detectTables = true, opList = { fnArray: [], argsArray: [] }) {
2056
+ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, detectTables = true, opList = { fnArray: [], argsArray: [] }, figureRegion = false) {
2025
2057
  const bottoms = items.map((it) => it.y + it.h);
2026
2058
  const xs = items.map((it) => ({ x: it.x, r: it.x + it.w, space: false }));
2027
- for (const line of groupOcrLines(items)) {
2059
+ for (const line of groupOcrLines(items, figureRegion)) {
2028
2060
  if (line.length < 2) continue;
2029
2061
  const sorted = line.map((j) => items[j].y + items[j].h).sort((a, b) => a - b);
2030
2062
  for (const j of line) bottoms[j] = sorted[Math.floor(sorted.length / 2)];
@@ -2039,7 +2071,7 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
2039
2071
  }
2040
2072
  }
2041
2073
  const norm = items.map((it, i) => {
2042
- const h = it.h / scale;
2074
+ const h = (figureRegion ? Math.max(1, bottoms[i] - it.y) : it.h) / scale;
2043
2075
  return {
2044
2076
  text: it.text,
2045
2077
  x: Math.round(xs[i].x / scale),
@@ -2048,7 +2080,7 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
2048
2080
  w: Math.round((xs[i].r - xs[i].x) / scale),
2049
2081
  h: Math.round(h),
2050
2082
  // 박스는 잉크 외곽(engine tightBoxes) — 한글 줄 잉크 높이 ≈ 0.9em
2051
- fontSize: Math.max(1, Math.round(h / 0.9)),
2083
+ fontSize: Math.max(1, Math.round(it.h / scale / 0.9)),
2052
2084
  fontName: "ocr",
2053
2085
  isHidden: false,
2054
2086
  ...xs[i].space ? { hasSpaceBefore: true } : {}
@@ -2101,4 +2133,4 @@ export {
2101
2133
  groupOcrLines,
2102
2134
  ocrItemsToBlocks
2103
2135
  };
2104
- //# sourceMappingURL=chunk-GO7QZN2J.js.map
2136
+ //# sourceMappingURL=chunk-7H5MZODE.js.map