kordoc 4.24.45 → 4.24.47
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 +5 -5
- package/dist/{-U63KR7FM.js → -PWMZE4CC.js} +21 -21
- package/dist/{chunk-KXTTQ3RN.js → chunk-2CBIY2OH.js} +2 -2
- package/dist/chunk-2CBIY2OH.js.map +1 -0
- package/dist/{chunk-56HJNAU2.js → chunk-2VXVBB5Q.js} +3 -3
- package/dist/{chunk-K4BI5IO3.cjs → chunk-3CWVQNFL.cjs} +58 -58
- package/dist/{chunk-K4BI5IO3.cjs.map → chunk-3CWVQNFL.cjs.map} +1 -1
- package/dist/{chunk-BXL3WAEY.js → chunk-4MNRUPS5.js} +38 -8
- package/dist/chunk-4MNRUPS5.js.map +1 -0
- package/dist/{chunk-YOMV4HR6.js → chunk-56FEGA44.js} +11 -11
- package/dist/{chunk-E6OSXYA4.js → chunk-57BKTVR5.js} +2 -2
- package/dist/{chunk-ELEYRONP.js → chunk-A67OXFXM.js} +39 -9
- package/dist/chunk-A67OXFXM.js.map +1 -0
- package/dist/{chunk-B3BUBTAB.js → chunk-AB7MYMPZ.js} +2 -2
- package/dist/{chunk-3DV5MIZK.js → chunk-AO3YFJVW.js} +2 -2
- package/dist/{chunk-WK3QLJCE.js → chunk-AYM7XTI2.js} +2 -2
- package/dist/{chunk-B773KHRO.cjs → chunk-BKK2SMVM.cjs} +2 -2
- package/dist/{chunk-B773KHRO.cjs.map → chunk-BKK2SMVM.cjs.map} +1 -1
- package/dist/{chunk-JKBJDB6X.js → chunk-BO2IJGNZ.js} +2 -2
- package/dist/{chunk-FZRETZG3.js → chunk-BP5GDQBT.js} +5 -5
- package/dist/{chunk-U4MF5C62.js → chunk-CQ33HCSU.js} +2 -2
- package/dist/{chunk-HMTXDJZA.js → chunk-FI7ULBC6.js} +6 -6
- package/dist/{chunk-NKWF62JV.js → chunk-FOTG4MMD.js} +5 -5
- package/dist/{chunk-U453MJJB.js → chunk-GRQXAWNW.js} +2 -2
- package/dist/{chunk-W7BLAMBO.js → chunk-HFQFCAEJ.js} +2 -2
- package/dist/{chunk-MVLVCUBP.js → chunk-HMD35PMD.js} +3 -3
- package/dist/{chunk-DLYJKFRY.js → chunk-IPXFIH5E.js} +2 -2
- package/dist/{chunk-DLYJKFRY.js.map → chunk-IPXFIH5E.js.map} +1 -1
- package/dist/{chunk-MKJRT3PP.js → chunk-IWC6PTMT.js} +2 -2
- package/dist/{chunk-5IEBL77T.js → chunk-KIVWAZKL.js} +2 -2
- package/dist/{chunk-HHORHT5O.js → chunk-KSE5HSU3.js} +2 -2
- package/dist/{chunk-HVVPLWQD.js → chunk-LEUAWTMU.js} +6 -6
- package/dist/{chunk-2QHC2YXC.cjs → chunk-LMHE4HDR.cjs} +135 -97
- package/dist/chunk-LMHE4HDR.cjs.map +1 -0
- package/dist/{chunk-AJAVVV7C.js → chunk-MOWJOFIH.js} +2 -2
- package/dist/{chunk-AUSFVOEA.js → chunk-NYIJU4Q6.js} +10 -10
- package/dist/{chunk-F7MGZMTQ.cjs → chunk-O2652KK3.cjs} +3 -3
- package/dist/{chunk-F7MGZMTQ.cjs.map → chunk-O2652KK3.cjs.map} +1 -1
- package/dist/{chunk-FZFESBG6.js → chunk-OAKJNKAS.js} +54 -16
- package/dist/chunk-OAKJNKAS.js.map +1 -0
- package/dist/{chunk-MOZCSVGA.js → chunk-PM46GSMV.js} +55 -17
- package/dist/chunk-PM46GSMV.js.map +1 -0
- package/dist/{chunk-BM4NQPJ7.js → chunk-Q3UCWUEV.js} +5 -5
- package/dist/{chunk-VVV54QND.cjs → chunk-RQ4XTX4J.cjs} +98 -98
- package/dist/{chunk-VVV54QND.cjs.map → chunk-RQ4XTX4J.cjs.map} +1 -1
- package/dist/{chunk-WHWBBUSD.js → chunk-SQ5Q4Q3R.js} +7 -7
- package/dist/{chunk-7D7CLX3U.js → chunk-SUIH5LY7.js} +2 -2
- package/dist/{chunk-BCRSFFTV.js → chunk-T5J4GW6B.js} +2 -2
- package/dist/{chunk-BHL5HQNO.js → chunk-TGLXN6VH.js} +3 -3
- package/dist/{chunk-3JKPMYNQ.js → chunk-TN5ZK2WN.js} +2 -2
- package/dist/{chunk-ASS2MVTL.cjs → chunk-UFY6XX4U.cjs} +84 -54
- package/dist/chunk-UFY6XX4U.cjs.map +1 -0
- package/dist/{chunk-H6YKDFKG.js → chunk-VL43TUO6.js} +2 -2
- package/dist/{chunk-YIWEURPR.cjs → chunk-WAFJUSUF.cjs} +6 -6
- package/dist/{chunk-YIWEURPR.cjs.map → chunk-WAFJUSUF.cjs.map} +1 -1
- package/dist/{chunk-XS3SXFUY.cjs → chunk-WPLAEJU5.cjs} +3 -3
- package/dist/{chunk-XS3SXFUY.cjs.map → chunk-WPLAEJU5.cjs.map} +1 -1
- package/dist/{chunk-TJYUA2VR.js → chunk-YLYSJSEP.js} +2 -2
- package/dist/{chunk-MXCODLV5.js → chunk-Z5TDZDWU.js} +87 -25
- package/dist/chunk-Z5TDZDWU.js.map +1 -0
- package/dist/chunks-SHXTE5HM.js +11 -0
- package/dist/cli.js +43 -43
- package/dist/{formula-FBBDRGK6.js → formula-2BQBGPM2.js} +3 -3
- package/dist/{formula-V2ZZCARY.cjs → formula-V6CNOC4G.cjs} +9 -9
- package/dist/{formula-V2ZZCARY.cjs.map → formula-V6CNOC4G.cjs.map} +1 -1
- package/dist/{formula-C46F5MG6.js → formula-W5MTLANP.js} +4 -4
- package/dist/generator-E4VQKPRP.js +10 -0
- package/dist/generator-MBR4V3JQ.js +17 -0
- package/dist/generator-U2BRFTJ4.cjs +11 -0
- package/dist/{generator-MINQI74H.cjs.map → generator-U2BRFTJ4.cjs.map} +1 -1
- package/dist/{hancom-WBVEG72Q.js → hancom-7SU4XBXJ.js} +2 -2
- package/dist/{hancom-3U6TQO6F.cjs → hancom-MP7D7HWW.cjs} +5 -5
- package/dist/{hancom-3U6TQO6F.cjs.map → hancom-MP7D7HWW.cjs.map} +1 -1
- package/dist/{hancom-P2ULOGNX.js → hancom-RNJWH63M.js} +2 -2
- package/dist/{image-ocr-7HH262GO.js → image-ocr-2WSZULNO.js} +7 -7
- package/dist/{image-ocr-G5T3YPM5.js → image-ocr-COBRSG6O.js} +10 -10
- package/dist/{image-ocr-4Y4WGZKF.cjs → image-ocr-MVOSHIY5.cjs} +27 -27
- package/dist/{image-ocr-4Y4WGZKF.cjs.map → image-ocr-MVOSHIY5.cjs.map} +1 -1
- package/dist/index.cjs +1585 -1523
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +81 -19
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +36 -36
- package/dist/memo-QJ5RKTBN.js +17 -0
- package/dist/{model-bundle-APD72FGN.js → model-bundle-LFLRW2SI.js} +5 -5
- package/dist/{models-RK4ENUTB.js → models-UGOWUUAL.js} +5 -5
- package/dist/{parse-worker-v2-TSULPUIC.js → parse-worker-v2-LCCTZWPT.js} +22 -22
- package/dist/{parser-55MAW7G3.js → parser-J56FGU6P.js} +9 -9
- package/dist/{parser-VBQTQ6K6.js → parser-JAL2OOOL.js} +12 -12
- package/dist/{parser-K275FDSR.cjs → parser-RE52HQXO.cjs} +159 -159
- package/dist/{parser-K275FDSR.cjs.map → parser-RE52HQXO.cjs.map} +1 -1
- package/dist/pdf-ocr-5O336TCR.cjs +42 -0
- package/dist/{pdf-ocr-FR4G5PDF.cjs.map → pdf-ocr-5O336TCR.cjs.map} +1 -1
- package/dist/{pdf-ocr-6AAMBNUY.js → pdf-ocr-NQ3HAL77.js} +9 -9
- package/dist/{pdf-ocr-YSEEZMJI.js → pdf-ocr-PQZZVFI5.js} +6 -6
- package/dist/{profile-io-DSBGIVPH.js → profile-io-K22CB2ZB.js} +3 -3
- package/dist/{rasterize-46HYG3R6.js → rasterize-A6B5K4QN.js} +3 -3
- package/dist/{redact-doc-GN673LJP.js → redact-doc-TPXMML5Q.js} +21 -21
- package/dist/{render-R7S7ZM3G.js → render-ROFIMWW5.js} +12 -12
- package/dist/{rewrite-fallback-J3IBHAY2.js → rewrite-fallback-WG7Z3LR3.js} +13 -13
- package/dist/seal-35U76WY2.js +16 -0
- package/dist/{setup-EFW6CWKF.js → setup-J5SHDFIE.js} +3 -3
- package/dist/to-hwpx-RWDQB3T2.cjs +16 -0
- package/dist/{to-hwpx-X7YKAFO7.cjs.map → to-hwpx-RWDQB3T2.cjs.map} +1 -1
- package/dist/{to-hwpx-6TQLW6WX.js → to-hwpx-X7JE6YJB.js} +4 -4
- package/dist/{to-hwpx-EPTNQA53.js → to-hwpx-XQULU2I7.js} +7 -7
- package/dist/visual-4HRP2VIH.js +37 -0
- package/dist/{watch-ZQPN6IBT.js → watch-WZBW6UE7.js} +22 -22
- package/package.json +1 -1
- package/dist/chunk-2QHC2YXC.cjs.map +0 -1
- package/dist/chunk-ASS2MVTL.cjs.map +0 -1
- package/dist/chunk-BXL3WAEY.js.map +0 -1
- package/dist/chunk-ELEYRONP.js.map +0 -1
- package/dist/chunk-FZFESBG6.js.map +0 -1
- package/dist/chunk-KXTTQ3RN.js.map +0 -1
- package/dist/chunk-MOZCSVGA.js.map +0 -1
- package/dist/chunk-MXCODLV5.js.map +0 -1
- package/dist/chunks-LIB2Y6AD.js +0 -11
- package/dist/generator-BNV7GC2V.js +0 -17
- package/dist/generator-CKRACBBG.js +0 -10
- package/dist/generator-MINQI74H.cjs +0 -11
- package/dist/memo-CBYIVGEA.js +0 -17
- package/dist/pdf-ocr-FR4G5PDF.cjs +0 -42
- package/dist/seal-D6PQOQJI.js +0 -16
- package/dist/to-hwpx-X7YKAFO7.cjs +0 -16
- package/dist/visual-RODVDMIJ.js +0 -37
- /package/dist/{-U63KR7FM.js.map → -PWMZE4CC.js.map} +0 -0
- /package/dist/{chunk-56HJNAU2.js.map → chunk-2VXVBB5Q.js.map} +0 -0
- /package/dist/{chunk-YOMV4HR6.js.map → chunk-56FEGA44.js.map} +0 -0
- /package/dist/{chunk-E6OSXYA4.js.map → chunk-57BKTVR5.js.map} +0 -0
- /package/dist/{chunk-B3BUBTAB.js.map → chunk-AB7MYMPZ.js.map} +0 -0
- /package/dist/{chunk-3DV5MIZK.js.map → chunk-AO3YFJVW.js.map} +0 -0
- /package/dist/{chunk-WK3QLJCE.js.map → chunk-AYM7XTI2.js.map} +0 -0
- /package/dist/{chunk-JKBJDB6X.js.map → chunk-BO2IJGNZ.js.map} +0 -0
- /package/dist/{chunk-FZRETZG3.js.map → chunk-BP5GDQBT.js.map} +0 -0
- /package/dist/{chunk-U4MF5C62.js.map → chunk-CQ33HCSU.js.map} +0 -0
- /package/dist/{chunk-HMTXDJZA.js.map → chunk-FI7ULBC6.js.map} +0 -0
- /package/dist/{chunk-NKWF62JV.js.map → chunk-FOTG4MMD.js.map} +0 -0
- /package/dist/{chunk-U453MJJB.js.map → chunk-GRQXAWNW.js.map} +0 -0
- /package/dist/{chunk-W7BLAMBO.js.map → chunk-HFQFCAEJ.js.map} +0 -0
- /package/dist/{chunk-MVLVCUBP.js.map → chunk-HMD35PMD.js.map} +0 -0
- /package/dist/{chunk-MKJRT3PP.js.map → chunk-IWC6PTMT.js.map} +0 -0
- /package/dist/{chunk-5IEBL77T.js.map → chunk-KIVWAZKL.js.map} +0 -0
- /package/dist/{chunk-HHORHT5O.js.map → chunk-KSE5HSU3.js.map} +0 -0
- /package/dist/{chunk-HVVPLWQD.js.map → chunk-LEUAWTMU.js.map} +0 -0
- /package/dist/{chunk-AJAVVV7C.js.map → chunk-MOWJOFIH.js.map} +0 -0
- /package/dist/{chunk-AUSFVOEA.js.map → chunk-NYIJU4Q6.js.map} +0 -0
- /package/dist/{chunk-BM4NQPJ7.js.map → chunk-Q3UCWUEV.js.map} +0 -0
- /package/dist/{chunk-WHWBBUSD.js.map → chunk-SQ5Q4Q3R.js.map} +0 -0
- /package/dist/{chunk-7D7CLX3U.js.map → chunk-SUIH5LY7.js.map} +0 -0
- /package/dist/{chunk-BCRSFFTV.js.map → chunk-T5J4GW6B.js.map} +0 -0
- /package/dist/{chunk-BHL5HQNO.js.map → chunk-TGLXN6VH.js.map} +0 -0
- /package/dist/{chunk-3JKPMYNQ.js.map → chunk-TN5ZK2WN.js.map} +0 -0
- /package/dist/{chunk-H6YKDFKG.js.map → chunk-VL43TUO6.js.map} +0 -0
- /package/dist/{chunk-TJYUA2VR.js.map → chunk-YLYSJSEP.js.map} +0 -0
- /package/dist/{chunks-LIB2Y6AD.js.map → chunks-SHXTE5HM.js.map} +0 -0
- /package/dist/{formula-FBBDRGK6.js.map → formula-2BQBGPM2.js.map} +0 -0
- /package/dist/{formula-C46F5MG6.js.map → formula-W5MTLANP.js.map} +0 -0
- /package/dist/{generator-BNV7GC2V.js.map → generator-E4VQKPRP.js.map} +0 -0
- /package/dist/{generator-CKRACBBG.js.map → generator-MBR4V3JQ.js.map} +0 -0
- /package/dist/{hancom-WBVEG72Q.js.map → hancom-7SU4XBXJ.js.map} +0 -0
- /package/dist/{hancom-P2ULOGNX.js.map → hancom-RNJWH63M.js.map} +0 -0
- /package/dist/{image-ocr-7HH262GO.js.map → image-ocr-2WSZULNO.js.map} +0 -0
- /package/dist/{image-ocr-G5T3YPM5.js.map → image-ocr-COBRSG6O.js.map} +0 -0
- /package/dist/{memo-CBYIVGEA.js.map → memo-QJ5RKTBN.js.map} +0 -0
- /package/dist/{model-bundle-APD72FGN.js.map → model-bundle-LFLRW2SI.js.map} +0 -0
- /package/dist/{models-RK4ENUTB.js.map → models-UGOWUUAL.js.map} +0 -0
- /package/dist/{parse-worker-v2-TSULPUIC.js.map → parse-worker-v2-LCCTZWPT.js.map} +0 -0
- /package/dist/{parser-55MAW7G3.js.map → parser-J56FGU6P.js.map} +0 -0
- /package/dist/{parser-VBQTQ6K6.js.map → parser-JAL2OOOL.js.map} +0 -0
- /package/dist/{pdf-ocr-6AAMBNUY.js.map → pdf-ocr-NQ3HAL77.js.map} +0 -0
- /package/dist/{pdf-ocr-YSEEZMJI.js.map → pdf-ocr-PQZZVFI5.js.map} +0 -0
- /package/dist/{profile-io-DSBGIVPH.js.map → profile-io-K22CB2ZB.js.map} +0 -0
- /package/dist/{rasterize-46HYG3R6.js.map → rasterize-A6B5K4QN.js.map} +0 -0
- /package/dist/{redact-doc-GN673LJP.js.map → redact-doc-TPXMML5Q.js.map} +0 -0
- /package/dist/{render-R7S7ZM3G.js.map → render-ROFIMWW5.js.map} +0 -0
- /package/dist/{rewrite-fallback-J3IBHAY2.js.map → rewrite-fallback-WG7Z3LR3.js.map} +0 -0
- /package/dist/{seal-D6PQOQJI.js.map → seal-35U76WY2.js.map} +0 -0
- /package/dist/{setup-EFW6CWKF.js.map → setup-J5SHDFIE.js.map} +0 -0
- /package/dist/{to-hwpx-6TQLW6WX.js.map → to-hwpx-X7JE6YJB.js.map} +0 -0
- /package/dist/{to-hwpx-EPTNQA53.js.map → to-hwpx-XQULU2I7.js.map} +0 -0
- /package/dist/{visual-RODVDMIJ.js.map → visual-4HRP2VIH.js.map} +0 -0
- /package/dist/{watch-ZQPN6IBT.js.map → watch-WZBW6UE7.js.map} +0 -0
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
HEADING_RATIO_H3,
|
|
7
7
|
tidyScriptTags,
|
|
8
8
|
toTex
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2CBIY2OH.js";
|
|
10
10
|
import {
|
|
11
11
|
safeMax,
|
|
12
12
|
safeMin
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-57BKTVR5.js";
|
|
14
14
|
|
|
15
15
|
// src/ocr/line-split.ts
|
|
16
16
|
function grayCrop(rgba, pageW, box) {
|
|
@@ -951,6 +951,13 @@ function leadingBullet(gray, w, h, ink, firstX, squareMax = 0.92) {
|
|
|
951
951
|
if (!mark) return null;
|
|
952
952
|
return { mark, covers: firstX <= x1 + ch * 0.3 };
|
|
953
953
|
}
|
|
954
|
+
var STACK_INK_RATIO = 1.6;
|
|
955
|
+
function stackedGlyphBands(gray, w, h, ink) {
|
|
956
|
+
const ib = inkBounds(gray, w, h, ink);
|
|
957
|
+
if (ib.y1 - ib.y0 < STACK_INK_RATIO * (ib.x1 - ib.x0)) return null;
|
|
958
|
+
const bands = splitRowBands(gray, w, h, ink, 0.45);
|
|
959
|
+
return bands.length >= 2 && bands.length <= 4 ? bands : null;
|
|
960
|
+
}
|
|
954
961
|
|
|
955
962
|
// src/ocr/text-gaps.ts
|
|
956
963
|
var evidence = /* @__PURE__ */ new WeakMap();
|
|
@@ -1524,6 +1531,7 @@ var EDGE_INSET = 15;
|
|
|
1524
1531
|
var EDGE_NEAR = 10;
|
|
1525
1532
|
var EDGE_CONNECT_TOL = 5;
|
|
1526
1533
|
var EDGE_YGAP_SPLIT_K = 2.5;
|
|
1534
|
+
var EDGE_FRAME_WIDTH_K = 1.5;
|
|
1527
1535
|
var EDGE_YGAP_ABS_MIN = 30;
|
|
1528
1536
|
var CHAIN_Y_TOL = 1.5;
|
|
1529
1537
|
var CHAIN_GAP = 3;
|
|
@@ -1576,6 +1584,13 @@ function closeOpenTableEdges(horizontals, verticals) {
|
|
|
1576
1584
|
for (let i = 1; i < sorted.length; i++) gaps.push(sorted[i].y1 - sorted[i - 1].y1);
|
|
1577
1585
|
const median3 = gaps.length ? [...gaps].sort((a, b) => a - b)[gaps.length >> 1] : 0;
|
|
1578
1586
|
const threshold = median3 * EDGE_YGAP_SPLIT_K;
|
|
1587
|
+
const thin = Math.min(...sorted.map((l) => l.lineWidth));
|
|
1588
|
+
const frame = (l) => thin > 0 && l.lineWidth >= thin * EDGE_FRAME_WIDTH_K;
|
|
1589
|
+
const frameEnd = (from, step) => {
|
|
1590
|
+
if (!frame(sorted[from])) return -1;
|
|
1591
|
+
for (let j = from + step; j >= 0 && j < sorted.length; j += step) if (frame(sorted[j])) return Math.abs(j - from) >= EDGE_MIN_RULES - 1 ? j : -1;
|
|
1592
|
+
return -1;
|
|
1593
|
+
};
|
|
1579
1594
|
let cur = sorted.length ? [sorted[0]] : [];
|
|
1580
1595
|
for (let i = 1; i < sorted.length; i++) {
|
|
1581
1596
|
const yLo = sorted[i - 1].y1, yHi = sorted[i].y1;
|
|
@@ -1583,7 +1598,8 @@ function closeOpenTableEdges(horizontals, verticals) {
|
|
|
1583
1598
|
const gx1 = Math.min(sorted[i - 1].x1, sorted[i].x1);
|
|
1584
1599
|
const gx2 = Math.max(sorted[i - 1].x2, sorted[i].x2);
|
|
1585
1600
|
const bridged = verticals.some((vl) => vl.y1 <= yLo + EDGE_NEAR && vl.y2 >= yHi - EDGE_NEAR && vl.x1 >= gx1 - EDGE_CONNECT_TOL && vl.x1 <= gx2 + EDGE_CONNECT_TOL);
|
|
1586
|
-
|
|
1601
|
+
const between = gap > threshold || frameEnd(i - 1, -1) >= 0 && frameEnd(i, 1) >= 0;
|
|
1602
|
+
if (median3 > 0 && between && gap > EDGE_YGAP_ABS_MIN && !bridged && cur.length >= EDGE_MIN_RULES && sorted.length - i >= EDGE_MIN_RULES) {
|
|
1587
1603
|
splitGroups.push(cur);
|
|
1588
1604
|
cur = [];
|
|
1589
1605
|
}
|
|
@@ -4020,12 +4036,17 @@ function anchoredSubRows(byCol, minLines, covered) {
|
|
|
4020
4036
|
const pitches = ys.slice(1).map((y, i) => Math.abs(ys[i] - y)).sort((x, y) => x - y), pitch = pitches[pitches.length >> 1] ?? 0;
|
|
4021
4037
|
const numericCols = byCol.every((lines, c) => c === a || vertical[c] || lines.every((line) => NUMERIC_LINE.test(cellTextToString(line).trim()) || /^[-–—]$/.test(cellTextToString(line).trim())));
|
|
4022
4038
|
const tol = numericCols ? Math.max(h * ALIGNED_LINE_TOL, pitch * 0.4) : h * ALIGNED_LINE_TOL;
|
|
4039
|
+
const valueColsNumeric = byCol.every((lines, c) => c === 0 || c === a || lines.every((line) => NUMERIC_LINE.test(cellTextToString(line).trim()) || /^[-–—]$/.test(cellTextToString(line).trim())));
|
|
4023
4040
|
const rows = Array.from({ length: k }, () => byCol.map(() => ""));
|
|
4024
4041
|
for (let c = 0; c < byCol.length; c++) {
|
|
4025
4042
|
if (vertical[c]) {
|
|
4026
4043
|
if (!covered[c]) rows[0][c] = byCol[c].map((line) => cellTextToString(line).trim()).join("");
|
|
4027
4044
|
continue;
|
|
4028
4045
|
}
|
|
4046
|
+
if (c === 0 && c !== a && valueColsNumeric && byCol[c].length < k && byCol[c].every((line) => !NUMERIC_LINE.test(cellTextToString(line).trim())) && byCol[c].some((line) => Math.min(...ys.map((y) => Math.abs(y - cy(line)))) > tol)) {
|
|
4047
|
+
if (!covered[c]) rows[0][c] = byCol[c].map((line) => cellTextToString(line).trim()).join(" ");
|
|
4048
|
+
continue;
|
|
4049
|
+
}
|
|
4029
4050
|
const used = /* @__PURE__ */ new Set();
|
|
4030
4051
|
for (const line of byCol[c]) {
|
|
4031
4052
|
const y = cy(line);
|
|
@@ -4065,7 +4086,8 @@ function normalizeUndersegmentedTable(originalCells, colXs, items, rowYs, kept,
|
|
|
4065
4086
|
const body = normalizeUndersegmentedTable([originalCells[r]], colXs, rowItems, void 0, void 0, void 0, band > 1 ? 2 : MIN_ALIGNED_LINES);
|
|
4066
4087
|
if (body) {
|
|
4067
4088
|
originalCells[r].forEach((cell, c) => {
|
|
4068
|
-
|
|
4089
|
+
const cols = Array.from({ length: Math.max(1, cell.colSpan ?? 1) }, (_, k) => c + k);
|
|
4090
|
+
if (cell.text.trim() && body.every((cells) => cols.every((k) => !cells[k]?.trim()))) body[0][c] = cell.text;
|
|
4069
4091
|
});
|
|
4070
4092
|
rebuilt2.push(...body);
|
|
4071
4093
|
expanded++;
|
|
@@ -7901,7 +7923,8 @@ function ocrGutterVerticals(grids, items) {
|
|
|
7901
7923
|
for (const g of support) gaps.splice(gaps.indexOf(g), 1);
|
|
7902
7924
|
if (x - x0 < margin || x1 - x < margin) continue;
|
|
7903
7925
|
const supportLines = new Set(support.map((g) => lines[g.line].y));
|
|
7904
|
-
|
|
7926
|
+
const minSupport = valueLines === 2 && supportLines.size === 2 ? 2 : Math.max(3, valueLines * 0.4);
|
|
7927
|
+
if (supportLines.size < minSupport) continue;
|
|
7905
7928
|
const rows = grid.rowYs.length - 1;
|
|
7906
7929
|
const supportIn = (r) => [...supportLines].filter((y) => y < grid.rowYs[r] && y > grid.rowYs[r + 1]).length;
|
|
7907
7930
|
const blocked = Array.from({ length: rows }, (_, r) => lines.filter((l) => l.y < grid.rowYs[r] && l.y > grid.rowYs[r + 1] && l.cover.some((sp) => sp.estimated ? x - sp.left > size * 0.6 && sp.right - x > size * 0.6 : sp.left < x - 0.5 && sp.right > x + 0.5)).length > supportIn(r) * 0.25);
|
|
@@ -7919,7 +7942,7 @@ function ocrGutterVerticals(grids, items) {
|
|
|
7919
7942
|
}
|
|
7920
7943
|
r = e;
|
|
7921
7944
|
}
|
|
7922
|
-
if (!bestRun || bestCount < 3) continue;
|
|
7945
|
+
if (!bestRun || bestCount < Math.min(3, minSupport)) continue;
|
|
7923
7946
|
const list = out.get(grid) ?? [];
|
|
7924
7947
|
list.push({ x1: x, y1: grid.rowYs[bestRun[1]], x2: x, y2: grid.rowYs[bestRun[0]], lineWidth: 0.5 });
|
|
7925
7948
|
out.set(grid, list);
|
|
@@ -10107,7 +10130,13 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10107
10130
|
})();
|
|
10108
10131
|
const layoutProse = irGrid.some((row) => row.some((c) => c.colSpan >= numCols - 1 && c.text.length > 60));
|
|
10109
10132
|
const maxRows = numericBody ? layoutProse ? OCR_NUMERIC_MAX_ROWS_FRAMED : OCR_NUMERIC_MAX_ROWS : 5;
|
|
10110
|
-
|
|
10133
|
+
const proseLine = (t) => (t.match(/[가-힣]/g)?.length ?? 0) > 6 && !/^[-−]?[\d,.]+$/.test(t.replace(/\s+/g, ""));
|
|
10134
|
+
const proseCols = numRows === 2 ? (irGrid[1] ?? []).filter((c) => {
|
|
10135
|
+
const ls = c.text.split("\n").map((t) => t.trim()).filter(Boolean);
|
|
10136
|
+
return ls.length >= 3 && ls.filter(proseLine).length >= ls.length * 0.6;
|
|
10137
|
+
}).length : 0;
|
|
10138
|
+
const twoRowOk = !ocrPage || proseCols < 2;
|
|
10139
|
+
if (!grid.cells && numRows <= maxRows && numCols >= 3 && !nestedAttached && (numRows <= 2 ? twoRowOk : unitLine.length > 0 || numericBody)) {
|
|
10111
10140
|
const kept = /* @__PURE__ */ new Map();
|
|
10112
10141
|
const rebuilt = normalizeUndersegmentedTable(irGrid, grid.colXs, textItems, grid.rowYs, kept, maxRows);
|
|
10113
10142
|
if (rebuilt) {
|
|
@@ -10902,6 +10931,7 @@ export {
|
|
|
10902
10931
|
starRun,
|
|
10903
10932
|
bracketShape,
|
|
10904
10933
|
leadingBullet,
|
|
10934
|
+
stackedGlyphBands,
|
|
10905
10935
|
rememberOcrTextGaps,
|
|
10906
10936
|
copyOcrTextGaps,
|
|
10907
10937
|
findOcrTextGaps,
|
|
@@ -10959,4 +10989,4 @@ export {
|
|
|
10959
10989
|
UNRULED_REGION_TABLES,
|
|
10960
10990
|
mergeOcrImageRegions
|
|
10961
10991
|
};
|
|
10962
|
-
//# sourceMappingURL=chunk-
|
|
10992
|
+
//# sourceMappingURL=chunk-4MNRUPS5.js.map
|