kordoc 4.24.46 → 4.24.48
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/NOTICE +21 -0
- package/README.md +5 -5
- package/dist/{-N45T7D3V.js → -3EMVBTE7.js} +22 -22
- package/dist/{chunk-FQP6MKZY.js → chunk-3UY7ARXP.js} +2 -2
- package/dist/{chunk-NJEMXMHP.js → chunk-4N2ESXR2.js} +2 -2
- package/dist/{chunk-YV6BBJXJ.js → chunk-6YUMHSBG.js} +3 -3
- package/dist/{chunk-7L7VO2L2.js → chunk-7EL6BCO5.js} +2 -2
- package/dist/{chunk-B2VBXPXH.js → chunk-7F5SKDUG.js} +2 -2
- package/dist/{chunk-MYLKNYSY.cjs → chunk-A6EOKPKG.cjs} +85 -50
- package/dist/chunk-A6EOKPKG.cjs.map +1 -0
- package/dist/{chunk-QF7UXLA2.js → chunk-AC7FZDVP.js} +2 -2
- package/dist/{chunk-VL7UACGR.js → chunk-D4TKVZKB.js} +3 -3
- package/dist/{chunk-FRVE5JWE.js → chunk-D7SOY3VR.js} +40 -5
- package/dist/chunk-D7SOY3VR.js.map +1 -0
- package/dist/{chunk-5WR335MB.js → chunk-E47LO7XG.js} +11 -11
- package/dist/{chunk-GKD7J45E.js → chunk-E5RJLP2S.js} +5 -5
- package/dist/{chunk-NJBY4HME.js → chunk-FQMPHPHE.js} +2 -2
- package/dist/{chunk-ZWOUNYCK.js → chunk-GFWCBYAI.js} +2 -2
- package/dist/chunk-GOYAJVR6.js +120 -0
- package/dist/chunk-GOYAJVR6.js.map +1 -0
- package/dist/{chunk-NWABYDS5.js → chunk-HW3DZ7TY.js} +7 -7
- package/dist/{chunk-SHYDVLFD.js → chunk-JC2TMUU5.js} +6 -6
- package/dist/{chunk-WBBTXX7T.js → chunk-KTGOULMH.js} +192 -17
- package/dist/chunk-KTGOULMH.js.map +1 -0
- package/dist/{chunk-X7RBVVDC.cjs → chunk-LBH4KAQM.cjs} +3 -2
- package/dist/chunk-LBH4KAQM.cjs.map +1 -0
- package/dist/{chunk-X2UNKZT4.cjs → chunk-LHZL52HO.cjs} +3 -3
- package/dist/{chunk-X2UNKZT4.cjs.map → chunk-LHZL52HO.cjs.map} +1 -1
- package/dist/{chunk-CUYBCAYZ.cjs → chunk-MHAPDR6T.cjs} +60 -60
- package/dist/{chunk-CUYBCAYZ.cjs.map → chunk-MHAPDR6T.cjs.map} +1 -1
- package/dist/{chunk-QIRUP2IN.js → chunk-MHLTZ3VI.js} +8 -5
- package/dist/chunk-MHLTZ3VI.js.map +1 -0
- package/dist/{chunk-JISE24L4.js → chunk-MYIRYP6D.js} +10 -10
- package/dist/{chunk-4IIMCEUZ.js → chunk-N6B5BINC.js} +6 -6
- package/dist/{chunk-HEH5WH2Q.js → chunk-NLPIXQOV.js} +2 -2
- package/dist/{chunk-JRYQERD5.js → chunk-OBNOOHAW.js} +2 -2
- package/dist/chunk-OBNOOHAW.js.map +1 -0
- package/dist/{chunk-BOQQO7X7.js → chunk-OO4DHHTG.js} +8 -5
- package/dist/chunk-OO4DHHTG.js.map +1 -0
- package/dist/{chunk-MIJ7EO56.js → chunk-OQPIN2OY.js} +2 -2
- package/dist/{chunk-RNWOGZWU.js → chunk-OUUI7I5V.js} +193 -18
- package/dist/chunk-OUUI7I5V.js.map +1 -0
- package/dist/chunk-PHU4VSNF.js +119 -0
- package/dist/chunk-PHU4VSNF.js.map +1 -0
- package/dist/{chunk-BY25KD5A.js → chunk-QJBVP2BS.js} +2 -2
- package/dist/{chunk-TXEWEFWH.js → chunk-QM65ELZE.js} +39 -4
- package/dist/chunk-QM65ELZE.js.map +1 -0
- package/dist/{chunk-XEMHC53A.cjs → chunk-QOBWIFJA.cjs} +282 -107
- package/dist/chunk-QOBWIFJA.cjs.map +1 -0
- package/dist/{chunk-BVLUNWRF.js → chunk-REERG473.js} +6 -6
- package/dist/{chunk-QDBOIQQI.js → chunk-SHYNOLL6.js} +2 -2
- package/dist/{chunk-MZX36SAT.js → chunk-SI3GXM7Z.js} +2 -2
- package/dist/chunk-SJXTCW7I.cjs +122 -0
- package/dist/chunk-SJXTCW7I.cjs.map +1 -0
- package/dist/{chunk-V5EDKEW3.js → chunk-SUOJQHIN.js} +6 -6
- package/dist/{chunk-D46JZLFC.cjs → chunk-TOOOWCKQ.cjs} +98 -98
- package/dist/{chunk-D46JZLFC.cjs.map → chunk-TOOOWCKQ.cjs.map} +1 -1
- package/dist/{chunk-VKVDMH7X.js → chunk-TQ4QOCKT.js} +2 -1
- package/dist/chunk-TQ4QOCKT.js.map +1 -0
- package/dist/{chunk-5O5BKPET.js → chunk-UJ3TZF4Y.js} +2 -2
- package/dist/{chunk-U556XJW6.js → chunk-UN2F6EKQ.js} +2 -1
- package/dist/chunk-UN2F6EKQ.js.map +1 -0
- package/dist/{chunk-7GM5ZLTC.cjs → chunk-VXHZPUMS.cjs} +2 -2
- package/dist/{chunk-7GM5ZLTC.cjs.map → chunk-VXHZPUMS.cjs.map} +1 -1
- package/dist/{chunk-X5APVAKP.js → chunk-WICMTKWR.js} +3 -3
- package/dist/{chunk-MVFUAMCR.js → chunk-WO6PZMMB.js} +2 -2
- package/dist/{chunk-KVRW3522.js → chunk-WVUR3HYW.js} +115 -43
- package/dist/chunk-WVUR3HYW.js.map +1 -0
- package/dist/{chunk-6A36TKBX.cjs → chunk-YFTD6WOP.cjs} +11 -8
- package/dist/chunk-YFTD6WOP.cjs.map +1 -0
- package/dist/chunks-QTVEFJOS.js +11 -0
- package/dist/cli.js +46 -45
- package/dist/cli.js.map +1 -1
- package/dist/{formula-C6ODQNSO.cjs → formula-7RJOEJHX.cjs} +9 -9
- package/dist/{formula-C6ODQNSO.cjs.map → formula-7RJOEJHX.cjs.map} +1 -1
- package/dist/{formula-K6TX7MPD.js → formula-DUHNPES2.js} +4 -4
- package/dist/{formula-NSUMSGTH.js → formula-XNCKOV6K.js} +3 -3
- package/dist/generator-6BFIABTF.js +10 -0
- package/dist/generator-XJLIBYDJ.js +17 -0
- package/dist/generator-XXVCF6TG.cjs +11 -0
- package/dist/{generator-QQ43CWBH.cjs.map → generator-XXVCF6TG.cjs.map} +1 -1
- package/dist/{hancom-MFD3WGNU.cjs → hancom-7F53R77A.cjs} +5 -5
- package/dist/{hancom-MFD3WGNU.cjs.map → hancom-7F53R77A.cjs.map} +1 -1
- package/dist/{hancom-HXONTKAF.js → hancom-D4E3WBPI.js} +2 -2
- package/dist/{hancom-24ZZS7G6.js → hancom-IPF6HM5F.js} +2 -2
- package/dist/{image-ocr-C4PANEFS.js → image-ocr-NFCTNIL5.js} +7 -7
- package/dist/{image-ocr-UWM2JO4F.js → image-ocr-PYOXD5K4.js} +10 -10
- package/dist/{image-ocr-44UBGI4O.cjs → image-ocr-ZLAPJMES.cjs} +27 -27
- package/dist/{image-ocr-44UBGI4O.cjs.map → image-ocr-ZLAPJMES.cjs.map} +1 -1
- package/dist/index.cjs +1601 -1529
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +109 -37
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +37 -37
- package/dist/memo-CNW6ZJFE.js +17 -0
- package/dist/{model-bundle-WAPNK77M.js → model-bundle-TIHWFIN5.js} +5 -5
- package/dist/{models-RVSU27QC.js → models-YBHBEM6J.js} +5 -5
- package/dist/{parse-worker-v2-SV4YBNJU.js → parse-worker-v2-Q7ST3SDO.js} +24 -23
- package/dist/parse-worker-v2-Q7ST3SDO.js.map +1 -0
- package/dist/{parser-N7XYSGJF.js → parser-7JSQYNLS.js} +377 -36
- package/dist/parser-7JSQYNLS.js.map +1 -0
- package/dist/{parser-QOBNISNN.cjs → parser-A76QS3VJ.cjs} +668 -327
- package/dist/parser-A76QS3VJ.cjs.map +1 -0
- package/dist/{parser-YYGB5XWO.js → parser-V25GYLBJ.js} +374 -33
- package/dist/parser-V25GYLBJ.js.map +1 -0
- package/dist/pdf-ocr-5YCDSSLG.cjs +42 -0
- package/dist/{pdf-ocr-EEMKTX5R.cjs.map → pdf-ocr-5YCDSSLG.cjs.map} +1 -1
- package/dist/{pdf-ocr-WXNQMLU2.js → pdf-ocr-GEAW23FB.js} +9 -9
- package/dist/{pdf-ocr-GFQNIMQG.js → pdf-ocr-IJXT6ZJR.js} +6 -6
- package/dist/{profile-io-EKLAEN7W.js → profile-io-Y7SMMS2R.js} +3 -3
- package/dist/{rasterize-IXUL6Y5W.js → rasterize-MLEHT6PU.js} +3 -3
- package/dist/{redact-doc-JUTJ3SOJ.js → redact-doc-GPO2UTTJ.js} +22 -22
- package/dist/{render-YPFJPUNC.js → render-TNWY53S4.js} +13 -13
- package/dist/{rewrite-fallback-H6ORRXXB.js → rewrite-fallback-AHGTN757.js} +14 -14
- package/dist/seal-7HBR3HBQ.js +16 -0
- package/dist/{setup-R2HZNN6F.js → setup-TJ57DQ6I.js} +3 -3
- package/dist/to-hwpx-6JF6Q2TZ.js +21 -0
- package/dist/{to-hwpx-LRYNPYMS.js → to-hwpx-DLVARUND.js} +5 -5
- package/dist/to-hwpx-XLQUY2L2.cjs +16 -0
- package/dist/{to-hwpx-WHCXM2SA.cjs.map → to-hwpx-XLQUY2L2.cjs.map} +1 -1
- package/dist/visual-VBDQUUKP.js +37 -0
- package/dist/{watch-ETBDIPSJ.js → watch-6CHDQ355.js} +23 -23
- package/package.json +3 -2
- package/dist/chunk-6A36TKBX.cjs.map +0 -1
- package/dist/chunk-BOQQO7X7.js.map +0 -1
- package/dist/chunk-FRVE5JWE.js.map +0 -1
- package/dist/chunk-G2T6PBYW.js +0 -31
- package/dist/chunk-G2T6PBYW.js.map +0 -1
- package/dist/chunk-JRYQERD5.js.map +0 -1
- package/dist/chunk-KVRW3522.js.map +0 -1
- package/dist/chunk-MYLKNYSY.cjs.map +0 -1
- package/dist/chunk-QIRUP2IN.js.map +0 -1
- package/dist/chunk-RNWOGZWU.js.map +0 -1
- package/dist/chunk-TXEWEFWH.js.map +0 -1
- package/dist/chunk-U556XJW6.js.map +0 -1
- package/dist/chunk-UHCEBHIY.js +0 -32
- package/dist/chunk-UHCEBHIY.js.map +0 -1
- package/dist/chunk-VKVDMH7X.js.map +0 -1
- package/dist/chunk-WBBTXX7T.js.map +0 -1
- package/dist/chunk-X7RBVVDC.cjs.map +0 -1
- package/dist/chunk-XEMHC53A.cjs.map +0 -1
- package/dist/chunk-ZRKB6EVS.cjs +0 -31
- package/dist/chunk-ZRKB6EVS.cjs.map +0 -1
- package/dist/chunks-4ERKEYKW.js +0 -11
- package/dist/generator-OHDWVKTZ.js +0 -10
- package/dist/generator-QQ43CWBH.cjs +0 -11
- package/dist/generator-SEH6W2LS.js +0 -17
- package/dist/memo-WOHINE33.js +0 -17
- package/dist/parse-worker-v2-SV4YBNJU.js.map +0 -1
- package/dist/parser-N7XYSGJF.js.map +0 -1
- package/dist/parser-QOBNISNN.cjs.map +0 -1
- package/dist/parser-YYGB5XWO.js.map +0 -1
- package/dist/pdf-ocr-EEMKTX5R.cjs +0 -42
- package/dist/seal-J3JWCKI6.js +0 -16
- package/dist/to-hwpx-WHCXM2SA.cjs +0 -16
- package/dist/to-hwpx-WWWZ7USZ.js +0 -21
- package/dist/visual-3XBGXVFX.js +0 -37
- /package/dist/{-N45T7D3V.js.map → -3EMVBTE7.js.map} +0 -0
- /package/dist/{chunk-FQP6MKZY.js.map → chunk-3UY7ARXP.js.map} +0 -0
- /package/dist/{chunk-NJEMXMHP.js.map → chunk-4N2ESXR2.js.map} +0 -0
- /package/dist/{chunk-YV6BBJXJ.js.map → chunk-6YUMHSBG.js.map} +0 -0
- /package/dist/{chunk-7L7VO2L2.js.map → chunk-7EL6BCO5.js.map} +0 -0
- /package/dist/{chunk-B2VBXPXH.js.map → chunk-7F5SKDUG.js.map} +0 -0
- /package/dist/{chunk-QF7UXLA2.js.map → chunk-AC7FZDVP.js.map} +0 -0
- /package/dist/{chunk-VL7UACGR.js.map → chunk-D4TKVZKB.js.map} +0 -0
- /package/dist/{chunk-5WR335MB.js.map → chunk-E47LO7XG.js.map} +0 -0
- /package/dist/{chunk-GKD7J45E.js.map → chunk-E5RJLP2S.js.map} +0 -0
- /package/dist/{chunk-NJBY4HME.js.map → chunk-FQMPHPHE.js.map} +0 -0
- /package/dist/{chunk-ZWOUNYCK.js.map → chunk-GFWCBYAI.js.map} +0 -0
- /package/dist/{chunk-NWABYDS5.js.map → chunk-HW3DZ7TY.js.map} +0 -0
- /package/dist/{chunk-SHYDVLFD.js.map → chunk-JC2TMUU5.js.map} +0 -0
- /package/dist/{chunk-JISE24L4.js.map → chunk-MYIRYP6D.js.map} +0 -0
- /package/dist/{chunk-4IIMCEUZ.js.map → chunk-N6B5BINC.js.map} +0 -0
- /package/dist/{chunk-HEH5WH2Q.js.map → chunk-NLPIXQOV.js.map} +0 -0
- /package/dist/{chunk-MIJ7EO56.js.map → chunk-OQPIN2OY.js.map} +0 -0
- /package/dist/{chunk-BY25KD5A.js.map → chunk-QJBVP2BS.js.map} +0 -0
- /package/dist/{chunk-BVLUNWRF.js.map → chunk-REERG473.js.map} +0 -0
- /package/dist/{chunk-QDBOIQQI.js.map → chunk-SHYNOLL6.js.map} +0 -0
- /package/dist/{chunk-MZX36SAT.js.map → chunk-SI3GXM7Z.js.map} +0 -0
- /package/dist/{chunk-V5EDKEW3.js.map → chunk-SUOJQHIN.js.map} +0 -0
- /package/dist/{chunk-5O5BKPET.js.map → chunk-UJ3TZF4Y.js.map} +0 -0
- /package/dist/{chunk-X5APVAKP.js.map → chunk-WICMTKWR.js.map} +0 -0
- /package/dist/{chunk-MVFUAMCR.js.map → chunk-WO6PZMMB.js.map} +0 -0
- /package/dist/{chunks-4ERKEYKW.js.map → chunks-QTVEFJOS.js.map} +0 -0
- /package/dist/{formula-K6TX7MPD.js.map → formula-DUHNPES2.js.map} +0 -0
- /package/dist/{formula-NSUMSGTH.js.map → formula-XNCKOV6K.js.map} +0 -0
- /package/dist/{generator-OHDWVKTZ.js.map → generator-6BFIABTF.js.map} +0 -0
- /package/dist/{generator-SEH6W2LS.js.map → generator-XJLIBYDJ.js.map} +0 -0
- /package/dist/{hancom-HXONTKAF.js.map → hancom-D4E3WBPI.js.map} +0 -0
- /package/dist/{hancom-24ZZS7G6.js.map → hancom-IPF6HM5F.js.map} +0 -0
- /package/dist/{image-ocr-C4PANEFS.js.map → image-ocr-NFCTNIL5.js.map} +0 -0
- /package/dist/{image-ocr-UWM2JO4F.js.map → image-ocr-PYOXD5K4.js.map} +0 -0
- /package/dist/{memo-WOHINE33.js.map → memo-CNW6ZJFE.js.map} +0 -0
- /package/dist/{model-bundle-WAPNK77M.js.map → model-bundle-TIHWFIN5.js.map} +0 -0
- /package/dist/{models-RVSU27QC.js.map → models-YBHBEM6J.js.map} +0 -0
- /package/dist/{pdf-ocr-GFQNIMQG.js.map → pdf-ocr-GEAW23FB.js.map} +0 -0
- /package/dist/{pdf-ocr-WXNQMLU2.js.map → pdf-ocr-IJXT6ZJR.js.map} +0 -0
- /package/dist/{profile-io-EKLAEN7W.js.map → profile-io-Y7SMMS2R.js.map} +0 -0
- /package/dist/{rasterize-IXUL6Y5W.js.map → rasterize-MLEHT6PU.js.map} +0 -0
- /package/dist/{redact-doc-JUTJ3SOJ.js.map → redact-doc-GPO2UTTJ.js.map} +0 -0
- /package/dist/{render-YPFJPUNC.js.map → render-TNWY53S4.js.map} +0 -0
- /package/dist/{rewrite-fallback-H6ORRXXB.js.map → rewrite-fallback-AHGTN757.js.map} +0 -0
- /package/dist/{seal-J3JWCKI6.js.map → seal-7HBR3HBQ.js.map} +0 -0
- /package/dist/{setup-R2HZNN6F.js.map → setup-TJ57DQ6I.js.map} +0 -0
- /package/dist/{to-hwpx-LRYNPYMS.js.map → to-hwpx-6JF6Q2TZ.js.map} +0 -0
- /package/dist/{to-hwpx-WWWZ7USZ.js.map → to-hwpx-DLVARUND.js.map} +0 -0
- /package/dist/{visual-3XBGXVFX.js.map → visual-VBDQUUKP.js.map} +0 -0
- /package/dist/{watch-ETBDIPSJ.js.map → watch-6CHDQ355.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkLHZL52HOcjs = require('./chunk-LHZL52HO.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -9,11 +9,11 @@ var _chunkX2UNKZT4cjs = require('./chunk-X2UNKZT4.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkYFTD6WOPcjs = require('./chunk-YFTD6WOP.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkVXHZPUMScjs = require('./chunk-VXHZPUMS.cjs');
|
|
17
17
|
|
|
18
18
|
// src/ocr/models.ts
|
|
19
19
|
var _path = require('path');
|
|
@@ -65,7 +65,7 @@ var OCR_REC_DICT = {
|
|
|
65
65
|
sizeMb: 1
|
|
66
66
|
};
|
|
67
67
|
function getOcrModelsDir() {
|
|
68
|
-
return
|
|
68
|
+
return _chunkLHZL52HOcjs.getModelsDir.call(void 0, "ppocr");
|
|
69
69
|
}
|
|
70
70
|
var DEFAULT_OCR_MODELS = Object.freeze({
|
|
71
71
|
det: { spec: OCR_DET_MODEL },
|
|
@@ -110,7 +110,7 @@ async function ensureOcrModelsFor(sel, onProgress) {
|
|
|
110
110
|
if (!stamp || verifiedInProcess.get(path) !== stamp) todo.push(s.spec);
|
|
111
111
|
}
|
|
112
112
|
if (!todo.length) return;
|
|
113
|
-
await
|
|
113
|
+
await _chunkLHZL52HOcjs.ensureModelsIn.call(void 0, dir, todo, onProgress);
|
|
114
114
|
for (const spec of todo) {
|
|
115
115
|
const path = _path.join.call(void 0, dir, spec.filename), stamp = await fileStamp(path);
|
|
116
116
|
if (stamp) verifiedInProcess.set(path, stamp);
|
|
@@ -1096,6 +1096,13 @@ function leadingBullet(gray, w, h, ink, firstX, squareMax = 0.92) {
|
|
|
1096
1096
|
if (!mark) return null;
|
|
1097
1097
|
return { mark, covers: firstX <= x1 + ch * 0.3 };
|
|
1098
1098
|
}
|
|
1099
|
+
var STACK_INK_RATIO = 1.6;
|
|
1100
|
+
function stackedGlyphBands(gray, w, h, ink) {
|
|
1101
|
+
const ib = inkBounds(gray, w, h, ink);
|
|
1102
|
+
if (ib.y1 - ib.y0 < STACK_INK_RATIO * (ib.x1 - ib.x0)) return null;
|
|
1103
|
+
const bands = splitRowBands(gray, w, h, ink, 0.45);
|
|
1104
|
+
return bands.length >= 2 && bands.length <= 4 ? bands : null;
|
|
1105
|
+
}
|
|
1099
1106
|
|
|
1100
1107
|
// src/ocr/text-gaps.ts
|
|
1101
1108
|
var evidence = /* @__PURE__ */ new WeakMap();
|
|
@@ -1716,6 +1723,7 @@ function closeOpenTableEdges(horizontals, verticals) {
|
|
|
1716
1723
|
if (!placed) groups.push([hl]);
|
|
1717
1724
|
}
|
|
1718
1725
|
const splitGroups = [];
|
|
1726
|
+
const cuts = [];
|
|
1719
1727
|
for (const g of groups) {
|
|
1720
1728
|
const sorted = [...g].sort((a, b) => a.y1 - b.y1);
|
|
1721
1729
|
const gaps = [];
|
|
@@ -1740,11 +1748,31 @@ function closeOpenTableEdges(horizontals, verticals) {
|
|
|
1740
1748
|
if (median3 > 0 && between && gap > EDGE_YGAP_ABS_MIN && !bridged && cur.length >= EDGE_MIN_RULES && sorted.length - i >= EDGE_MIN_RULES) {
|
|
1741
1749
|
splitGroups.push(cur);
|
|
1742
1750
|
cur = [];
|
|
1751
|
+
cuts.push({ yLo, yHi, x1: gx1, x2: gx2 });
|
|
1743
1752
|
}
|
|
1744
1753
|
cur.push(sorted[i]);
|
|
1745
1754
|
}
|
|
1746
1755
|
if (cur.length) splitGroups.push(cur);
|
|
1747
1756
|
}
|
|
1757
|
+
if (cuts.length) {
|
|
1758
|
+
const parts = [];
|
|
1759
|
+
for (const g of splitGroups) {
|
|
1760
|
+
const gx1 = Math.min(...g.map((l) => l.x1)), gx2 = Math.max(...g.map((l) => l.x2));
|
|
1761
|
+
const own = cuts.filter((c) => Math.min(c.x2, gx2) - Math.max(c.x1, gx1) >= (gx2 - gx1) * 0.5);
|
|
1762
|
+
let cur = [];
|
|
1763
|
+
for (const l of g) {
|
|
1764
|
+
const prev = cur[cur.length - 1];
|
|
1765
|
+
if (prev && own.some((c) => prev.y1 <= c.yLo + EDGE_CONNECT_TOL && l.y1 >= c.yHi - EDGE_CONNECT_TOL)) {
|
|
1766
|
+
parts.push(cur);
|
|
1767
|
+
cur = [];
|
|
1768
|
+
}
|
|
1769
|
+
cur.push(l);
|
|
1770
|
+
}
|
|
1771
|
+
if (cur.length) parts.push(cur);
|
|
1772
|
+
}
|
|
1773
|
+
splitGroups.length = 0;
|
|
1774
|
+
splitGroups.push(...parts);
|
|
1775
|
+
}
|
|
1748
1776
|
const synthesized = [];
|
|
1749
1777
|
for (const g of splitGroups) {
|
|
1750
1778
|
if (g.length < EDGE_MIN_RULES) continue;
|
|
@@ -3252,16 +3280,16 @@ function recordOpenEndCellEdges(grid, cells, horizontals) {
|
|
|
3252
3280
|
}
|
|
3253
3281
|
function takeClipCellEdges(from, to) {
|
|
3254
3282
|
const e = CLIP_CELL_EDGES.get(from);
|
|
3255
|
-
if (e)
|
|
3283
|
+
if (e) _chunkYFTD6WOPcjs.CELL_EDGES.set(to, e);
|
|
3256
3284
|
}
|
|
3257
3285
|
function hasOpenCellSeam(a, b) {
|
|
3258
|
-
const u =
|
|
3286
|
+
const u = _chunkYFTD6WOPcjs.CELL_EDGES.get(a), d = _chunkYFTD6WOPcjs.CELL_EDGES.get(b);
|
|
3259
3287
|
return !!u && !!d && u.t && !u.b && !d.t && d.b && u.l && u.r && d.l && d.r;
|
|
3260
3288
|
}
|
|
3261
3289
|
function joinCellEdges(a, b) {
|
|
3262
|
-
const u =
|
|
3290
|
+
const u = _chunkYFTD6WOPcjs.CELL_EDGES.get(a), d = _chunkYFTD6WOPcjs.CELL_EDGES.get(b);
|
|
3263
3291
|
if (!u || !d) return;
|
|
3264
|
-
|
|
3292
|
+
_chunkYFTD6WOPcjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
|
|
3265
3293
|
}
|
|
3266
3294
|
|
|
3267
3295
|
// src/pdf/cell-extract.ts
|
|
@@ -3437,7 +3465,7 @@ function tagScripts(text, lines) {
|
|
|
3437
3465
|
const [s, e, kind] = marks[m];
|
|
3438
3466
|
out = out.slice(0, s) + `<${kind}>` + out.slice(s, e) + `</${kind}>` + out.slice(e);
|
|
3439
3467
|
}
|
|
3440
|
-
return
|
|
3468
|
+
return _chunkYFTD6WOPcjs.tidyScriptTags.call(void 0, out);
|
|
3441
3469
|
}
|
|
3442
3470
|
|
|
3443
3471
|
// src/pdf/line-wrap.ts
|
|
@@ -6836,9 +6864,9 @@ function detectHeadings(blocks, medianFontSize) {
|
|
|
6836
6864
|
if (/^\d+$/.test(text) && !isChapterNumber(block, blocks[bi + 1], medianFontSize)) continue;
|
|
6837
6865
|
const ratio = block.style.fontSize / medianFontSize;
|
|
6838
6866
|
let level = 0;
|
|
6839
|
-
if (ratio >=
|
|
6840
|
-
else if (ratio >=
|
|
6841
|
-
else if (ratio >=
|
|
6867
|
+
if (ratio >= _chunkYFTD6WOPcjs.HEADING_RATIO_H1) level = 1;
|
|
6868
|
+
else if (ratio >= _chunkYFTD6WOPcjs.HEADING_RATIO_H2) level = 2;
|
|
6869
|
+
else if (ratio >= _chunkYFTD6WOPcjs.HEADING_RATIO_H3) level = 3;
|
|
6842
6870
|
if (level > 0) {
|
|
6843
6871
|
block.type = "heading";
|
|
6844
6872
|
block.level = level;
|
|
@@ -6851,7 +6879,7 @@ function isChapterNumber(block, next, medianFontSize) {
|
|
|
6851
6879
|
const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _193 => _193.style, 'optionalAccess', _194 => _194.fontSize]), () => ( 0));
|
|
6852
6880
|
const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _195 => _195.text, 'optionalAccess', _196 => _196.trim, 'call', _197 => _197()]), () => ( ""));
|
|
6853
6881
|
const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _198 => _198.bbox]);
|
|
6854
|
-
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _199 => _199.text, 'optionalAccess', _200 => _200.trim, 'call', _201 => _201()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize *
|
|
6882
|
+
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _199 => _199.text, 'optionalAccess', _200 => _200.trim, 'call', _201 => _201()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunkYFTD6WOPcjs.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;
|
|
6855
6883
|
}
|
|
6856
6884
|
function mergeStackedHeadingLines(blocks, medianFontSize) {
|
|
6857
6885
|
for (let i = 0; i < blocks.length - 1; ) {
|
|
@@ -8594,16 +8622,16 @@ function isProseSpread(items) {
|
|
|
8594
8622
|
for (let i = 1; i < sorted.length; i++) {
|
|
8595
8623
|
gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
|
|
8596
8624
|
}
|
|
8597
|
-
const maxGap =
|
|
8625
|
+
const maxGap = _chunkVXHZPUMScjs.safeMax.call(void 0, gaps);
|
|
8598
8626
|
const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
|
|
8599
8627
|
if (items.length >= 4 && maxGap < 40 && avgLen < 5) return true;
|
|
8600
|
-
const minGap =
|
|
8628
|
+
const minGap = _chunkVXHZPUMScjs.safeMin.call(void 0, gaps);
|
|
8601
8629
|
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 || items.some((i) => /\p{L}[,.;:]["”’)]?$/u.test(i.text)));
|
|
8602
8630
|
}
|
|
8603
8631
|
function detectColumns(yLines) {
|
|
8604
8632
|
const allItems = yLines.flat();
|
|
8605
8633
|
if (allItems.length === 0) return null;
|
|
8606
|
-
const pageWidth =
|
|
8634
|
+
const pageWidth = _chunkVXHZPUMScjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkVXHZPUMScjs.safeMin.call(void 0, allItems.map((i) => i.x));
|
|
8607
8635
|
if (pageWidth < 100) return null;
|
|
8608
8636
|
let bigoLineIdx = -1;
|
|
8609
8637
|
for (let i = 0; i < yLines.length; i++) {
|
|
@@ -9001,13 +9029,13 @@ function partTex(group) {
|
|
|
9001
9029
|
const base = Math.min(...g.filter((i) => i.fontSize >= size * SCRIPT_SIZE_RATIO).map((i) => i.y));
|
|
9002
9030
|
let s = "", run = "";
|
|
9003
9031
|
const flush = () => {
|
|
9004
|
-
if (run) s +=
|
|
9032
|
+
if (run) s += _chunkYFTD6WOPcjs.toTex.call(void 0, run);
|
|
9005
9033
|
run = "";
|
|
9006
9034
|
};
|
|
9007
9035
|
g.forEach((it, k) => {
|
|
9008
9036
|
if (it.fontSize < size * SCRIPT_SIZE_RATIO && it.y - base >= size * SCRIPT_RISE_EM) {
|
|
9009
9037
|
flush();
|
|
9010
|
-
s += `^{${
|
|
9038
|
+
s += `^{${_chunkYFTD6WOPcjs.toTex.call(void 0, it.text)}}`;
|
|
9011
9039
|
return;
|
|
9012
9040
|
}
|
|
9013
9041
|
if (k && it.x - (g[k - 1].x + g[k - 1].w) > spaceGapThreshold(it.fontSize)) run += " ";
|
|
@@ -9180,7 +9208,7 @@ function rebuildUnitLine(items, grid) {
|
|
|
9180
9208
|
function prependUnitRow(cells, cols, line, usedItems) {
|
|
9181
9209
|
const text = cleanCellText(line.map((item) => item.text).join(""));
|
|
9182
9210
|
cells.unshift(Array.from({ length: cols }, (_, c) => ({ text: c === 0 ? text : "", colSpan: c === 0 ? cols : 1, rowSpan: 1 })));
|
|
9183
|
-
for (const cell of cells[0])
|
|
9211
|
+
for (const cell of cells[0]) _chunkYFTD6WOPcjs.CELL_EDGES.set(cell, NO_EDGES);
|
|
9184
9212
|
for (const item of line) usedItems.add(item);
|
|
9185
9213
|
}
|
|
9186
9214
|
function attachUnitRow(items, grid, cells, cols, usedItems) {
|
|
@@ -9762,7 +9790,7 @@ function recordFrameTitle(table, source, pageNum) {
|
|
|
9762
9790
|
const [label, spacer, title] = cells;
|
|
9763
9791
|
if (!/^(?:붙임|별첨|첨부|부록)\s*\d{1,3}$/.test(label.text.trim()) || spacer.text.trim() || !title.text.trim()) return;
|
|
9764
9792
|
if (cells.some((c) => {
|
|
9765
|
-
const e =
|
|
9793
|
+
const e = _chunkYFTD6WOPcjs.CELL_EDGES.get(c);
|
|
9766
9794
|
return !e || e.t || e.b || e.l || e.r;
|
|
9767
9795
|
})) return;
|
|
9768
9796
|
const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _393 => _393.fontSize]), () => ( 0));
|
|
@@ -10268,7 +10296,13 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10268
10296
|
})();
|
|
10269
10297
|
const layoutProse = irGrid.some((row) => row.some((c) => c.colSpan >= numCols - 1 && c.text.length > 60));
|
|
10270
10298
|
const maxRows = numericBody ? layoutProse ? OCR_NUMERIC_MAX_ROWS_FRAMED : OCR_NUMERIC_MAX_ROWS : 5;
|
|
10271
|
-
|
|
10299
|
+
const proseLine = (t) => (_nullishCoalesce(_optionalChain([t, 'access', _419 => _419.match, 'call', _420 => _420(/[가-힣]/g), 'optionalAccess', _421 => _421.length]), () => ( 0))) > 6 && !/^[-−]?[\d,.]+$/.test(t.replace(/\s+/g, ""));
|
|
10300
|
+
const proseCols = numRows === 2 ? (_nullishCoalesce(irGrid[1], () => ( []))).filter((c) => {
|
|
10301
|
+
const ls = c.text.split("\n").map((t) => t.trim()).filter(Boolean);
|
|
10302
|
+
return ls.length >= 3 && ls.filter(proseLine).length >= ls.length * 0.6;
|
|
10303
|
+
}).length : 0;
|
|
10304
|
+
const twoRowOk = !ocrPage || proseCols < 2;
|
|
10305
|
+
if (!grid.cells && numRows <= maxRows && numCols >= 3 && !nestedAttached && (numRows <= 2 ? twoRowOk : unitLine.length > 0 || numericBody)) {
|
|
10272
10306
|
const kept = /* @__PURE__ */ new Map();
|
|
10273
10307
|
const rebuilt = normalizeUndersegmentedTable(irGrid, grid.colXs, textItems, grid.rowYs, kept, maxRows);
|
|
10274
10308
|
if (rebuilt) {
|
|
@@ -10283,8 +10317,8 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10283
10317
|
finalGrid = rebuilt.map((row, i) => {
|
|
10284
10318
|
const o = kept.get(i);
|
|
10285
10319
|
return row.map((rawText, c) => {
|
|
10286
|
-
const src = o === void 0 ? void 0 : _optionalChain([irGrid, 'access',
|
|
10287
|
-
return { text: cleanCellText(rawText), colSpan: _nullishCoalesce(_optionalChain([src, 'optionalAccess',
|
|
10320
|
+
const src = o === void 0 ? void 0 : _optionalChain([irGrid, 'access', _422 => _422[o], 'optionalAccess', _423 => _423[c]]);
|
|
10321
|
+
return { text: cleanCellText(rawText), colSpan: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _424 => _424.colSpan]), () => ( 1)), rowSpan: src ? spanRows(o, src.rowSpan) : 1 };
|
|
10288
10322
|
});
|
|
10289
10323
|
});
|
|
10290
10324
|
finalRows = finalGrid.length;
|
|
@@ -10304,14 +10338,14 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10304
10338
|
if (!assignedItems.has(textItems[ti]) && !inExpanded(textItems[ti])) usedItems.delete(owners[ti]);
|
|
10305
10339
|
}
|
|
10306
10340
|
}
|
|
10307
|
-
if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access',
|
|
10341
|
+
if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _425 => _425[0], 'optionalAccess', _426 => _426[0], 'optionalAccess', _427 => _427.text]), () => ( "")))) {
|
|
10308
10342
|
prependUnitRow(finalGrid, numCols, unitLine, usedItems);
|
|
10309
10343
|
finalRows++;
|
|
10310
10344
|
}
|
|
10311
10345
|
if (!rebuiltUsed && attachUnitRow(items, grid, finalGrid, numCols, usedItems)) finalRows++;
|
|
10312
10346
|
let semanticOneColumn = false;
|
|
10313
10347
|
if (!grid.cells && !nestedAttached && numCols === 1 && numGridRows >= 2) {
|
|
10314
|
-
const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access',
|
|
10348
|
+
const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access', _428 => _428[0], 'optionalAccess', _429 => _429.text, 'access', _430 => _430.trim, 'call', _431 => _431()]));
|
|
10315
10349
|
if (populatedRows.length >= 4) {
|
|
10316
10350
|
const fontSizes = tableItems.map((item) => item.fontSize).filter((size) => size > 0).sort((a, b) => a - b);
|
|
10317
10351
|
const medianFont = _nullishCoalesce(fontSizes[Math.floor(fontSizes.length / 2)], () => ( 0));
|
|
@@ -10409,7 +10443,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10409
10443
|
height: grid.bbox.y2 - grid.bbox.y1
|
|
10410
10444
|
};
|
|
10411
10445
|
if (numRows === 1 && numCols === 1 && gridW < pageWidth * 0.35) {
|
|
10412
|
-
const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access',
|
|
10446
|
+
const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access', _432 => _432[0], 'optionalAccess', _433 => _433[0], 'optionalAccess', _434 => _434.text]), () => ( ""));
|
|
10413
10447
|
const besideLines = (side) => new Set(side.map((it) => Math.round(it.y / 3))).size;
|
|
10414
10448
|
const rightLines = items.filter((it) => it.x >= grid.bbox.x2 + 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
|
|
10415
10449
|
const leftLines = items.filter((it) => it.x + it.w <= grid.bbox.x1 - 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
|
|
@@ -10428,8 +10462,8 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10428
10462
|
}
|
|
10429
10463
|
}
|
|
10430
10464
|
if (!grid.cells && !nestedAttached && shouldDemoteTable(irTable)) {
|
|
10431
|
-
const paragraphs = numRows === 1 && numCols === 1 ? _optionalChain([irTable, 'access',
|
|
10432
|
-
if (_optionalChain([paragraphs, 'optionalAccess',
|
|
10465
|
+
const paragraphs = numRows === 1 && numCols === 1 ? _optionalChain([irTable, 'access', _435 => _435.cells, 'access', _436 => _436[0], 'optionalAccess', _437 => _437[0], 'optionalAccess', _438 => _438.blocks]) : void 0;
|
|
10466
|
+
if (_optionalChain([paragraphs, 'optionalAccess', _439 => _439.length])) {
|
|
10433
10467
|
blocks.push(...paragraphs);
|
|
10434
10468
|
frameParagraphUnits.push(paragraphs);
|
|
10435
10469
|
recordFrameReadingUnit(paragraphs, tableBbox);
|
|
@@ -10476,7 +10510,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10476
10510
|
const clusterResults = (proseColumns ? [] : detectClusterTables(clusterItems, pageNum, void 0, lex)).filter((cr) => {
|
|
10477
10511
|
const b = cr.bbox;
|
|
10478
10512
|
const overlapX = (x) => Math.min(x.x + x.width, b.x + b.width) - Math.max(x.x, b.x);
|
|
10479
|
-
return !blocks.some((x) => x.bbox && x.bbox.y >= b.y - 2 && x.bbox.y + x.bbox.height <= b.y + b.height + 2 && (x.type === "paragraph" ? (_nullishCoalesce(_optionalChain([x, 'access',
|
|
10513
|
+
return !blocks.some((x) => x.bbox && x.bbox.y >= b.y - 2 && x.bbox.y + x.bbox.height <= b.y + b.height + 2 && (x.type === "paragraph" ? (_nullishCoalesce(_optionalChain([x, 'access', _440 => _440.text, 'optionalAccess', _441 => _441.match, 'call', _442 => _442(/\p{L}/gu), 'optionalAccess', _443 => _443.length]), () => ( 0))) >= 10 && overlapX(x.bbox) >= 0.8 * b.width : x.type === "table" && !ocrPage && _optionalChain([x, 'access', _444 => _444.table, 'optionalAccess', _445 => _445.cols]) === cr.table.cols && overlapX(x.bbox) >= 0.5 * Math.min(x.bbox.width, b.width)));
|
|
10480
10514
|
});
|
|
10481
10515
|
if (clusterResults.length > 0) {
|
|
10482
10516
|
const ciToIdx = /* @__PURE__ */ new Map();
|
|
@@ -10513,7 +10547,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10513
10547
|
groupSizes.push(1);
|
|
10514
10548
|
}
|
|
10515
10549
|
const allY = remaining.map((i) => i.y);
|
|
10516
|
-
const pageH =
|
|
10550
|
+
const pageH = _chunkVXHZPUMScjs.safeMax.call(void 0, allY) - _chunkVXHZPUMScjs.safeMin.call(void 0, allY);
|
|
10517
10551
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
10518
10552
|
const sides = frameColumnTextBands(remaining, spanning, gx);
|
|
10519
10553
|
const textBlocks = [];
|
|
@@ -10529,7 +10563,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10529
10563
|
finalTextBlocks.push(...detectListBlocks(textBlocks));
|
|
10530
10564
|
} else {
|
|
10531
10565
|
const allY = remaining.map((i) => i.y);
|
|
10532
|
-
const pageH =
|
|
10566
|
+
const pageH = _chunkVXHZPUMScjs.safeMax.call(void 0, allY) - _chunkVXHZPUMScjs.safeMin.call(void 0, allY);
|
|
10533
10567
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
10534
10568
|
const groups = xyCutOrder(remaining, gapThreshold);
|
|
10535
10569
|
const textBlocks = [];
|
|
@@ -10884,7 +10918,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
|
|
|
10884
10918
|
blocks.push(...columnTextToBlocks(tableText, pageNum, bbox, dominantStyle(items)));
|
|
10885
10919
|
} else {
|
|
10886
10920
|
const allY = items.map((i) => i.y);
|
|
10887
|
-
const pageHeight =
|
|
10921
|
+
const pageHeight = _chunkVXHZPUMScjs.safeMax.call(void 0, allY) - _chunkVXHZPUMScjs.safeMin.call(void 0, allY);
|
|
10888
10922
|
const gapThreshold = Math.max(15, pageHeight * 0.03);
|
|
10889
10923
|
const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold, 0, void 0, minGap);
|
|
10890
10924
|
for (const group of orderedGroups) {
|
|
@@ -10916,19 +10950,19 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
|
|
|
10916
10950
|
const overlapH = Math.max(0, Math.min(b.y + b.height, region.y2) - Math.max(b.y, region.y1));
|
|
10917
10951
|
return overlapW * overlapH >= b.width * b.height * 0.8;
|
|
10918
10952
|
});
|
|
10919
|
-
const labels = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24 && (_nullishCoalesce(_optionalChain([b, 'access',
|
|
10953
|
+
const labels = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24 && (_nullishCoalesce(_optionalChain([b, 'access', _446 => _446.text, 'optionalAccess', _447 => _447.match, 'call', _448 => _448(/[\p{L}\p{N}]/gu), 'optionalAccess', _449 => _449.length]), () => ( 0))) >= 2);
|
|
10920
10954
|
const axisFragments = rotatedAxisFragments(candidates);
|
|
10921
10955
|
const accepted = candidates.filter((b) => {
|
|
10922
|
-
if (b.type === "paragraph") return (_nullishCoalesce(_optionalChain([b, 'access',
|
|
10956
|
+
if (b.type === "paragraph") return (_nullishCoalesce(_optionalChain([b, 'access', _450 => _450.text, 'optionalAccess', _451 => _451.match, 'call', _452 => _452(/[\p{L}\p{N}]/gu), 'optionalAccess', _453 => _453.length]), () => ( 0))) >= 2 || !axisFragments.has(b) && (supportedDiagramLabel(b, labels, region) || axisTick(b, candidates));
|
|
10923
10957
|
const t = b.table;
|
|
10924
10958
|
if (b.type !== "table" || !t || UNRULED_REGION_TABLES.has(b)) return false;
|
|
10925
10959
|
const lone = t.cells.filter((row) => row.filter((c) => c.text.trim()).length === 1 && row.some((c) => c.colSpan === t.cols)).length;
|
|
10926
10960
|
if (t.rows >= 2 && lone * 2 >= t.rows) return false;
|
|
10927
10961
|
if (t.rows === 1 && t.cols === 1) {
|
|
10928
|
-
const text = _nullishCoalesce(_optionalChain([t, 'access',
|
|
10929
|
-
return (_nullishCoalesce(_optionalChain([text, 'access',
|
|
10962
|
+
const text = _nullishCoalesce(_optionalChain([t, 'access', _454 => _454.cells, 'access', _455 => _455[0], 'optionalAccess', _456 => _456[0], 'optionalAccess', _457 => _457.text]), () => ( ""));
|
|
10963
|
+
return (_nullishCoalesce(_optionalChain([text, 'access', _458 => _458.match, 'call', _459 => _459(/\n/g), 'optionalAccess', _460 => _460.length]), () => ( 0))) >= 5 && (_nullishCoalesce(_optionalChain([text, 'access', _461 => _461.match, 'call', _462 => _462(/\d/g), 'optionalAccess', _463 => _463.length]), () => ( 0))) >= text.length * 0.25;
|
|
10930
10964
|
}
|
|
10931
|
-
const headerLabels = _nullishCoalesce(_optionalChain([t, 'access',
|
|
10965
|
+
const headerLabels = _nullishCoalesce(_optionalChain([t, 'access', _464 => _464.cells, 'access', _465 => _465[0], 'optionalAccess', _466 => _466.filter, 'call', _467 => _467((c) => c.text.replace(/[^A-Za-z가-힣]/g, "").length >= 2), 'access', _468 => _468.length]), () => ( 0));
|
|
10932
10966
|
return t.rows >= 2 && t.cols >= 2 && headerLabels >= t.cols * 0.75 && t.cells.slice(1).some((row) => row.filter((c) => c.text.trim()).length >= 2);
|
|
10933
10967
|
});
|
|
10934
10968
|
const selected = candidates.flatMap((b) => accepted.includes(b) ? [b] : b.type === "table" && b.table ? rowParagraphs(b).filter((p) => /[\p{L}\p{N}]{2}/u.test(_nullishCoalesce(p.text, () => ( "")))) : []);
|
|
@@ -10945,14 +10979,14 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
|
|
|
10945
10979
|
for (const block of selected) {
|
|
10946
10980
|
if (seen2.has(block)) continue;
|
|
10947
10981
|
const frame = FRAME_READING_UNITS.get(block);
|
|
10948
|
-
const source = _optionalChain([frame, 'optionalAccess',
|
|
10982
|
+
const source = _optionalChain([frame, 'optionalAccess', _469 => _469.blocks, 'access', _470 => _470.every, 'call', _471 => _471((member) => selectedSet.has(member))]) ? frame.blocks : [block];
|
|
10949
10983
|
source.forEach((member) => seen2.add(member));
|
|
10950
10984
|
const available = source.filter((member) => !hasOriginal(member));
|
|
10951
10985
|
const units = frame && available.length === source.length && source === frame.blocks ? [{ blocks: available, bbox: frame.bbox, atomic: true }] : available.map((member) => ({ blocks: [member], bbox: member.bbox, atomic: false }));
|
|
10952
10986
|
for (const unit of units) {
|
|
10953
10987
|
const b = unit.bbox;
|
|
10954
10988
|
const index = blocks.findIndex((existing) => {
|
|
10955
|
-
const e = _nullishCoalesce(_optionalChain([FRAME_READING_UNITS, 'access',
|
|
10989
|
+
const e = _nullishCoalesce(_optionalChain([FRAME_READING_UNITS, 'access', _472 => _472.get, 'call', _473 => _473(existing), 'optionalAccess', _474 => _474.bbox]), () => ( existing.bbox));
|
|
10956
10990
|
if (existing.pageNumber !== page || !e) return false;
|
|
10957
10991
|
const beside = e.y < region.y2 && e.y + e.height > region.y1 && e.x >= region.x2 - 1;
|
|
10958
10992
|
if (placedHere.has(existing) && Math.abs(e.y + e.height / 2 - b.y - b.height / 2) <= Math.min(e.height, b.height) * 0.25) return e.x > b.x;
|
|
@@ -10970,16 +11004,16 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
|
|
|
10970
11004
|
}
|
|
10971
11005
|
function axisTick(block, candidates) {
|
|
10972
11006
|
const b = block.bbox;
|
|
10973
|
-
if (!/^\d$/u.test(_nullishCoalesce(_optionalChain([block, 'access',
|
|
10974
|
-
const numeric = candidates.filter((o) => o !== block && o.type === "paragraph" && o.bbox && /^[\d\s.,%+−-]+$/u.test(_nullishCoalesce(_optionalChain([o, 'access',
|
|
11007
|
+
if (!/^\d$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _475 => _475.text, 'optionalAccess', _476 => _476.trim, 'call', _477 => _477()]), () => ( "")))) return false;
|
|
11008
|
+
const numeric = candidates.filter((o) => o !== block && o.type === "paragraph" && o.bbox && /^[\d\s.,%+−-]+$/u.test(_nullishCoalesce(_optionalChain([o, 'access', _478 => _478.text, 'optionalAccess', _479 => _479.trim, 'call', _480 => _480()]), () => ( ""))) && /\d/u.test(_nullishCoalesce(o.text, () => ( ""))) && Math.max(o.bbox.height, b.height) <= Math.min(o.bbox.height, b.height) * 2);
|
|
10975
11009
|
const cy = b.y + b.height / 2, right = b.x + b.width;
|
|
10976
11010
|
const row = numeric.filter((o) => Math.abs(o.bbox.y + o.bbox.height / 2 - cy) <= Math.min(o.bbox.height, b.height) * 0.35);
|
|
10977
11011
|
const column = numeric.filter((o) => Math.abs(o.bbox.x + o.bbox.width - right) <= Math.max(o.bbox.height, b.height) * 0.5);
|
|
10978
11012
|
return row.length >= 2 || column.length >= 2;
|
|
10979
11013
|
}
|
|
10980
11014
|
function supportedDiagramLabel(block, labels, region) {
|
|
10981
|
-
const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access',
|
|
10982
|
-
if (!b || !/^[\p{L}\p{N}]$/u.test(text) || b.height < 4 || b.width < 1 || b.width > b.height * 2 || b.x < region.x1 || b.y < region.y1 || b.x + b.width > region.x2 || b.y + b.height > region.y2 || b.width * b.height > (region.x2 - region.x1) * (region.y2 - region.y1) * 5e-3 || labels.length < 3 || !labels.some((l) => /\p{L}{3}/u.test(_nullishCoalesce(l.text, () => ( "")))) || labels.filter((l) => !/\p{L}/u.test(_nullishCoalesce(l.text, () => ( ""))) && (_nullishCoalesce(_optionalChain([l, 'access',
|
|
11015
|
+
const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _481 => _481.text, 'optionalAccess', _482 => _482.trim, 'call', _483 => _483()]), () => ( ""));
|
|
11016
|
+
if (!b || !/^[\p{L}\p{N}]$/u.test(text) || b.height < 4 || b.width < 1 || b.width > b.height * 2 || b.x < region.x1 || b.y < region.y1 || b.x + b.width > region.x2 || b.y + b.height > region.y2 || b.width * b.height > (region.x2 - region.x1) * (region.y2 - region.y1) * 5e-3 || labels.length < 3 || !labels.some((l) => /\p{L}{3}/u.test(_nullishCoalesce(l.text, () => ( "")))) || labels.filter((l) => !/\p{L}/u.test(_nullishCoalesce(l.text, () => ( ""))) && (_nullishCoalesce(_optionalChain([l, 'access', _484 => _484.text, 'optionalAccess', _485 => _485.match, 'call', _486 => _486(/\p{N}/gu), 'optionalAccess', _487 => _487.length]), () => ( 0))) >= 2).length < 2) return false;
|
|
10983
11017
|
let above = false, below = false;
|
|
10984
11018
|
for (const label of labels) {
|
|
10985
11019
|
const a = label.bbox, em = Math.max(b.height, a.height);
|
|
@@ -10994,7 +11028,7 @@ function rotatedAxisFragments(candidates) {
|
|
|
10994
11028
|
const paragraphs = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24);
|
|
10995
11029
|
const axes = [];
|
|
10996
11030
|
for (const block of paragraphs) {
|
|
10997
|
-
const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access',
|
|
11031
|
+
const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _488 => _488.text, 'optionalAccess', _489 => _489.trim, 'call', _490 => _490()]), () => ( ""));
|
|
10998
11032
|
if (!/^[\d\s.,%+−-]+$/u.test(text) || !/\d/u.test(text) || b.width > b.height * 6) continue;
|
|
10999
11033
|
const axis = axes.find((a) => Math.abs(a[0].bbox.x + a[0].bbox.width - b.x - b.width) <= Math.max(a[0].bbox.height, b.height) * 0.5);
|
|
11000
11034
|
if (axis) axis.push(block);
|
|
@@ -11011,8 +11045,8 @@ function rotatedAxisFragments(candidates) {
|
|
|
11011
11045
|
const em = Math.max(...axis.map((a) => a.bbox.height)), right = axis[0].bbox.x + axis[0].bbox.width;
|
|
11012
11046
|
if (top - bottom < em * 6) continue;
|
|
11013
11047
|
const left = paragraphs.filter((block) => {
|
|
11014
|
-
const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access',
|
|
11015
|
-
return /\p{Script=Latin}/u.test(text) && (_nullishCoalesce(_optionalChain([text, 'access',
|
|
11048
|
+
const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _491 => _491.text, 'optionalAccess', _492 => _492.trim, 'call', _493 => _493()]), () => ( ""));
|
|
11049
|
+
return /\p{Script=Latin}/u.test(text) && (_nullishCoalesce(_optionalChain([text, 'access', _494 => _494.match, 'call', _495 => _495(/[\p{L}\p{N}]/gu), 'optionalAccess', _496 => _496.length]), () => ( 0))) <= 3 && b.width <= b.height * 3 && b.x + b.width >= right - em * 6 && b.x + b.width <= right - Math.max(em, b.height) && b.y >= bottom && b.y + b.height <= top;
|
|
11016
11050
|
});
|
|
11017
11051
|
const stack = left.filter((a) => left.some((b) => {
|
|
11018
11052
|
if (a === b || !aligned(a, b)) return false;
|
|
@@ -11022,7 +11056,7 @@ function rotatedAxisFragments(candidates) {
|
|
|
11022
11056
|
if (stack.length < 2) continue;
|
|
11023
11057
|
for (const block of paragraphs) {
|
|
11024
11058
|
const b = block.bbox;
|
|
11025
|
-
if (b.y >= bottom && b.y + b.height <= top && b.x + b.width >= right - em * 6 && b.x + b.width <= right - Math.max(em, b.height) && /^[\p{L}\p{N}]$/u.test(_nullishCoalesce(_optionalChain([block, 'access',
|
|
11059
|
+
if (b.y >= bottom && b.y + b.height <= top && b.x + b.width >= right - em * 6 && b.x + b.width <= right - Math.max(em, b.height) && /^[\p{L}\p{N}]$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _497 => _497.text, 'optionalAccess', _498 => _498.trim, 'call', _499 => _499()]), () => ( ""))) && stack.some((s) => aligned(s, block))) fragments.add(block);
|
|
11026
11060
|
}
|
|
11027
11061
|
}
|
|
11028
11062
|
return fragments;
|
|
@@ -11127,5 +11161,6 @@ function rowParagraphs(block) {
|
|
|
11127
11161
|
|
|
11128
11162
|
|
|
11129
11163
|
|
|
11130
|
-
|
|
11131
|
-
|
|
11164
|
+
|
|
11165
|
+
exports.DEFAULT_OCR_MODELS = DEFAULT_OCR_MODELS; exports.resolveOcrModels = resolveOcrModels; exports.handwritingFallbackModels = handwritingFallbackModels; exports.ocrSelectionKey = ocrSelectionKey; exports.ocrSourcePath = ocrSourcePath; exports.ensureOcrModelsFor = ensureOcrModelsFor; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; exports.grayCrop = grayCrop; exports.inkStats = inkStats; exports.splitRowBands = splitRowBands; exports.leadingTriangle = leadingTriangle; exports.arrowGlyph = arrowGlyph; exports.leaderRuns = leaderRuns; exports.inkBounds = inkBounds; exports.bracketFeatures = bracketFeatures; exports.slantedPair = slantedPair; exports.romanStems = romanStems; exports.circledAt = circledAt; exports.ringBoxes = ringBoxes; exports.quoteHead = quoteHead; exports.edgeTrim = edgeTrim; exports.tallInkCount = tallInkCount; exports.gapGlyphs = gapGlyphs; exports.ringBullet = ringBullet; exports.dashRatio = dashRatio; exports.leadingRing = leadingRing; exports.discAt = discAt; exports.serifOne = serifOne; exports.starRun = starRun; exports.bracketShape = bracketShape; exports.leadingBullet = leadingBullet; exports.stackedGlyphBands = stackedGlyphBands; exports.rememberOcrTextGaps = rememberOcrTextGaps; exports.copyOcrTextGaps = copyOcrTextGaps; exports.findOcrTextGaps = findOcrTextGaps; exports.extractLines = extractLines; exports.extractImageRegions = extractImageRegions; exports.NO_EDGES = NO_EDGES; exports.hasOpenCellSeam = hasOpenCellSeam; exports.joinCellEdges = joinCellEdges; 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.runningLinePatterns = runningLinePatterns; exports.stripAbsorbedRunningLines = stripAbsorbedRunningLines; 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.restoreImageBullets = restoreImageBullets; exports.detectRightArrowRegions = detectRightArrowRegions; exports.removeSideTabs = removeSideTabs; exports.extractPageBlocksWithLines = extractPageBlocksWithLines; exports.UNRULED_REGION_TABLES = UNRULED_REGION_TABLES; exports.mergeOcrImageRegions = mergeOcrImageRegions;
|
|
11166
|
+
//# sourceMappingURL=chunk-A6EOKPKG.cjs.map
|