kordoc 4.24.69 → 4.24.71
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 +4 -4
- package/dist/{-KG4BXVPV.js → -F7GLIIGT.js} +21 -21
- package/dist/{chunk-3MQXPZ6R.js → chunk-2CPEW6WC.js} +3 -3
- package/dist/{chunk-3LYXCBQ6.js → chunk-2OF2YWIZ.js} +2 -2
- package/dist/{chunk-PZ7NOQHD.js → chunk-2VBRCIPI.js} +2 -2
- package/dist/{chunk-OWYYRDZR.js → chunk-5WWGC5SG.js} +2 -2
- package/dist/{chunk-LERHV2DV.js → chunk-6ZA4V4QS.js} +2 -2
- package/dist/{chunk-EBBPXRLU.js → chunk-7KVDHXP2.js} +4 -4
- package/dist/{chunk-YBV3DCBB.js → chunk-AUHQRRKM.js} +3 -3
- package/dist/{chunk-6RAP7IYO.js → chunk-BHYBZSOC.js} +2 -2
- package/dist/{chunk-YYGN4RAC.cjs → chunk-BNP3WXTB.cjs} +3 -3
- package/dist/{chunk-YYGN4RAC.cjs.map → chunk-BNP3WXTB.cjs.map} +1 -1
- package/dist/{chunk-53KBBSHJ.js → chunk-D4UFBXMT.js} +2 -2
- package/dist/{chunk-QXZZ37WG.js → chunk-DSCT67WF.js} +3 -3
- package/dist/{chunk-C3OMT5XO.js → chunk-EZNUMAAJ.js} +2 -2
- package/dist/{chunk-4NPX2NIK.js → chunk-GFAWIBHG.js} +10 -10
- package/dist/{chunk-KXVMRGSM.js → chunk-GRCIFCGC.js} +2 -2
- package/dist/{chunk-SQXRRR75.cjs → chunk-H2VOH7X3.cjs} +246 -198
- package/dist/chunk-H2VOH7X3.cjs.map +1 -0
- package/dist/{chunk-AAIU5QXZ.js → chunk-HIYRMYAS.js} +2 -2
- package/dist/{chunk-OYXFVDEL.js → chunk-IMT5TVVM.js} +2 -2
- package/dist/{chunk-KCA54CHN.js → chunk-KGCJNPAI.js} +5 -5
- package/dist/{chunk-EM6II5KB.js → chunk-KLUI4SAZ.js} +2 -2
- package/dist/{chunk-4SKZG3K4.cjs → chunk-LFTO5QAP.cjs} +2 -2
- package/dist/{chunk-4SKZG3K4.cjs.map → chunk-LFTO5QAP.cjs.map} +1 -1
- package/dist/{chunk-4P4ZWHNQ.js → chunk-LNWURZ2Z.js} +7 -7
- package/dist/{chunk-V37SADMF.js → chunk-M27VBFO6.js} +83 -35
- package/dist/chunk-M27VBFO6.js.map +1 -0
- package/dist/{chunk-I776RNAM.js → chunk-MHXPW72E.js} +2 -2
- package/dist/{chunk-YJA4HQUO.js → chunk-NPBNJCXZ.js} +2 -2
- package/dist/{chunk-3APUYEC6.js → chunk-O7PJFEOC.js} +2 -2
- package/dist/{chunk-3CUPBG7W.js → chunk-OJK4FLS5.js} +3 -3
- package/dist/{chunk-U456OELH.js → chunk-OUHMNF2A.js} +2 -2
- package/dist/{chunk-AQSU4NAT.cjs → chunk-OW2XKTQA.cjs} +8 -8
- package/dist/{chunk-AQSU4NAT.cjs.map → chunk-OW2XKTQA.cjs.map} +1 -1
- package/dist/{chunk-ZPSCL2UV.js → chunk-QK5KCWLE.js} +2 -2
- package/dist/{chunk-FQHTZNNA.js → chunk-RUUUGCXS.js} +6 -6
- package/dist/{chunk-MQHAFMEU.js → chunk-RWU3Y5YK.js} +15 -15
- package/dist/{chunk-5ZDXCGBI.cjs → chunk-SK5AOGYK.cjs} +104 -104
- package/dist/{chunk-5ZDXCGBI.cjs.map → chunk-SK5AOGYK.cjs.map} +1 -1
- package/dist/{chunk-6ZWX733V.js → chunk-SMEBVDM2.js} +7 -6
- package/dist/chunk-SMEBVDM2.js.map +1 -0
- package/dist/{chunk-R32ERRRI.js → chunk-T7MHZIFG.js} +84 -36
- package/dist/chunk-T7MHZIFG.js.map +1 -0
- package/dist/{chunk-GMTI7GBK.js → chunk-TYGZ6O2A.js} +11 -11
- package/dist/{chunk-OEBMM2WZ.js → chunk-UJQRIX4L.js} +2 -2
- package/dist/{chunk-XHAM4CGG.js → chunk-WMA4GJHC.js} +7 -6
- package/dist/chunk-WMA4GJHC.js.map +1 -0
- package/dist/{chunk-6T2QXCFD.cjs → chunk-YISBYF7X.cjs} +60 -59
- package/dist/chunk-YISBYF7X.cjs.map +1 -0
- package/dist/{chunk-OZWNUIUS.cjs → chunk-YJ2YVG6N.cjs} +88 -88
- package/dist/{chunk-OZWNUIUS.cjs.map → chunk-YJ2YVG6N.cjs.map} +1 -1
- package/dist/{chunk-JDHX44G4.js → chunk-YPRIJDH6.js} +2 -2
- package/dist/{chunk-ONKURIVQ.js → chunk-YTDHH362.js} +2 -2
- package/dist/{chunk-6RWM6WRI.cjs → chunk-YTP7FPA5.cjs} +3 -3
- package/dist/{chunk-6RWM6WRI.cjs.map → chunk-YTP7FPA5.cjs.map} +1 -1
- package/dist/{chunk-MHRKKMCS.js → chunk-ZPJZXTEG.js} +6 -6
- package/dist/chunks-JAD5Z5YY.js +11 -0
- package/dist/cli.js +45 -45
- package/dist/{formula-ACYUF2DL.js → formula-3PJYUQMG.js} +4 -4
- package/dist/{formula-4HIPZCUM.cjs → formula-RTPZD2IM.cjs} +9 -9
- package/dist/{formula-4HIPZCUM.cjs.map → formula-RTPZD2IM.cjs.map} +1 -1
- package/dist/{formula-TO3RLKBZ.js → formula-UJF4RZ6W.js} +3 -3
- package/dist/generator-EB2436BE.js +18 -0
- package/dist/generator-INMUN6KB.cjs +12 -0
- package/dist/{generator-UAEKNWCY.cjs.map → generator-INMUN6KB.cjs.map} +1 -1
- package/dist/generator-K5KMPSLC.js +11 -0
- package/dist/{hancom-4FAVUJFH.cjs → hancom-MVPEYI4X.cjs} +5 -5
- package/dist/{hancom-4FAVUJFH.cjs.map → hancom-MVPEYI4X.cjs.map} +1 -1
- package/dist/{hancom-JLRWAJ7K.js → hancom-P3SUQXM4.js} +2 -2
- package/dist/{hancom-FCNE5FBM.js → hancom-RYIZHWJ5.js} +2 -2
- package/dist/{image-ocr-53K5Y7RJ.js → image-ocr-GL5YVCNU.js} +10 -10
- package/dist/{image-ocr-HGYEY56S.cjs → image-ocr-ZS4EMQN3.cjs} +28 -28
- package/dist/{image-ocr-HGYEY56S.cjs.map → image-ocr-ZS4EMQN3.cjs.map} +1 -1
- package/dist/{image-ocr-ZIHIC6E7.js → image-ocr-ZXLHPQI2.js} +7 -7
- package/dist/index.cjs +1115 -1115
- package/dist/index.js +9 -9
- package/dist/mcp.js +36 -36
- package/dist/memo-JNMSGIO7.js +17 -0
- package/dist/{model-bundle-VR77PCZE.js → model-bundle-VCUAKBF3.js} +5 -5
- package/dist/{models-CLF7ODRG.js → models-UACAGYBI.js} +5 -5
- package/dist/{parse-worker-v2-WXRS3WBA.js → parse-worker-v2-LJB4QXGF.js} +22 -22
- package/dist/{parser-LKSBUPHG.js → parser-5GZUD22P.js} +12 -12
- package/dist/{parser-H27KVKB7.js → parser-HCZD4DUO.js} +9 -9
- package/dist/{parser-7UHFKMVL.cjs → parser-T4HAQ3QW.cjs} +166 -166
- package/dist/{parser-7UHFKMVL.cjs.map → parser-T4HAQ3QW.cjs.map} +1 -1
- package/dist/pdf-ocr-H4DKZSOB.cjs +43 -0
- package/dist/{pdf-ocr-Z22C7K6C.cjs.map → pdf-ocr-H4DKZSOB.cjs.map} +1 -1
- package/dist/{pdf-ocr-AYLXK6OF.js → pdf-ocr-JXVGK5MR.js} +6 -6
- package/dist/{pdf-ocr-ABMCDMIV.js → pdf-ocr-YCMC2VL4.js} +9 -9
- package/dist/{profile-io-HGOQULXZ.js → profile-io-MVTEOXAU.js} +3 -3
- package/dist/{rasterize-5RWYKMSP.js → rasterize-VWT3C3RW.js} +3 -3
- package/dist/{redact-doc-HNKVSOLJ.js → redact-doc-SU3JDC6F.js} +21 -21
- package/dist/{render-TUDHFNDV.js → render-D5N4FKWB.js} +12 -12
- package/dist/{rewrite-fallback-EWVH2MR4.js → rewrite-fallback-QXTWSPGY.js} +13 -13
- package/dist/seal-Q3BD6CRB.js +16 -0
- package/dist/{setup-5EEOZUUH.js → setup-TXNJYX6P.js} +3 -3
- package/dist/to-hwpx-KZTTH7EY.cjs +16 -0
- package/dist/{to-hwpx-RNZ72ZYF.cjs.map → to-hwpx-KZTTH7EY.cjs.map} +1 -1
- package/dist/{to-hwpx-UHNIAQ2L.js → to-hwpx-YHGVFTBO.js} +4 -4
- package/dist/{to-hwpx-6KY7WGVN.js → to-hwpx-Z7NHUMUD.js} +7 -7
- package/dist/visual-LNHFYJDL.js +38 -0
- package/dist/{watch-SZJOKRCO.js → watch-EI5QYDT2.js} +22 -22
- package/package.json +1 -1
- package/dist/chunk-6T2QXCFD.cjs.map +0 -1
- package/dist/chunk-6ZWX733V.js.map +0 -1
- package/dist/chunk-R32ERRRI.js.map +0 -1
- package/dist/chunk-SQXRRR75.cjs.map +0 -1
- package/dist/chunk-V37SADMF.js.map +0 -1
- package/dist/chunk-XHAM4CGG.js.map +0 -1
- package/dist/chunks-HN36MEGV.js +0 -11
- package/dist/generator-5NUDHWLL.js +0 -11
- package/dist/generator-K2CNNN64.js +0 -18
- package/dist/generator-UAEKNWCY.cjs +0 -12
- package/dist/memo-ALIRNVIU.js +0 -17
- package/dist/pdf-ocr-Z22C7K6C.cjs +0 -43
- package/dist/seal-R6WDXSRI.js +0 -16
- package/dist/to-hwpx-RNZ72ZYF.cjs +0 -16
- package/dist/visual-Z5HND4S7.js +0 -38
- /package/dist/{-KG4BXVPV.js.map → -F7GLIIGT.js.map} +0 -0
- /package/dist/{chunk-3MQXPZ6R.js.map → chunk-2CPEW6WC.js.map} +0 -0
- /package/dist/{chunk-3LYXCBQ6.js.map → chunk-2OF2YWIZ.js.map} +0 -0
- /package/dist/{chunk-PZ7NOQHD.js.map → chunk-2VBRCIPI.js.map} +0 -0
- /package/dist/{chunk-OWYYRDZR.js.map → chunk-5WWGC5SG.js.map} +0 -0
- /package/dist/{chunk-LERHV2DV.js.map → chunk-6ZA4V4QS.js.map} +0 -0
- /package/dist/{chunk-EBBPXRLU.js.map → chunk-7KVDHXP2.js.map} +0 -0
- /package/dist/{chunk-YBV3DCBB.js.map → chunk-AUHQRRKM.js.map} +0 -0
- /package/dist/{chunk-6RAP7IYO.js.map → chunk-BHYBZSOC.js.map} +0 -0
- /package/dist/{chunk-53KBBSHJ.js.map → chunk-D4UFBXMT.js.map} +0 -0
- /package/dist/{chunk-QXZZ37WG.js.map → chunk-DSCT67WF.js.map} +0 -0
- /package/dist/{chunk-C3OMT5XO.js.map → chunk-EZNUMAAJ.js.map} +0 -0
- /package/dist/{chunk-4NPX2NIK.js.map → chunk-GFAWIBHG.js.map} +0 -0
- /package/dist/{chunk-KXVMRGSM.js.map → chunk-GRCIFCGC.js.map} +0 -0
- /package/dist/{chunk-AAIU5QXZ.js.map → chunk-HIYRMYAS.js.map} +0 -0
- /package/dist/{chunk-OYXFVDEL.js.map → chunk-IMT5TVVM.js.map} +0 -0
- /package/dist/{chunk-KCA54CHN.js.map → chunk-KGCJNPAI.js.map} +0 -0
- /package/dist/{chunk-EM6II5KB.js.map → chunk-KLUI4SAZ.js.map} +0 -0
- /package/dist/{chunk-4P4ZWHNQ.js.map → chunk-LNWURZ2Z.js.map} +0 -0
- /package/dist/{chunk-I776RNAM.js.map → chunk-MHXPW72E.js.map} +0 -0
- /package/dist/{chunk-YJA4HQUO.js.map → chunk-NPBNJCXZ.js.map} +0 -0
- /package/dist/{chunk-3APUYEC6.js.map → chunk-O7PJFEOC.js.map} +0 -0
- /package/dist/{chunk-3CUPBG7W.js.map → chunk-OJK4FLS5.js.map} +0 -0
- /package/dist/{chunk-U456OELH.js.map → chunk-OUHMNF2A.js.map} +0 -0
- /package/dist/{chunk-ZPSCL2UV.js.map → chunk-QK5KCWLE.js.map} +0 -0
- /package/dist/{chunk-FQHTZNNA.js.map → chunk-RUUUGCXS.js.map} +0 -0
- /package/dist/{chunk-MQHAFMEU.js.map → chunk-RWU3Y5YK.js.map} +0 -0
- /package/dist/{chunk-GMTI7GBK.js.map → chunk-TYGZ6O2A.js.map} +0 -0
- /package/dist/{chunk-OEBMM2WZ.js.map → chunk-UJQRIX4L.js.map} +0 -0
- /package/dist/{chunk-JDHX44G4.js.map → chunk-YPRIJDH6.js.map} +0 -0
- /package/dist/{chunk-ONKURIVQ.js.map → chunk-YTDHH362.js.map} +0 -0
- /package/dist/{chunk-MHRKKMCS.js.map → chunk-ZPJZXTEG.js.map} +0 -0
- /package/dist/{chunks-HN36MEGV.js.map → chunks-JAD5Z5YY.js.map} +0 -0
- /package/dist/{formula-ACYUF2DL.js.map → formula-3PJYUQMG.js.map} +0 -0
- /package/dist/{formula-TO3RLKBZ.js.map → formula-UJF4RZ6W.js.map} +0 -0
- /package/dist/{generator-5NUDHWLL.js.map → generator-EB2436BE.js.map} +0 -0
- /package/dist/{generator-K2CNNN64.js.map → generator-K5KMPSLC.js.map} +0 -0
- /package/dist/{hancom-JLRWAJ7K.js.map → hancom-P3SUQXM4.js.map} +0 -0
- /package/dist/{hancom-FCNE5FBM.js.map → hancom-RYIZHWJ5.js.map} +0 -0
- /package/dist/{image-ocr-53K5Y7RJ.js.map → image-ocr-GL5YVCNU.js.map} +0 -0
- /package/dist/{image-ocr-ZIHIC6E7.js.map → image-ocr-ZXLHPQI2.js.map} +0 -0
- /package/dist/{memo-ALIRNVIU.js.map → memo-JNMSGIO7.js.map} +0 -0
- /package/dist/{model-bundle-VR77PCZE.js.map → model-bundle-VCUAKBF3.js.map} +0 -0
- /package/dist/{models-CLF7ODRG.js.map → models-UACAGYBI.js.map} +0 -0
- /package/dist/{parse-worker-v2-WXRS3WBA.js.map → parse-worker-v2-LJB4QXGF.js.map} +0 -0
- /package/dist/{parser-LKSBUPHG.js.map → parser-5GZUD22P.js.map} +0 -0
- /package/dist/{parser-H27KVKB7.js.map → parser-HCZD4DUO.js.map} +0 -0
- /package/dist/{pdf-ocr-ABMCDMIV.js.map → pdf-ocr-JXVGK5MR.js.map} +0 -0
- /package/dist/{pdf-ocr-AYLXK6OF.js.map → pdf-ocr-YCMC2VL4.js.map} +0 -0
- /package/dist/{profile-io-HGOQULXZ.js.map → profile-io-MVTEOXAU.js.map} +0 -0
- /package/dist/{rasterize-5RWYKMSP.js.map → rasterize-VWT3C3RW.js.map} +0 -0
- /package/dist/{redact-doc-HNKVSOLJ.js.map → redact-doc-SU3JDC6F.js.map} +0 -0
- /package/dist/{render-TUDHFNDV.js.map → render-D5N4FKWB.js.map} +0 -0
- /package/dist/{rewrite-fallback-EWVH2MR4.js.map → rewrite-fallback-QXTWSPGY.js.map} +0 -0
- /package/dist/{seal-R6WDXSRI.js.map → seal-Q3BD6CRB.js.map} +0 -0
- /package/dist/{setup-5EEOZUUH.js.map → setup-TXNJYX6P.js.map} +0 -0
- /package/dist/{to-hwpx-6KY7WGVN.js.map → to-hwpx-YHGVFTBO.js.map} +0 -0
- /package/dist/{to-hwpx-UHNIAQ2L.js.map → to-hwpx-Z7NHUMUD.js.map} +0 -0
- /package/dist/{visual-Z5HND4S7.js.map → visual-LNHFYJDL.js.map} +0 -0
- /package/dist/{watch-SZJOKRCO.js.map → watch-EI5QYDT2.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureModelsIn,
|
|
3
3
|
getModelsDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KLUI4SAZ.js";
|
|
5
5
|
import {
|
|
6
6
|
CELL_EDGES,
|
|
7
7
|
HEADING_RATIO_H1,
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
HEADING_RATIO_H3,
|
|
10
10
|
tidyScriptTags,
|
|
11
11
|
toTex
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MHXPW72E.js";
|
|
13
13
|
import {
|
|
14
14
|
safeMax,
|
|
15
15
|
safeMin
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2VBRCIPI.js";
|
|
17
17
|
|
|
18
18
|
// src/ocr/models.ts
|
|
19
19
|
import { join } from "path";
|
|
@@ -3778,7 +3778,7 @@ function particleContinues(left, rightWord) {
|
|
|
3778
3778
|
if (ADNOMINAL_HAN.test(right)) return h.length >= 2 && !auxBefore(h) && !/(?:는|은|한|다|어|년)$/.test(h);
|
|
3779
3779
|
return VERB_FORM.test(right) && !auxBefore(h) && !((last === "\uC774" || last === "\uAC00" && h.length >= 3) && BECOME.test(right));
|
|
3780
3780
|
}
|
|
3781
|
-
var ITEM_HEAD = /^(?:[□■◆◇○●◎◦▪▫•※▶▷►❍❏❑✓✔➢➤☞]|[①-⑳]|[
|
|
3781
|
+
var ITEM_HEAD = /^(?:[□■◆◇○●◎◦▪▫•※▶▷►❍❏❑✓✔➢➤☞]|[①-⑳]|[-–·∙ㆍ*#](?=\s)|\(?\d{1,2}[.)](?!\d)|\(?[가-하][.)]|\([가-하\d]{1,2}\)|[ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ]|제\d+[조항호장절])/;
|
|
3782
3782
|
function startsNewItem(prevText, nextText) {
|
|
3783
3783
|
const t = nextText.replace(MARKUP, "").trimStart();
|
|
3784
3784
|
const prev = prevText.replace(MARKUP, "").trimEnd();
|
|
@@ -3848,7 +3848,8 @@ function joinPageBreakWraps(blocks, lex) {
|
|
|
3848
3848
|
pageLeft.set(b.pageNumber, Math.min(pageLeft.get(b.pageNumber) ?? Infinity, b.bbox.x));
|
|
3849
3849
|
}
|
|
3850
3850
|
for (let i = blocks.length - 1; i > 0; i--) {
|
|
3851
|
-
const
|
|
3851
|
+
const note = i >= 2 && footnoteBetween(blocks[i - 2], blocks[i - 1], blocks[i]) ? blocks[i - 1] : null;
|
|
3852
|
+
const a = note ? blocks[i - 2] : blocks[i - 1], b = blocks[i];
|
|
3852
3853
|
if (!a.pageNumber || b.pageNumber !== a.pageNumber + 1 || !a.text || !b.text) continue;
|
|
3853
3854
|
if (a.type !== "paragraph" && a.type !== "list" || b.type !== "paragraph") continue;
|
|
3854
3855
|
const last = a.bbox && PARA_LAST_LINE.get(a.bbox), fs = last ? last.fontSize : 0;
|
|
@@ -3872,8 +3873,17 @@ function joinPageBreakWraps(blocks, lex) {
|
|
|
3872
3873
|
if (bl) PARA_LAST_LINE.set(a.bbox, bl);
|
|
3873
3874
|
else PARA_LAST_LINE.delete(a.bbox);
|
|
3874
3875
|
blocks.splice(i, 1);
|
|
3876
|
+
if (note) i--;
|
|
3875
3877
|
}
|
|
3876
3878
|
}
|
|
3879
|
+
function footnoteBetween(a, f, b) {
|
|
3880
|
+
if (f.type !== "paragraph" || !f.text || !a.pageNumber || f.pageNumber !== a.pageNumber || b.pageNumber !== a.pageNumber + 1) return false;
|
|
3881
|
+
const afs = a.style?.fontSize ?? 0, ffs = f.style?.fontSize ?? 0;
|
|
3882
|
+
if (!afs || !ffs || ffs > afs * 0.95 || !a.bbox || !f.bbox || f.bbox.y + f.bbox.height > a.bbox.y + 1) return false;
|
|
3883
|
+
const at = a.text?.replace(MARKUP, "").trimEnd() ?? "";
|
|
3884
|
+
if (/[가-힣]/.test(at) || SENTENCE_END.test(at)) return false;
|
|
3885
|
+
return /^(?:\d{1,2}\)?\s|\*|※)/.test(f.text.replace(MARKUP, "").trimStart());
|
|
3886
|
+
}
|
|
3877
3887
|
function splitPageBreakWraps(blocks) {
|
|
3878
3888
|
return blocks.flatMap((b) => {
|
|
3879
3889
|
const cuts = b.bbox && PAGE_BREAK_JOINS.get(b.bbox);
|
|
@@ -3939,11 +3949,15 @@ function bodyLineJoins(lines, lex) {
|
|
|
3939
3949
|
const others = Number.isFinite(own) ? own : lex?.bodyPitch(fs) ?? Infinity;
|
|
3940
3950
|
const maxPitch = Number.isFinite(others) ? Math.min(BODY_MAX_PITCH_ABS_EM * fs, Math.max(BODY_MAX_PITCH_EM * fs, others * BODY_PITCH_REL)) : BODY_MAX_PITCH_EM * fs;
|
|
3941
3951
|
const wordWrap = ragged && !full(a) && nextWordNoRoom(a, b) && !MULTI_LEVEL_NUMBER.test(b.text.trimStart());
|
|
3942
|
-
const wraps = fs > 0 && (full(a) || wordWrap) && a.right - a.left >= BODY_MIN_WIDTH_EM * fs && a.y - b.y > 0 && a.y - b.y < maxPitch && Math.abs(b.fontSize - fs) <= 0.15 * fs && !startsNewItem(a.text, b.text) && !(SENTENCE_END.test(a.text.trimEnd()) && MULTI_LEVEL_NUMBER.test(b.text.trimStart()));
|
|
3952
|
+
const wraps = fs > 0 && (full(a) || wordWrap) && a.right - a.left >= BODY_MIN_WIDTH_EM * fs && a.y - b.y > 0 && (a.y - b.y < maxPitch || indentedCjkFirstLine(a, b, fs)) && Math.abs(b.fontSize - fs) <= 0.15 * fs && !startsNewItem(a.text, b.text) && !(SENTENCE_END.test(a.text.trimEnd()) && MULTI_LEVEL_NUMBER.test(b.text.trimStart()));
|
|
3943
3953
|
out.push(!wraps ? "\n" : wordWrap ? unspacedCjkBoundary(a.text, b.text) ? "" : " " : wrapJoiner(a.text, b.text, lex));
|
|
3944
3954
|
}
|
|
3945
3955
|
return out;
|
|
3946
3956
|
}
|
|
3957
|
+
function indentedCjkFirstLine(a, b, fs) {
|
|
3958
|
+
const cjk = (t) => !/[가-힣]/.test(t) && /[\u3040-\u30ff\u3400-\u9fff]/.test(t);
|
|
3959
|
+
return cjk(a.text) && cjk(b.text) && b.left < a.left - fs && a.y - b.y < BODY_MAX_PITCH_ABS_EM * fs && b.fontSize >= 0.95 * a.fontSize && !/^(?:\d{1,2}\)?\s|[*※])/.test(b.text.trimStart());
|
|
3960
|
+
}
|
|
3947
3961
|
var CELL_PAD_MAX = 6;
|
|
3948
3962
|
function cellLineWraps(box, contentLeft, prevRight, fontSize, nextFirstCharW) {
|
|
3949
3963
|
const pad = Math.min(CELL_PAD_MAX, Math.max(0, contentLeft - box.x1));
|
|
@@ -4520,9 +4534,12 @@ function sortLineByX(items) {
|
|
|
4520
4534
|
function isCjkLatinAutospace(prevText, nextText, gap, fontSize, hangulLine = false) {
|
|
4521
4535
|
if (!(gap < fontSize * 0.35)) return false;
|
|
4522
4536
|
if (hangulLine) return false;
|
|
4523
|
-
const a = prevText.replace(/(?:<\/?u>|~~)+$/, "").slice(-1), b = nextText.replace(/^(?:<\/?u>|~~)+/, "")[0] ?? "";
|
|
4537
|
+
const a = prevText.replace(/(?:<\/?u>|~~)+$/, "").slice(-1), b = nextText.replace(/^(?:<\/?u>|~~)+/, "").replace(/^\(/, "")[0] ?? "";
|
|
4524
4538
|
const cjk = /[\u3000-\u303f\u3040-\u30ff\u3400-\u9fff\uf900-\ufaff\uff00-\uffef]/, latin = /[A-Za-z0-9]/;
|
|
4525
|
-
|
|
4539
|
+
const cjkOrQuote = /[\u3000-\u303f\u3040-\u30ff\u3400-\u9fff\uf900-\ufaff\uff00-\uffef\u2018-\u201f]/;
|
|
4540
|
+
const bare = nextText.replace(/^(?:<\/?u>|~~)+/, "")[0] ?? "";
|
|
4541
|
+
if (bare === "(" && cjk.test(a) || a === ")" && cjk.test(b)) return true;
|
|
4542
|
+
return cjk.test(a) && latin.test(b) || latin.test(a) && cjk.test(b) || cjkOrQuote.test(a) && cjkOrQuote.test(b) && (cjk.test(a) || cjk.test(b));
|
|
4526
4543
|
}
|
|
4527
4544
|
function filterHiddenText(items, pageWidth, pageHeight, originX = 0, originY = 0) {
|
|
4528
4545
|
let hiddenCount = 0;
|
|
@@ -5424,11 +5441,25 @@ function detectCompactStatisticalTables(rows, pageNum) {
|
|
|
5424
5441
|
}
|
|
5425
5442
|
return found;
|
|
5426
5443
|
}
|
|
5444
|
+
function twoColumnCells(row) {
|
|
5445
|
+
const items = [...row.items].sort((a, b) => a.x - b.x);
|
|
5446
|
+
if (items.length <= 2) return items.map((c) => ({ x: c.x, y: c.y, fontSize: c.fontSize, text: c.text }));
|
|
5447
|
+
const out = [];
|
|
5448
|
+
for (const c of items) {
|
|
5449
|
+
const last = out.at(-1), gap = last ? c.x - last.end : Infinity;
|
|
5450
|
+
if (last && gap <= c.fontSize * 1.2) {
|
|
5451
|
+
last.text += (gap > c.fontSize * 0.2 || c.hasSpaceBefore ? " " : "") + c.text;
|
|
5452
|
+
last.end = Math.max(last.end, c.x + c.w);
|
|
5453
|
+
} else out.push({ x: c.x, y: c.y, fontSize: c.fontSize, text: c.text, end: c.x + c.w });
|
|
5454
|
+
}
|
|
5455
|
+
if (out.length === 2 && (out[0].text.length > 20 || out.some((c) => /^\s*[::]|[::]\s*$|\s[::]\s/.test(c.text)))) return [];
|
|
5456
|
+
return out.map(({ end: _end, ...cell }) => cell);
|
|
5457
|
+
}
|
|
5427
5458
|
function detectAlignedTwoColumnTables(rows, pageNum) {
|
|
5428
5459
|
const found = [];
|
|
5429
5460
|
let i = 0;
|
|
5430
5461
|
while (i < rows.length - 2) {
|
|
5431
|
-
const first =
|
|
5462
|
+
const first = twoColumnCells(rows[i]);
|
|
5432
5463
|
if (first.length !== 2 || first.some((c) => !c.text.trim() || c.text.length > 48) || first[1].x - first[0].x < 45 || first[1].x - first[0].x > 260 || /[.!?]$/.test(first[0].text)) {
|
|
5433
5464
|
i++;
|
|
5434
5465
|
continue;
|
|
@@ -5436,23 +5467,28 @@ function detectAlignedTwoColumnTables(rows, pageNum) {
|
|
|
5436
5467
|
const body = [];
|
|
5437
5468
|
let j = i;
|
|
5438
5469
|
for (; j < rows.length; j++) {
|
|
5439
|
-
const cells2 =
|
|
5470
|
+
const cells2 = twoColumnCells(rows[j]);
|
|
5440
5471
|
const previous = body.at(-1);
|
|
5441
|
-
if (
|
|
5442
|
-
|
|
5472
|
+
if (previous && previous.rows.at(-1).y - rows[j].y > Math.max(24, first[0].fontSize * 2.8)) break;
|
|
5473
|
+
if (previous && cells2.length === 1 && Math.abs(cells2[0].x - first[1].x) <= 5 && cells2[0].text.trim()) {
|
|
5474
|
+
previous.rows.push(rows[j]);
|
|
5475
|
+
previous.right.push(cells2[0].text);
|
|
5476
|
+
continue;
|
|
5477
|
+
}
|
|
5478
|
+
if (cells2.length !== 2 || cells2.some((c) => !c.text.trim() || c.text.length > 48) || Math.abs(cells2[0].x - first[0].x) > 5 || Math.abs(cells2[1].x - first[1].x) > 5) break;
|
|
5479
|
+
body.push({ rows: [rows[j]], left: cells2[0].text, right: [cells2[1].text] });
|
|
5443
5480
|
}
|
|
5444
|
-
if (body.length < 3) {
|
|
5481
|
+
if (body.length < 3 || body.filter((b) => !/[\p{L}\p{N}]/u.test(b.right.join(""))).length * 2 >= body.length) {
|
|
5445
5482
|
i++;
|
|
5446
5483
|
continue;
|
|
5447
5484
|
}
|
|
5448
5485
|
const top = rows[i - 1];
|
|
5449
5486
|
const title = top?.items.length === 1 && Math.abs(top.items[0].x - first[0].x) <= 5 && top.items[0].text.length <= 65 && top.y - first[0].y <= Math.max(24, first[0].fontSize * 2.8) ? top : void 0;
|
|
5450
|
-
const tableRows = title ? [title, ...body
|
|
5451
|
-
const cells =
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
});
|
|
5487
|
+
const tableRows = [...title ? [title] : [], ...body.flatMap((b) => b.rows)];
|
|
5488
|
+
const cells = [
|
|
5489
|
+
...title ? [[{ text: title.items[0].text, colSpan: 2, rowSpan: 1 }, { text: "", colSpan: 1, rowSpan: 1 }]] : [],
|
|
5490
|
+
...body.map((b) => [{ text: b.left, colSpan: 1, rowSpan: 1 }, { text: b.right.join(" "), colSpan: 1, rowSpan: 1 }])
|
|
5491
|
+
];
|
|
5456
5492
|
const usedItems = new Set(tableRows.flatMap((row) => row.items));
|
|
5457
5493
|
const all = [...usedItems];
|
|
5458
5494
|
const minX = Math.min(...all.map((c) => c.x)), minY = Math.min(...all.map((c) => c.y));
|
|
@@ -6677,7 +6713,7 @@ function chartBandGap(group, gap, charts) {
|
|
|
6677
6713
|
const top = Math.max(...group.map((i) => i.y + i.fontSize)), em = Math.max(...group.map((i) => i.fontSize));
|
|
6678
6714
|
return charts.some((c) => x1 >= c.x1 - 2 && x2 <= c.x2 + 2 && top <= c.y1 + 2 && c.y1 - top <= 2 * em) ? gap : 0;
|
|
6679
6715
|
}
|
|
6680
|
-
function xyCutOrder(items, gapThreshold, depth = 0, wrapped, columnGap = 0) {
|
|
6716
|
+
function xyCutOrder(items, gapThreshold, depth = 0, wrapped, columnGap = 0, lex) {
|
|
6681
6717
|
if (items.length === 0) return [];
|
|
6682
6718
|
const newRegion = wrapped === void 0;
|
|
6683
6719
|
wrapped ??= inheritedWrapBands(items);
|
|
@@ -6685,7 +6721,7 @@ function xyCutOrder(items, gapThreshold, depth = 0, wrapped, columnGap = 0) {
|
|
|
6685
6721
|
if (items.length === 2 && depth < MAX_XYCUT_DEPTH) {
|
|
6686
6722
|
const sortedY2 = [...items].sort((a, b) => b.y - a.y);
|
|
6687
6723
|
if (findHorizontalCut(sortedY2, wrapped).gap >= farGap) {
|
|
6688
|
-
if (newRegion) wrapped = wrappedLineBands(items, wrapped);
|
|
6724
|
+
if (newRegion) wrapped = wrappedLineBands(items, wrapped, lex);
|
|
6689
6725
|
const cut = findHorizontalCut(sortedY2, wrapped);
|
|
6690
6726
|
if (cut.gap >= farGap) return [...leaf([sortedY2[0]], wrapped), ...leaf([sortedY2[1]], wrapped)];
|
|
6691
6727
|
}
|
|
@@ -6696,7 +6732,7 @@ function xyCutOrder(items, gapThreshold, depth = 0, wrapped, columnGap = 0) {
|
|
|
6696
6732
|
if (cross.size > 0 && cross.size <= items.length * CROSS_MAX_MASK_RATIO) {
|
|
6697
6733
|
const rest = items.filter((i) => !cross.has(i));
|
|
6698
6734
|
if (rest.length > 0) {
|
|
6699
|
-
const groups = xyCutOrder(rest, gapThreshold, 1, void 0, columnGap);
|
|
6735
|
+
const groups = xyCutOrder(rest, gapThreshold, 1, void 0, columnGap, lex);
|
|
6700
6736
|
return mergeCrossLayoutGroups(groups, [...cross]);
|
|
6701
6737
|
}
|
|
6702
6738
|
}
|
|
@@ -6705,29 +6741,29 @@ function xyCutOrder(items, gapThreshold, depth = 0, wrapped, columnGap = 0) {
|
|
|
6705
6741
|
const sortedY = [...items].sort((a, b) => b.y - a.y);
|
|
6706
6742
|
let hCut = findHorizontalCut(sortedY, wrapped);
|
|
6707
6743
|
if (newRegion && hCut.gap >= minGap) {
|
|
6708
|
-
wrapped = wrappedLineBands(items, wrapped);
|
|
6744
|
+
wrapped = wrappedLineBands(items, wrapped, lex);
|
|
6709
6745
|
hCut = findHorizontalCut(sortedY, wrapped);
|
|
6710
6746
|
}
|
|
6711
6747
|
const vMinGap = Math.max(minGap, columnGap);
|
|
6712
6748
|
const vCut = findVerticalCutWithOutlierFilter(items, vMinGap);
|
|
6713
6749
|
const hValid = hCut.gap >= minGap;
|
|
6714
|
-
const vValid = (vCut.gap >= vMinGap || vCut.gap >= PROSE_GUTTER_MIN_GAP && isProseGutter(items, vCut.position)) && !splitsSpacedLabel(items, vCut.position);
|
|
6750
|
+
const vValid = (vCut.gap >= vMinGap || vCut.gap >= PROSE_GUTTER_MIN_GAP && isProseGutter(items, vCut.position)) && !splitsSpacedLabel(items, vCut.position) && !splitsLoneRowTail(items, vCut.position);
|
|
6715
6751
|
let useHorizontal;
|
|
6716
6752
|
if (hValid && vValid) useHorizontal = (vCut.gap <= hCut.gap * 1.5 || staggeredSides(items, vCut.position)) && !gapInsideLongerColumn(items, hCut.position, hCut.gap, vCut.position);
|
|
6717
6753
|
else if (hValid) useHorizontal = true;
|
|
6718
6754
|
else if (vValid) useHorizontal = false;
|
|
6719
|
-
else return splitEdgeSpannedColumns(items, gapThreshold, depth) ?? leaf(items, wrapped);
|
|
6755
|
+
else return splitEdgeSpannedColumns(items, gapThreshold, depth, lex) ?? leaf(items, wrapped);
|
|
6720
6756
|
if (useHorizontal) {
|
|
6721
6757
|
const upper = items.filter((i) => i.y > hCut.position);
|
|
6722
6758
|
const lower = items.filter((i) => i.y <= hCut.position);
|
|
6723
6759
|
if (upper.length > 0 && lower.length > 0 && upper.length < items.length) {
|
|
6724
|
-
return [...xyCutOrder(upper, gapThreshold, depth + 1, wrapped, columnGap), ...xyCutOrder(lower, gapThreshold, depth + 1, wrapped, columnGap)];
|
|
6760
|
+
return [...xyCutOrder(upper, gapThreshold, depth + 1, wrapped, columnGap, lex), ...xyCutOrder(lower, gapThreshold, depth + 1, wrapped, columnGap, lex)];
|
|
6725
6761
|
}
|
|
6726
6762
|
} else {
|
|
6727
6763
|
const left = items.filter((i) => i.x + i.w / 2 < vCut.position);
|
|
6728
6764
|
const right = items.filter((i) => i.x + i.w / 2 >= vCut.position);
|
|
6729
6765
|
if (left.length > 0 && right.length > 0 && left.length < items.length) {
|
|
6730
|
-
return [...xyCutOrder(left, gapThreshold, depth + 1, void 0, columnGap), ...xyCutOrder(right, gapThreshold, depth + 1, void 0, columnGap)];
|
|
6766
|
+
return [...xyCutOrder(left, gapThreshold, depth + 1, void 0, columnGap, lex), ...xyCutOrder(right, gapThreshold, depth + 1, void 0, columnGap, lex)];
|
|
6731
6767
|
}
|
|
6732
6768
|
}
|
|
6733
6769
|
return leaf(items, wrapped);
|
|
@@ -6866,7 +6902,19 @@ function tocRecordBoundaries(rows) {
|
|
|
6866
6902
|
}
|
|
6867
6903
|
return out;
|
|
6868
6904
|
}
|
|
6869
|
-
function
|
|
6905
|
+
function splitsLoneRowTail(items, x) {
|
|
6906
|
+
const left = groupByY(items.filter((i) => i.x + i.w / 2 < x)), right = groupByY(items.filter((i) => i.x + i.w / 2 >= x));
|
|
6907
|
+
if (right.length !== 1 || left.length < 2) return false;
|
|
6908
|
+
const tail = right[0], box = computeBBox(items, 0), tailBox = computeBBox(tail, 0);
|
|
6909
|
+
const head = left.find((r) => Math.abs(r[0].y - tail[0].y) <= 2);
|
|
6910
|
+
if (!head) return false;
|
|
6911
|
+
const headBox = computeBBox(head, 0), fs = dominantStyle(tail)?.fontSize ?? 10;
|
|
6912
|
+
const gap = tailBox.x - (headBox.x + headBox.width), fills = tailBox.x + tailBox.width >= box.x + box.width - fs;
|
|
6913
|
+
if (gap <= fs * 3 && fills && headBox.width >= box.width / 2) return true;
|
|
6914
|
+
const text = [...head, ...tail].map((i) => i.text).join("");
|
|
6915
|
+
return !/[가-힣]/.test(text) && /[\u3040-\u30ff\u3400-\u9fff]/.test(text) && gap <= fs * 4 && fills && headBox.x <= box.x + fs;
|
|
6916
|
+
}
|
|
6917
|
+
function wrappedLineBands(items, inherited, lex) {
|
|
6870
6918
|
const rows = groupByY(items);
|
|
6871
6919
|
const records = tocRecordBoundaries(rows);
|
|
6872
6920
|
const lines = rows.map((row) => {
|
|
@@ -6880,7 +6928,7 @@ function wrappedLineBands(items, inherited) {
|
|
|
6880
6928
|
sources: row.map((item) => ({ item, state: { ...item } }))
|
|
6881
6929
|
};
|
|
6882
6930
|
});
|
|
6883
|
-
const joins = bodyLineJoins(lines);
|
|
6931
|
+
const joins = bodyLineJoins(lines, lex);
|
|
6884
6932
|
const fresh = lines.slice(0, -1).flatMap((line, i) => joins[i] === "\n" || records.has(i) || line.text.trim() === lines[i + 1].text.trim() ? [] : [{ top: line.y, bottom: lines[i + 1].y, sources: [...line.sources, ...lines[i + 1].sources] }]);
|
|
6885
6933
|
const freshKeys = new Set(fresh.map((b) => `${b.top}:${b.bottom}`));
|
|
6886
6934
|
return [...inherited.filter((b) => !freshKeys.has(`${b.top}:${b.bottom}`)), ...fresh].sort((a, b) => b.top - a.top);
|
|
@@ -6974,7 +7022,7 @@ function isProseGutter(items, x) {
|
|
|
6974
7022
|
const [l0, l1] = span2(left), [r0, r1] = span2(right);
|
|
6975
7023
|
return Math.min(l1, r1) - Math.max(l0, r0) >= Math.min(l1 - l0, r1 - r0) * 0.5;
|
|
6976
7024
|
}
|
|
6977
|
-
function splitEdgeSpannedColumns(items, gapThreshold, depth) {
|
|
7025
|
+
function splitEdgeSpannedColumns(items, gapThreshold, depth, lex) {
|
|
6978
7026
|
let minX = Infinity, maxX = -Infinity;
|
|
6979
7027
|
for (const i of items) {
|
|
6980
7028
|
minX = Math.min(minX, i.x);
|
|
@@ -6992,8 +7040,8 @@ function splitEdgeSpannedColumns(items, gapThreshold, depth) {
|
|
|
6992
7040
|
const left = rest.filter((i) => i.x + i.w / 2 < cut.position), right = rest.filter((i) => i.x + i.w / 2 >= cut.position);
|
|
6993
7041
|
return [
|
|
6994
7042
|
...above.length ? [above] : [],
|
|
6995
|
-
...xyCutOrder(left, gapThreshold, depth + 1),
|
|
6996
|
-
...xyCutOrder(right, gapThreshold, depth + 1),
|
|
7043
|
+
...xyCutOrder(left, gapThreshold, depth + 1, void 0, 0, lex),
|
|
7044
|
+
...xyCutOrder(right, gapThreshold, depth + 1, void 0, 0, lex),
|
|
6997
7045
|
...below.length ? [below] : []
|
|
6998
7046
|
];
|
|
6999
7047
|
}
|
|
@@ -10824,7 +10872,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10824
10872
|
const textBlocks = [];
|
|
10825
10873
|
for (const side of sides) {
|
|
10826
10874
|
if (side.length === 0) continue;
|
|
10827
|
-
for (const group of xyCutOrder(side, gapThreshold)) {
|
|
10875
|
+
for (const group of xyCutOrder(side, gapThreshold, 0, void 0, 0, lex)) {
|
|
10828
10876
|
if (group.length === 0) continue;
|
|
10829
10877
|
const groupBlocks = extractPageBlocksFallback(group, pageNum, false, true, lex, [], chartBandGap(group, gapThreshold, charts));
|
|
10830
10878
|
for (const b of groupBlocks) textBlocks.push(b);
|
|
@@ -10836,7 +10884,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10836
10884
|
const allY = remaining.map((i) => i.y);
|
|
10837
10885
|
const pageH = safeMax(allY) - safeMin(allY);
|
|
10838
10886
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
10839
|
-
const groups = xyCutOrder(remaining, gapThreshold);
|
|
10887
|
+
const groups = xyCutOrder(remaining, gapThreshold, 0, void 0, 0, lex);
|
|
10840
10888
|
const textBlocks = [];
|
|
10841
10889
|
for (const group of groups) {
|
|
10842
10890
|
if (group.length === 0) continue;
|
|
@@ -11198,7 +11246,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
|
|
|
11198
11246
|
const allY = items.map((i) => i.y);
|
|
11199
11247
|
const pageHeight = safeMax(allY) - safeMin(allY);
|
|
11200
11248
|
const gapThreshold = Math.max(15, pageHeight * 0.03);
|
|
11201
|
-
const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold, 0, void 0, minGap);
|
|
11249
|
+
const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold, 0, void 0, minGap, lex);
|
|
11202
11250
|
for (const group of orderedGroups) {
|
|
11203
11251
|
if (group.length === 0) continue;
|
|
11204
11252
|
const yLines = mergeSuperscriptLines(groupByY(group));
|
|
@@ -11466,4 +11514,4 @@ export {
|
|
|
11466
11514
|
UNRULED_REGION_TABLES,
|
|
11467
11515
|
mergeOcrImageRegions
|
|
11468
11516
|
};
|
|
11469
|
-
//# sourceMappingURL=chunk-
|
|
11517
|
+
//# sourceMappingURL=chunk-T7MHZIFG.js.map
|