kordoc 4.24.79 → 4.24.80
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 +3 -3
- package/dist/{-WCLMRO7B.js → -E4WGZQZR.js} +24 -22
- package/dist/{chunk-2DJI6DDM.js → chunk-3FXO2TVH.js} +2 -2
- package/dist/{chunk-MALK5PX5.js → chunk-4GZJWSI4.js} +2 -2
- package/dist/{chunk-22L7WGJE.cjs → chunk-4OA4D6TW.cjs} +8 -8
- package/dist/{chunk-22L7WGJE.cjs.map → chunk-4OA4D6TW.cjs.map} +1 -1
- package/dist/{chunk-JEVINS5E.js → chunk-4VGY5JDF.js} +3 -3
- package/dist/{chunk-BWD4IPFG.js → chunk-4ZMHVX2V.js} +2 -2
- package/dist/{chunk-E7ZG5NBU.cjs → chunk-5FYOSM43.cjs} +6 -6
- package/dist/{chunk-E7ZG5NBU.cjs.map → chunk-5FYOSM43.cjs.map} +1 -1
- package/dist/{chunk-7B6W4I3A.js → chunk-5GQREWXW.js} +2 -2
- package/dist/{chunk-VTXPEJDA.js → chunk-5MXMBV4W.js} +5 -5
- package/dist/{chunk-FPJAA7GO.js → chunk-6YJHMQPK.js} +3 -3
- package/dist/{chunk-ZLHHSW2T.cjs → chunk-7WYZNELF.cjs} +88 -88
- package/dist/{chunk-ZLHHSW2T.cjs.map → chunk-7WYZNELF.cjs.map} +1 -1
- package/dist/{chunk-PSYI2EYA.js → chunk-ABOFK6HZ.js} +2 -2
- package/dist/{chunk-VS5FCFDX.js → chunk-C33LHSPS.js} +2 -2
- package/dist/{chunk-EEUN7GWB.js → chunk-CJJLFK33.js} +6 -6
- package/dist/{chunk-CKOSQJCH.js → chunk-DBVH7R77.js} +2 -2
- package/dist/{chunk-W5FLEZV4.js → chunk-DDBVS2ZV.js} +5 -5
- package/dist/{chunk-CKVPN66T.cjs → chunk-DFFUNHVL.cjs} +25 -25
- package/dist/{chunk-CKVPN66T.cjs.map → chunk-DFFUNHVL.cjs.map} +1 -1
- package/dist/{chunk-FOYPUNFB.cjs → chunk-DXDR5FAQ.cjs} +104 -104
- package/dist/{chunk-FOYPUNFB.cjs.map → chunk-DXDR5FAQ.cjs.map} +1 -1
- package/dist/{chunk-FI4SFNUZ.js → chunk-EM5OCOC6.js} +2 -2
- package/dist/{chunk-CY3JNBY7.js → chunk-HDV2R6EA.js} +3 -3
- package/dist/{chunk-3G2BXR34.js → chunk-HPOA47C4.js} +2 -2
- package/dist/{chunk-RDDRHUSA.js → chunk-HPUD7YTY.js} +2 -2
- package/dist/{chunk-DKIBSCFV.js → chunk-I56ES2MC.js} +2 -2
- package/dist/{chunk-TEWYIAFY.js → chunk-IRANRVQC.js} +2 -2
- package/dist/{chunk-HNTRTZ2J.js → chunk-IYJYGFOR.js} +2 -2
- package/dist/{chunk-E4D3HKPN.js → chunk-LDLAHPQG.js} +2 -2
- package/dist/{chunk-3CQGKB62.js → chunk-LGRQWTSU.js} +4 -4
- package/dist/{chunk-RO577YPX.js → chunk-MAJRVJ2U.js} +10 -10
- package/dist/{chunk-42P53WKD.cjs → chunk-PBTLZYKW.cjs} +3 -3
- package/dist/{chunk-42P53WKD.cjs.map → chunk-PBTLZYKW.cjs.map} +1 -1
- package/dist/{chunk-B6IV3WVP.js → chunk-PG7TASMF.js} +67 -21
- package/dist/chunk-PG7TASMF.js.map +1 -0
- package/dist/{chunk-LPLU7527.cjs → chunk-RKCEXNWT.cjs} +58 -58
- package/dist/{chunk-LPLU7527.cjs.map → chunk-RKCEXNWT.cjs.map} +1 -1
- package/dist/{chunk-7DD7G4BI.js → chunk-SN3TFJAE.js} +2 -2
- package/dist/{chunk-IZFALQLA.js → chunk-T7CMM4FT.js} +6 -6
- package/dist/{chunk-WHQXWZZK.js → chunk-T7REBC3M.js} +2 -2
- package/dist/{chunk-XLR77IOC.js → chunk-UCRDNRX2.js} +3 -3
- package/dist/{chunk-A6KTEOXE.js → chunk-V5D7ZTXL.js} +3 -3
- package/dist/{chunk-GSBMOVCF.js → chunk-VQFUQFK6.js} +7 -7
- package/dist/{chunk-BJ365LX3.cjs → chunk-VWW5C2PU.cjs} +3 -3
- package/dist/{chunk-BJ365LX3.cjs.map → chunk-VWW5C2PU.cjs.map} +1 -1
- package/dist/{chunk-Y3X53MRF.js → chunk-WC5XP6HM.js} +5 -5
- package/dist/{chunk-D6PDKX72.js → chunk-WETI4A4A.js} +2 -2
- package/dist/{chunk-B6OD2Z3R.js → chunk-WFG6JYP7.js} +2 -2
- package/dist/{chunk-ADPVFTTT.js → chunk-WXZFE5IB.js} +4 -4
- package/dist/{chunk-Q2QT6AL6.js → chunk-XLQ6LFEL.js} +2 -2
- package/dist/{chunk-IPAKNA6R.js → chunk-XZH7DOXJ.js} +2 -2
- package/dist/{chunk-UP3KRRVN.cjs → chunk-Y7LMYK5C.cjs} +2 -2
- package/dist/{chunk-UP3KRRVN.cjs.map → chunk-Y7LMYK5C.cjs.map} +1 -1
- package/dist/{chunk-4DA67IZR.js → chunk-Z4LANE4Z.js} +2 -2
- package/dist/{chunk-I5PYUR3W.js → chunk-ZSQYW7N2.js} +11 -11
- package/dist/chunks-MNMVIRMB.js +11 -0
- package/dist/cli.js +61 -56
- package/dist/cli.js.map +1 -1
- package/dist/{formula-HECGAXCQ.cjs → formula-OOTFS5XV.cjs} +9 -9
- package/dist/{formula-HECGAXCQ.cjs.map → formula-OOTFS5XV.cjs.map} +1 -1
- package/dist/{formula-NBB34N4Y.js → formula-QVNBTQJF.js} +4 -4
- package/dist/{formula-JYXL5ZDG.js → formula-YQWTOSSV.js} +3 -3
- package/dist/generator-DJCS2MTC.cjs +12 -0
- package/dist/{generator-FSH6G2BY.cjs.map → generator-DJCS2MTC.cjs.map} +1 -1
- package/dist/generator-SEJ54C76.js +11 -0
- package/dist/generator-V7ZB27P6.js +18 -0
- package/dist/{hancom-GXUGVC5L.js → hancom-OMBHPCJR.js} +2 -2
- package/dist/{hancom-GSUBPFCZ.js → hancom-S6GK2PKJ.js} +2 -2
- package/dist/{hancom-UUFWDLTN.cjs → hancom-UJRXSASQ.cjs} +5 -5
- package/dist/{hancom-UUFWDLTN.cjs.map → hancom-UJRXSASQ.cjs.map} +1 -1
- package/dist/{image-ocr-XSKOCOW7.js → image-ocr-3RDTZPUH.js} +8 -8
- package/dist/{image-ocr-ZVU4TCW7.cjs → image-ocr-4FQ54QPG.cjs} +36 -36
- package/dist/{image-ocr-ZVU4TCW7.cjs.map → image-ocr-4FQ54QPG.cjs.map} +1 -1
- package/dist/{image-ocr-62D6HIBB.js → image-ocr-FA2UAUB5.js} +11 -11
- package/dist/index.cjs +1484 -1438
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +65 -19
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +51 -46
- package/dist/mcp.js.map +1 -1
- package/dist/memo-6BS3C2QT.js +17 -0
- package/dist/{model-bundle-DPTHBESJ.js → model-bundle-KTKZK7ZX.js} +5 -5
- package/dist/{models-O7M5SDJV.js → models-VGSCY57U.js} +5 -5
- package/dist/{parse-worker-v2-3ILBPY7P.js → parse-worker-v2-LUABK53S.js} +23 -23
- package/dist/{parser-LGJVHF2C.js → parser-FB6NSUTI.js} +9 -9
- package/dist/{parser-TGMBU6NM.cjs → parser-J3V4ZY33.cjs} +164 -164
- package/dist/{parser-TGMBU6NM.cjs.map → parser-J3V4ZY33.cjs.map} +1 -1
- package/dist/{parser-EIOKEMXD.js → parser-JEECXHUZ.js} +12 -12
- package/dist/pdf-ocr-5WUIENJQ.cjs +43 -0
- package/dist/{pdf-ocr-VKZPLCS7.cjs.map → pdf-ocr-5WUIENJQ.cjs.map} +1 -1
- package/dist/{pdf-ocr-OU7XVMJW.js → pdf-ocr-HUPMJSXZ.js} +9 -9
- package/dist/{pdf-ocr-VQGNNEFT.js → pdf-ocr-VTC73UOL.js} +6 -6
- package/dist/{profile-io-AEG7M5KV.js → profile-io-7VNJ26XG.js} +3 -3
- package/dist/{rasterize-2TX6CRQY.js → rasterize-AFPV32K5.js} +3 -3
- package/dist/{redact-doc-UWXE2D52.js → redact-doc-O6NOJLUX.js} +22 -22
- package/dist/{render-3TPZAAY3.js → render-6FEX4BYT.js} +12 -12
- package/dist/{rewrite-fallback-FVI3MVUH.js → rewrite-fallback-7QMVNVIF.js} +13 -13
- package/dist/seal-5BLP22A4.js +16 -0
- package/dist/{setup-5SZWEMHX.js → setup-727UTPWF.js} +3 -3
- package/dist/{to-hwpx-UNNR4Y7K.js → to-hwpx-4V6GIDFI.js} +7 -7
- package/dist/{to-hwpx-KVCLOFIT.js → to-hwpx-QOAFYHV3.js} +4 -4
- package/dist/to-hwpx-TT3TRZOU.cjs +16 -0
- package/dist/{to-hwpx-KHSK7PL3.cjs.map → to-hwpx-TT3TRZOU.cjs.map} +1 -1
- package/dist/visual-XYHR33UB.js +40 -0
- package/dist/{watch-YCNXUIJL.js → watch-DWX4RTYR.js} +23 -23
- package/package.json +6 -1
- package/dist/chunk-B6IV3WVP.js.map +0 -1
- package/dist/chunks-6UAF6SYV.js +0 -11
- package/dist/generator-AZ3APW7A.js +0 -11
- package/dist/generator-FSH6G2BY.cjs +0 -12
- package/dist/generator-WTZZ2OSI.js +0 -18
- package/dist/memo-A4PUH3YJ.js +0 -17
- package/dist/pdf-ocr-VKZPLCS7.cjs +0 -43
- package/dist/seal-ZNN4P4IN.js +0 -16
- package/dist/to-hwpx-KHSK7PL3.cjs +0 -16
- package/dist/visual-UDZERIUK.js +0 -40
- /package/dist/{-WCLMRO7B.js.map → -E4WGZQZR.js.map} +0 -0
- /package/dist/{chunk-2DJI6DDM.js.map → chunk-3FXO2TVH.js.map} +0 -0
- /package/dist/{chunk-MALK5PX5.js.map → chunk-4GZJWSI4.js.map} +0 -0
- /package/dist/{chunk-JEVINS5E.js.map → chunk-4VGY5JDF.js.map} +0 -0
- /package/dist/{chunk-BWD4IPFG.js.map → chunk-4ZMHVX2V.js.map} +0 -0
- /package/dist/{chunk-7B6W4I3A.js.map → chunk-5GQREWXW.js.map} +0 -0
- /package/dist/{chunk-VTXPEJDA.js.map → chunk-5MXMBV4W.js.map} +0 -0
- /package/dist/{chunk-FPJAA7GO.js.map → chunk-6YJHMQPK.js.map} +0 -0
- /package/dist/{chunk-PSYI2EYA.js.map → chunk-ABOFK6HZ.js.map} +0 -0
- /package/dist/{chunk-VS5FCFDX.js.map → chunk-C33LHSPS.js.map} +0 -0
- /package/dist/{chunk-EEUN7GWB.js.map → chunk-CJJLFK33.js.map} +0 -0
- /package/dist/{chunk-CKOSQJCH.js.map → chunk-DBVH7R77.js.map} +0 -0
- /package/dist/{chunk-W5FLEZV4.js.map → chunk-DDBVS2ZV.js.map} +0 -0
- /package/dist/{chunk-FI4SFNUZ.js.map → chunk-EM5OCOC6.js.map} +0 -0
- /package/dist/{chunk-CY3JNBY7.js.map → chunk-HDV2R6EA.js.map} +0 -0
- /package/dist/{chunk-3G2BXR34.js.map → chunk-HPOA47C4.js.map} +0 -0
- /package/dist/{chunk-RDDRHUSA.js.map → chunk-HPUD7YTY.js.map} +0 -0
- /package/dist/{chunk-DKIBSCFV.js.map → chunk-I56ES2MC.js.map} +0 -0
- /package/dist/{chunk-TEWYIAFY.js.map → chunk-IRANRVQC.js.map} +0 -0
- /package/dist/{chunk-HNTRTZ2J.js.map → chunk-IYJYGFOR.js.map} +0 -0
- /package/dist/{chunk-E4D3HKPN.js.map → chunk-LDLAHPQG.js.map} +0 -0
- /package/dist/{chunk-3CQGKB62.js.map → chunk-LGRQWTSU.js.map} +0 -0
- /package/dist/{chunk-RO577YPX.js.map → chunk-MAJRVJ2U.js.map} +0 -0
- /package/dist/{chunk-7DD7G4BI.js.map → chunk-SN3TFJAE.js.map} +0 -0
- /package/dist/{chunk-IZFALQLA.js.map → chunk-T7CMM4FT.js.map} +0 -0
- /package/dist/{chunk-WHQXWZZK.js.map → chunk-T7REBC3M.js.map} +0 -0
- /package/dist/{chunk-XLR77IOC.js.map → chunk-UCRDNRX2.js.map} +0 -0
- /package/dist/{chunk-A6KTEOXE.js.map → chunk-V5D7ZTXL.js.map} +0 -0
- /package/dist/{chunk-GSBMOVCF.js.map → chunk-VQFUQFK6.js.map} +0 -0
- /package/dist/{chunk-Y3X53MRF.js.map → chunk-WC5XP6HM.js.map} +0 -0
- /package/dist/{chunk-D6PDKX72.js.map → chunk-WETI4A4A.js.map} +0 -0
- /package/dist/{chunk-B6OD2Z3R.js.map → chunk-WFG6JYP7.js.map} +0 -0
- /package/dist/{chunk-ADPVFTTT.js.map → chunk-WXZFE5IB.js.map} +0 -0
- /package/dist/{chunk-Q2QT6AL6.js.map → chunk-XLQ6LFEL.js.map} +0 -0
- /package/dist/{chunk-IPAKNA6R.js.map → chunk-XZH7DOXJ.js.map} +0 -0
- /package/dist/{chunk-4DA67IZR.js.map → chunk-Z4LANE4Z.js.map} +0 -0
- /package/dist/{chunk-I5PYUR3W.js.map → chunk-ZSQYW7N2.js.map} +0 -0
- /package/dist/{chunks-6UAF6SYV.js.map → chunks-MNMVIRMB.js.map} +0 -0
- /package/dist/{formula-NBB34N4Y.js.map → formula-QVNBTQJF.js.map} +0 -0
- /package/dist/{formula-JYXL5ZDG.js.map → formula-YQWTOSSV.js.map} +0 -0
- /package/dist/{generator-AZ3APW7A.js.map → generator-SEJ54C76.js.map} +0 -0
- /package/dist/{generator-WTZZ2OSI.js.map → generator-V7ZB27P6.js.map} +0 -0
- /package/dist/{hancom-GXUGVC5L.js.map → hancom-OMBHPCJR.js.map} +0 -0
- /package/dist/{hancom-GSUBPFCZ.js.map → hancom-S6GK2PKJ.js.map} +0 -0
- /package/dist/{image-ocr-XSKOCOW7.js.map → image-ocr-3RDTZPUH.js.map} +0 -0
- /package/dist/{image-ocr-62D6HIBB.js.map → image-ocr-FA2UAUB5.js.map} +0 -0
- /package/dist/{memo-A4PUH3YJ.js.map → memo-6BS3C2QT.js.map} +0 -0
- /package/dist/{model-bundle-DPTHBESJ.js.map → model-bundle-KTKZK7ZX.js.map} +0 -0
- /package/dist/{models-O7M5SDJV.js.map → models-VGSCY57U.js.map} +0 -0
- /package/dist/{parse-worker-v2-3ILBPY7P.js.map → parse-worker-v2-LUABK53S.js.map} +0 -0
- /package/dist/{parser-LGJVHF2C.js.map → parser-FB6NSUTI.js.map} +0 -0
- /package/dist/{parser-EIOKEMXD.js.map → parser-JEECXHUZ.js.map} +0 -0
- /package/dist/{pdf-ocr-OU7XVMJW.js.map → pdf-ocr-HUPMJSXZ.js.map} +0 -0
- /package/dist/{pdf-ocr-VQGNNEFT.js.map → pdf-ocr-VTC73UOL.js.map} +0 -0
- /package/dist/{profile-io-AEG7M5KV.js.map → profile-io-7VNJ26XG.js.map} +0 -0
- /package/dist/{rasterize-2TX6CRQY.js.map → rasterize-AFPV32K5.js.map} +0 -0
- /package/dist/{redact-doc-UWXE2D52.js.map → redact-doc-O6NOJLUX.js.map} +0 -0
- /package/dist/{render-3TPZAAY3.js.map → render-6FEX4BYT.js.map} +0 -0
- /package/dist/{rewrite-fallback-FVI3MVUH.js.map → rewrite-fallback-7QMVNVIF.js.map} +0 -0
- /package/dist/{seal-ZNN4P4IN.js.map → seal-5BLP22A4.js.map} +0 -0
- /package/dist/{setup-5SZWEMHX.js.map → setup-727UTPWF.js.map} +0 -0
- /package/dist/{to-hwpx-KVCLOFIT.js.map → to-hwpx-4V6GIDFI.js.map} +0 -0
- /package/dist/{to-hwpx-UNNR4Y7K.js.map → to-hwpx-QOAFYHV3.js.map} +0 -0
- /package/dist/{visual-UDZERIUK.js.map → visual-XYHR33UB.js.map} +0 -0
- /package/dist/{watch-YCNXUIJL.js.map → watch-DWX4RTYR.js.map} +0 -0
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkDFFUNHVLcjs = require('./chunk-DFFUNHVL.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
var _chunkMMK32GPDcjs = require('./chunk-MMK32GPD.cjs');
|
|
@@ -50,7 +50,7 @@ var _chunk64H2FCYFcjs = require('./chunk-64H2FCYF.cjs');
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var _chunkY7LMYK5Ccjs = require('./chunk-Y7LMYK5C.cjs');
|
|
54
54
|
|
|
55
55
|
// src/ocr/ocr-stacked-rows.ts
|
|
56
56
|
var NUMERIC = /^[-+−△▲▽▼]?[\d.,]+[%p원]?$|^[-–—·∼~]원?$|^\([-+−△▲▽▼]?[\d.,]+%?\)$/;
|
|
@@ -852,8 +852,8 @@ var INKLESS_DELTA = 32;
|
|
|
852
852
|
function ringAsks(rgba, pageW, box, text, steps, stepPx) {
|
|
853
853
|
const chars = [...text];
|
|
854
854
|
if (chars.length !== steps.length || !/[가-힣]/.test(text)) return [];
|
|
855
|
-
const gray =
|
|
856
|
-
const rings =
|
|
855
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, pageW, box);
|
|
856
|
+
const rings = _chunkDFFUNHVLcjs.ringBoxes.call(void 0, gray, box.w, box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, gray));
|
|
857
857
|
const owner = ringOwners(chars, (i) => (steps[i] + 0.5) * stepPx, rings);
|
|
858
858
|
return rings.flatMap((r, k) => {
|
|
859
859
|
const at = owner.indexOf(k);
|
|
@@ -893,8 +893,8 @@ function ringGlyph(read, jamo = null, confidence = 1) {
|
|
|
893
893
|
function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}, rings = []) {
|
|
894
894
|
const chars = [...text];
|
|
895
895
|
if (chars.length !== steps.length) return text;
|
|
896
|
-
const gray =
|
|
897
|
-
const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink:
|
|
896
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, pageW, box);
|
|
897
|
+
const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink: _chunkDFFUNHVLcjs.inkStats.call(void 0, gray) };
|
|
898
898
|
if (/[[\]]/.test(text)) brackets(c);
|
|
899
899
|
if (text.includes("'")) cornerQuotes(c);
|
|
900
900
|
if (/['"]/.test(text)) quotes(c);
|
|
@@ -924,7 +924,7 @@ function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}, rings =
|
|
|
924
924
|
function trimInklessEnds(rgba, pageW, box, text, steps, stepPx) {
|
|
925
925
|
const chars = [...text], { w, h } = box;
|
|
926
926
|
if (chars.length !== steps.length || steps.some((s) => (s + 0.5) * stepPx > w + stepPx)) return { text, steps };
|
|
927
|
-
const gray =
|
|
927
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, pageW, box);
|
|
928
928
|
const hist = new Uint32Array(256);
|
|
929
929
|
for (const v of gray) hist[v]++;
|
|
930
930
|
let bg = 0;
|
|
@@ -955,8 +955,8 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
|
|
|
955
955
|
continue;
|
|
956
956
|
}
|
|
957
957
|
if (open > 0) {
|
|
958
|
-
const f =
|
|
959
|
-
if (f &&
|
|
958
|
+
const f = _chunkDFFUNHVLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
|
|
959
|
+
if (f && _chunkDFFUNHVLcjs.bracketShape.call(void 0, f, true) === "\u300D") {
|
|
960
960
|
chars[i] = "\u300D";
|
|
961
961
|
open--;
|
|
962
962
|
}
|
|
@@ -966,12 +966,12 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
|
|
|
966
966
|
function cornerQuotes({ chars, cx, gray, w, h, ink }) {
|
|
967
967
|
for (let i = 0; i < chars.length; i++) {
|
|
968
968
|
if (chars[i] !== "'" || !/^[가-힣]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
|
|
969
|
-
const f =
|
|
970
|
-
if (!f || f.ch < f.charH * 0.45 ||
|
|
969
|
+
const f = _chunkDFFUNHVLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
|
|
970
|
+
if (!f || f.ch < f.charH * 0.45 || _chunkDFFUNHVLcjs.bracketShape.call(void 0, f, false) !== "\u300C") continue;
|
|
971
971
|
const rest = chars.slice(i + 1), end = rest.findIndex((c) => c === "'" || c === "\u300D" || c === ",");
|
|
972
972
|
const pair = end >= 0 && rest[end] !== "'" && (rest[end] === "\u300D" || (() => {
|
|
973
|
-
const g =
|
|
974
|
-
return !!g &&
|
|
973
|
+
const g = _chunkDFFUNHVLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i + 1 + end));
|
|
974
|
+
return !!g && _chunkDFFUNHVLcjs.bracketShape.call(void 0, g, true) === "\u300D";
|
|
975
975
|
})());
|
|
976
976
|
if (pair) chars[i] = "\u300C";
|
|
977
977
|
}
|
|
@@ -979,8 +979,8 @@ function cornerQuotes({ chars, cx, gray, w, h, ink }) {
|
|
|
979
979
|
function brackets({ chars, cx, gray, w, h, ink }) {
|
|
980
980
|
const shape = chars.map((c, i) => {
|
|
981
981
|
if (c !== "[" && c !== "]") return null;
|
|
982
|
-
const f =
|
|
983
|
-
return f &&
|
|
982
|
+
const f = _chunkDFFUNHVLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
|
|
983
|
+
return f && _chunkDFFUNHVLcjs.bracketShape.call(void 0, f, c === "]");
|
|
984
984
|
});
|
|
985
985
|
for (let i = 0; i < chars.length; i++) {
|
|
986
986
|
if (chars[i] !== "[") continue;
|
|
@@ -1012,7 +1012,7 @@ function quotes({ chars, cx, gray, w, h, ink }) {
|
|
|
1012
1012
|
continue;
|
|
1013
1013
|
}
|
|
1014
1014
|
if (!year(i) && !single[kind]) continue;
|
|
1015
|
-
const r =
|
|
1015
|
+
const r = _chunkDFFUNHVLcjs.quoteHead.call(void 0, gray, w, h, ink, cx(i));
|
|
1016
1016
|
if (r !== null && r >= 0.47) {
|
|
1017
1017
|
chars[i] = kind === "'" ? "\u2018" : "\u201C";
|
|
1018
1018
|
open[kind] = true;
|
|
@@ -1023,7 +1023,7 @@ function dashes({ chars, cx, gray, w, h, ink }) {
|
|
|
1023
1023
|
const head = chars.findIndex((c) => c.trim()), letters = chars.some((c) => /[가-힣A-Za-z]/.test(c));
|
|
1024
1024
|
for (let i = 0; i < chars.length; i++) {
|
|
1025
1025
|
if (!/^[-\u2013\u2014]$/.test(chars[i])) continue;
|
|
1026
|
-
const r =
|
|
1026
|
+
const r = _chunkDFFUNHVLcjs.dashRatio.call(void 0, gray, w, h, ink, cx(i));
|
|
1027
1027
|
if (r === null) continue;
|
|
1028
1028
|
if (r < 0.65) chars[i] = "-";
|
|
1029
1029
|
else if (r > 0.75 && i === head && letters) chars[i] = "\u2014";
|
|
@@ -1033,7 +1033,7 @@ function circled({ chars, cx, gray, w, h, ink }) {
|
|
|
1033
1033
|
const alone = (re, i) => re.test(chars[i]) && !re.test(_nullishCoalesce(chars[i - 1], () => ( ""))) && !re.test(_nullishCoalesce(chars[i + 1], () => ( "")));
|
|
1034
1034
|
const at = chars.flatMap((_, i) => alone(/^\d$/, i) && chars[i] !== "0" || alone(/^[ㄱ-ㅎ]$/, i) || alone(/^[A-Za-z]$/, i) && /[a-zCSUVWXZ]/.test(chars[i]) ? [i] : []);
|
|
1035
1035
|
if (!at.length) return;
|
|
1036
|
-
const hit =
|
|
1036
|
+
const hit = _chunkDFFUNHVLcjs.circledAt.call(void 0, gray, w, h, ink, at.map(cx));
|
|
1037
1037
|
const JAMO = "\u3131\u3134\u3137\u3139\u3141\u3142\u3145\u3147\u3148\u314A\u314B\u314C\u314D\u314E";
|
|
1038
1038
|
at.forEach((i, k) => {
|
|
1039
1039
|
if (!hit[k]) return;
|
|
@@ -1046,16 +1046,16 @@ function stars({ chars, cx, gray, w, h, ink }) {
|
|
|
1046
1046
|
if (chars[i] !== "*" || chars[i - 1] === "*") continue;
|
|
1047
1047
|
let e = i;
|
|
1048
1048
|
while (chars[e + 1] === "*") e++;
|
|
1049
|
-
const n =
|
|
1049
|
+
const n = _chunkDFFUNHVLcjs.starRun.call(void 0, gray, w, h, ink, cx(i));
|
|
1050
1050
|
if (n > e - i + 1 && n <= 4) chars[e] += "*".repeat(n - (e - i + 1));
|
|
1051
1051
|
i = e;
|
|
1052
1052
|
}
|
|
1053
1053
|
}
|
|
1054
1054
|
function discs({ chars, cx, gray, w, h, ink }) {
|
|
1055
|
-
for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) &&
|
|
1055
|
+
for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) && _chunkDFFUNHVLcjs.discAt.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u25CF";
|
|
1056
1056
|
}
|
|
1057
1057
|
function gaps({ chars, cx, gray, w, h, ink }) {
|
|
1058
|
-
const { glyphs, bandH } =
|
|
1058
|
+
const { glyphs, bandH } = _chunkDFFUNHVLcjs.gapGlyphs.call(void 0, gray, w, h, ink);
|
|
1059
1059
|
if (!glyphs.length) return;
|
|
1060
1060
|
const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
|
|
1061
1061
|
if (!live.length) return;
|
|
@@ -1126,18 +1126,18 @@ function ring({ chars, cx, gray, w, h, ink }) {
|
|
|
1126
1126
|
const rest = chars.slice(k + 1).join("").trimStart();
|
|
1127
1127
|
const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
|
|
1128
1128
|
if (live.length <= 3 && live.every((i) => /^[Oo]$/.test(chars[i]))) {
|
|
1129
|
-
if (_optionalChain([
|
|
1130
|
-
if (!live.every((i) =>
|
|
1129
|
+
if (_optionalChain([_chunkDFFUNHVLcjs.leadingBullet.call(void 0, gray, w, h, ink, cx(live[0])), 'optionalAccess', _11 => _11.mark]) === "\u25CE") return false;
|
|
1130
|
+
if (!live.every((i) => _chunkDFFUNHVLcjs.ringBullet.call(void 0, gray, w, h, ink, cx(i)) === "\u25CB")) return false;
|
|
1131
1131
|
for (const i of live) chars[i] = "\u25CB";
|
|
1132
1132
|
return true;
|
|
1133
1133
|
}
|
|
1134
1134
|
if (/^[A-Z]{2,}/.test(rest) && /^[Oo0]$/.test(chars[k])) {
|
|
1135
|
-
if (
|
|
1135
|
+
if (_chunkDFFUNHVLcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k)) !== "\u25CB") return false;
|
|
1136
1136
|
chars[k] = chars[k + 1] === " " ? "\u25CB" : "\u25CB ";
|
|
1137
1137
|
return true;
|
|
1138
1138
|
}
|
|
1139
1139
|
if (!/^[(\[「【<]?\d*[가-힣]/.test(rest)) return false;
|
|
1140
|
-
const r =
|
|
1140
|
+
const r = _chunkDFFUNHVLcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k));
|
|
1141
1141
|
if (/^[Cc]$/.test(chars[k]) && r !== "\u25CB") return false;
|
|
1142
1142
|
if (r) chars[k] = r;
|
|
1143
1143
|
return r !== null;
|
|
@@ -1154,7 +1154,7 @@ function parallels({ chars, cx, gray, w, h, ink }) {
|
|
|
1154
1154
|
let p = s - 1, q = e + 1;
|
|
1155
1155
|
while (p >= 0 && !chars[p].trim()) p--;
|
|
1156
1156
|
while (q < chars.length && !chars[q].trim()) q++;
|
|
1157
|
-
if (
|
|
1157
|
+
if (_chunkDFFUNHVLcjs.slantedPair.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity)) {
|
|
1158
1158
|
chars[s] = "\u2225";
|
|
1159
1159
|
for (let k = s + 1; k <= e; k++) chars[k] = "";
|
|
1160
1160
|
}
|
|
@@ -1166,7 +1166,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
|
|
|
1166
1166
|
const ROMAN = /^[IⅠ-Ⅲ]$/, LATIN = /[A-Za-z]$/;
|
|
1167
1167
|
for (let i = 0; i < chars.length; i++) {
|
|
1168
1168
|
if (chars[i] !== "1" || /[\dA-Za-z]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || /^[\dA-Za-z,]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
|
|
1169
|
-
if (
|
|
1169
|
+
if (_chunkDFFUNHVLcjs.serifOne.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u2160";
|
|
1170
1170
|
}
|
|
1171
1171
|
for (let i = 0; i < chars.length; i++) {
|
|
1172
1172
|
const hangul = /^[파피]$/.test(chars[i]);
|
|
@@ -1176,13 +1176,13 @@ function roman({ chars, cx, gray, w, h, ink }) {
|
|
|
1176
1176
|
while (q < chars.length && !chars[q].trim()) q++;
|
|
1177
1177
|
const glued = hangul ? chars[p] === "(" && chars[q] === "-" : /[가-힣]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || (_nullishCoalesce(chars[i + 1], () => ( ""))) === "." || chars[p] === "-" && chars[q] === "-";
|
|
1178
1178
|
if (!glued) continue;
|
|
1179
|
-
const n =
|
|
1179
|
+
const n = _chunkDFFUNHVLcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
|
|
1180
1180
|
if (n) chars[i] = String.fromCharCode(8543 + n);
|
|
1181
1181
|
}
|
|
1182
1182
|
const inRoman = (i) => ROMAN.test(chars[i]) || chars[i] === "1" && (ROMAN.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || ROMAN.test(_nullishCoalesce(chars[i + 1], () => ( ""))));
|
|
1183
1183
|
const k = chars.findIndex((c) => c.trim());
|
|
1184
1184
|
if (chars[k] === "." && chars.slice(k + 1).some((c) => /[가-힣A-Za-z0-9]/.test(c))) {
|
|
1185
|
-
const n =
|
|
1185
|
+
const n = _chunkDFFUNHVLcjs.romanStems.call(void 0, gray, w, h, ink, -Infinity, cx(k));
|
|
1186
1186
|
if (n) chars[k] = String.fromCharCode(8543 + n) + chars[k];
|
|
1187
1187
|
}
|
|
1188
1188
|
for (let s = 0; s < chars.length; ) {
|
|
@@ -1200,7 +1200,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
|
|
|
1200
1200
|
let p = s - 1, q = e;
|
|
1201
1201
|
while (p >= 0 && !chars[p].trim()) p--;
|
|
1202
1202
|
while (q < chars.length && !chars[q].trim()) q++;
|
|
1203
|
-
const n =
|
|
1203
|
+
const n = _chunkDFFUNHVLcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
|
|
1204
1204
|
const canon = n ? [["\u2160", "I"], ["\u2161", "II"], ["\u2162", "III"]][n - 1] : null;
|
|
1205
1205
|
if (canon && !canon.includes(tok)) {
|
|
1206
1206
|
chars[s] = canon[0];
|
|
@@ -1629,8 +1629,8 @@ function joinGapLeaders(rgba, width, items) {
|
|
|
1629
1629
|
if (g1 - g0 < h * 3) continue;
|
|
1630
1630
|
const pad = Math.round(h * 0.25), y = Math.max(0, Math.min(left.y, num.y) - pad), x = Math.max(0, Math.round(g0 - h));
|
|
1631
1631
|
const box = { x, y, w: Math.min(width, Math.round(g1 + h)) - x, h: Math.min(Math.floor(rgba.length / 4 / width), Math.max(left.y + left.h, num.y + num.h) + pad) - y };
|
|
1632
|
-
const gray =
|
|
1633
|
-
const runs =
|
|
1632
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, box);
|
|
1633
|
+
const runs = _chunkDFFUNHVLcjs.leaderRuns.call(void 0, gray, box.w, box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, gray), LEADER_MIN_DOTS);
|
|
1634
1634
|
const cover = runs.reduce((k, [a, b]) => k + Math.max(0, Math.min(b, g1 - box.x) - Math.max(a, g0 - box.x)), 0);
|
|
1635
1635
|
if (cover < (g1 - g0) * 0.6) continue;
|
|
1636
1636
|
for (const o of items) if (junk(o) && sameLine(o, num) && o.x >= g0 - 2 && o.x + o.w <= g1 + 2) gone.add(o);
|
|
@@ -1913,7 +1913,7 @@ var OcrEngine = class _OcrEngine {
|
|
|
1913
1913
|
this.ort = parts.ort;
|
|
1914
1914
|
this.sharp = parts.sharp;
|
|
1915
1915
|
}
|
|
1916
|
-
static async create(models =
|
|
1916
|
+
static async create(models = _chunkDFFUNHVLcjs.DEFAULT_OCR_MODELS) {
|
|
1917
1917
|
_chunkTK3FDAEEcjs.disableOrtTelemetry.call(void 0, );
|
|
1918
1918
|
const [ortMod, sharpModRaw] = await Promise.all([
|
|
1919
1919
|
tryImport("onnxruntime-node", () => Promise.resolve().then(() => _interopRequireWildcard(require("onnxruntime-node")))),
|
|
@@ -1933,16 +1933,16 @@ var OcrEngine = class _OcrEngine {
|
|
|
1933
1933
|
const local = (s) => "spec" in s ? Promise.resolve(null) : verifiedBytes(s);
|
|
1934
1934
|
const [detBytes, recBytes, dictBytes] = await Promise.all([local(models.det), local(models.rec), local(models.dict)]);
|
|
1935
1935
|
const session = (s, bytes) => bytes ? ortMod.InferenceSession.create(bytes, sessionOpts).catch(() => {
|
|
1936
|
-
throw new (0,
|
|
1937
|
-
}) : ortMod.InferenceSession.create(
|
|
1936
|
+
throw new (0, _chunkY7LMYK5Ccjs.KordocError)(`OCR \uBAA8\uB378\uC744 \uC5F4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${_path.basename.call(void 0, _chunkDFFUNHVLcjs.ocrSourcePath.call(void 0, s))} \u2014 ONNX \uBAA8\uB378\uC774 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB410\uC2B5\uB2C8\uB2E4`);
|
|
1937
|
+
}) : ortMod.InferenceSession.create(_chunkDFFUNHVLcjs.ocrSourcePath.call(void 0, s), sessionOpts);
|
|
1938
1938
|
const [det, rec, dictYml] = await Promise.all([
|
|
1939
1939
|
session(models.det, detBytes),
|
|
1940
1940
|
session(models.rec, recBytes),
|
|
1941
|
-
dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0,
|
|
1941
|
+
dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0, _chunkDFFUNHVLcjs.ocrSourcePath.call(void 0, models.dict), "utf-8")
|
|
1942
1942
|
]);
|
|
1943
|
-
const dict =
|
|
1943
|
+
const dict = _chunkDFFUNHVLcjs.parseCharacterDict.call(void 0, dictYml);
|
|
1944
1944
|
if (dict.length === 0) {
|
|
1945
|
-
throw "spec" in models.dict ? new Error("OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 \uBAA8\uB378 \uCE90\uC2DC\uB97C \uC0AD\uC81C \uD6C4 \uC7AC\uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694") : new (0,
|
|
1945
|
+
throw "spec" in models.dict ? new Error("OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 \uBAA8\uB378 \uCE90\uC2DC\uB97C \uC0AD\uC81C \uD6C4 \uC7AC\uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694") : new (0, _chunkY7LMYK5Ccjs.KordocError)(`OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 ${_path.basename.call(void 0, models.dict.file.path)} \uC5D0 PostProcess.character_dict \uBAA9\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
|
|
1946
1946
|
}
|
|
1947
1947
|
return new _OcrEngine({ det, rec, dict, ort: ortMod, sharp: sharpMod });
|
|
1948
1948
|
}
|
|
@@ -1974,10 +1974,10 @@ var OcrEngine = class _OcrEngine {
|
|
|
1974
1974
|
if (it.x - x < it.h * 0.8) return;
|
|
1975
1975
|
if (items.some((o) => o !== it && o.x < it.x && o.x + o.w > x && o.y < it.y + it.h && o.y + o.h > it.y)) return;
|
|
1976
1976
|
const box = { x, y: it.y, w: it.x + it.w - x, h: it.h };
|
|
1977
|
-
const g =
|
|
1978
|
-
const b =
|
|
1977
|
+
const g = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, box);
|
|
1978
|
+
const b = _chunkDFFUNHVLcjs.leadingBullet.call(void 0, g, box.w, box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, g), it.x - x, 1.05);
|
|
1979
1979
|
if (_optionalChain([b, 'optionalAccess', _36 => _36.mark]) !== "\u25A1" || b.covers) return;
|
|
1980
|
-
const ink =
|
|
1980
|
+
const ink = _chunkDFFUNHVLcjs.inkStats.call(void 0, g), on = (v) => ink.darkInk ? v <= ink.threshold : v > ink.threshold;
|
|
1981
1981
|
let left = 0;
|
|
1982
1982
|
while (left < it.x - x && !Array.from({ length: box.h }, (_, y) => g[y * box.w + left]).some(on)) left++;
|
|
1983
1983
|
it.text = "\u25A1 " + it.text;
|
|
@@ -2009,12 +2009,12 @@ var OcrEngine = class _OcrEngine {
|
|
|
2009
2009
|
const joins = [];
|
|
2010
2010
|
let group = 0;
|
|
2011
2011
|
for (const b of boxes) {
|
|
2012
|
-
const gray =
|
|
2013
|
-
const ink =
|
|
2012
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, b);
|
|
2013
|
+
const ink = _chunkDFFUNHVLcjs.inkStats.call(void 0, gray);
|
|
2014
2014
|
if (tuning.minInkContrast > 0 && ink.contrast < tuning.minInkContrast) continue;
|
|
2015
2015
|
if (tuning.minInkContrast > 0 && ink.inkRatio < MIN_INK_RATIO) continue;
|
|
2016
2016
|
if (tuning.splitTall && b.h >= b.w * TALL_RATIO) {
|
|
2017
|
-
const bands =
|
|
2017
|
+
const bands = _chunkDFFUNHVLcjs.splitRowBands.call(void 0, gray, b.w, b.h, ink, 0.45);
|
|
2018
2018
|
if (bands.length >= 2) {
|
|
2019
2019
|
for (const sub of bandBoxes(b, bands, height)) jobs.push({ box: sub, rot: 0, group: group++ });
|
|
2020
2020
|
continue;
|
|
@@ -2038,9 +2038,9 @@ var OcrEngine = class _OcrEngine {
|
|
|
2038
2038
|
continue;
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
|
-
const trim = tuning.trimEdges ?
|
|
2041
|
+
const trim = tuning.trimEdges ? _chunkDFFUNHVLcjs.edgeTrim.call(void 0, gray, b.w, b.h, ink) : null;
|
|
2042
2042
|
const keep = trim ? { ...trim, bg: median(gray) } : void 0;
|
|
2043
|
-
const leaders = tuning.splitLeaders ?
|
|
2043
|
+
const leaders = tuning.splitLeaders ? _chunkDFFUNHVLcjs.leaderRuns.call(void 0, gray, b.w, b.h, ink, LEADER_MIN_DOTS) : [];
|
|
2044
2044
|
if (leaders.length) {
|
|
2045
2045
|
const join = joins.length;
|
|
2046
2046
|
joins.push({ box: b, parts: [], trailDots: false });
|
|
@@ -2049,7 +2049,7 @@ var OcrEngine = class _OcrEngine {
|
|
|
2049
2049
|
const bare = { x: b.x + x0, y: b.y, w: a - x0, h: b.h };
|
|
2050
2050
|
const end = c > a ? Math.min(c, a + Math.round(b.h * LEADER_CONTEXT)) : a;
|
|
2051
2051
|
x0 = c;
|
|
2052
|
-
if (bare.w >= DET_MIN_SIZE &&
|
|
2052
|
+
if (bare.w >= DET_MIN_SIZE && _chunkDFFUNHVLcjs.inkStats.call(void 0, _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, bare)).contrast >= Math.max(1, tuning.minInkContrast)) {
|
|
2053
2053
|
jobs.push({ box: { ...bare, w: end - (bare.x - b.x) }, rot: 0, group: group++, join, dotsBefore: dots, trimDots: end > a });
|
|
2054
2054
|
dots = false;
|
|
2055
2055
|
}
|
|
@@ -2098,15 +2098,15 @@ var OcrEngine = class _OcrEngine {
|
|
|
2098
2098
|
let text = tuning.postprocess ? restoreSymbols(raw.trim(), note.ringLead) : raw;
|
|
2099
2099
|
if (!text.trim()) continue;
|
|
2100
2100
|
if (tuning.postprocess && job.rot === 0 && text !== "/" && /^[(:;/)]+$/.test(text) && text.includes("/")) {
|
|
2101
|
-
const g =
|
|
2102
|
-
if (
|
|
2101
|
+
const g = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, job.box);
|
|
2102
|
+
if (_chunkDFFUNHVLcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, g)) === 1) text = "/";
|
|
2103
2103
|
}
|
|
2104
2104
|
let ringByShape = false;
|
|
2105
2105
|
if (tuning.postprocess && job.rot === 0 && !/^[◎●▪□■▣❐❏○ㅇ◆◇◈]/.test(text)) {
|
|
2106
2106
|
const chars = [...read], k = chars.findIndex((c) => c.trim());
|
|
2107
2107
|
if (k >= 0 && steps.length === chars.length) {
|
|
2108
|
-
const g =
|
|
2109
|
-
const b =
|
|
2108
|
+
const g = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, job.box);
|
|
2109
|
+
const b = _chunkDFFUNHVLcjs.leadingBullet.call(void 0, g, job.box.w, job.box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx);
|
|
2110
2110
|
const body = (_nullishCoalesce(text.match(/[가-힣]/g), () => ( []))).length >= 4;
|
|
2111
2111
|
const miss = /^[Oo0•·ㆍ∙‧○]/.test(text);
|
|
2112
2112
|
if (_optionalChain([b, 'optionalAccess', _39 => _39.mark]) === "\u25CE" && b.covers && /^[Oo0○©]/.test(text)) {
|
|
@@ -2121,17 +2121,17 @@ var OcrEngine = class _OcrEngine {
|
|
|
2121
2121
|
} else if (_optionalChain([b, 'optionalAccess', _46 => _46.mark]) === "\u2750" || _optionalChain([b, 'optionalAccess', _47 => _47.mark]) === "\u274F") {
|
|
2122
2122
|
if (b.covers ? /^[ㅁ口]/.test(text) : body) text = b.covers ? b.mark + text.slice(1) : b.mark + " " + text;
|
|
2123
2123
|
} else if (b && b.mark !== "\u25CE" && body) text = b.covers ? miss ? b.mark + " " + text.slice(1).trimStart() : text : b.mark + " " + text;
|
|
2124
|
-
else if (!b && body && /^[가-힣]/.test(chars[k]) &&
|
|
2124
|
+
else if (!b && body && /^[가-힣]/.test(chars[k]) && _chunkDFFUNHVLcjs.leadingRing.call(void 0, g, job.box.w, job.box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx)) text = "\u25CB " + text;
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
2127
|
if (tuning.postprocess && /^\d/.test(text) && job.rot === 0) {
|
|
2128
|
-
const g =
|
|
2129
|
-
const tri =
|
|
2128
|
+
const g = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, job.box);
|
|
2129
|
+
const tri = _chunkDFFUNHVLcjs.leadingTriangle.call(void 0, g, job.box.w, job.box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, g));
|
|
2130
2130
|
if (tri) text = tri + text;
|
|
2131
2131
|
}
|
|
2132
2132
|
if (tuning.postprocess && text === "\u2192" && job.rot === 0 && job.join === void 0) {
|
|
2133
|
-
const g =
|
|
2134
|
-
text = _nullishCoalesce(
|
|
2133
|
+
const g = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, job.box);
|
|
2134
|
+
text = _nullishCoalesce(_chunkDFFUNHVLcjs.arrowGlyph.call(void 0, g, job.box.w, job.box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, g)), () => ( text));
|
|
2135
2135
|
}
|
|
2136
2136
|
if (job.footer) {
|
|
2137
2137
|
if (!/^[-\u2013\u2014]?\s*(?:\d{1,4}|[ivxIVXⅰ-ⅹⅠ-Ⅹ]{1,4})\s*[-\u2013\u2014]?$/.test(text.trim())) continue;
|
|
@@ -2155,7 +2155,7 @@ var OcrEngine = class _OcrEngine {
|
|
|
2155
2155
|
continue;
|
|
2156
2156
|
}
|
|
2157
2157
|
const item = { text, ...this.itemBox(rgba, width, job.box, tuning), confidence };
|
|
2158
|
-
if (job.rot === 0)
|
|
2158
|
+
if (job.rot === 0) _chunkDFFUNHVLcjs.rememberOcrTextGaps.call(void 0, item, _chunkDFFUNHVLcjs.findOcrTextGaps.call(void 0, rgba, width, job.box, read, text, steps, stepPx));
|
|
2159
2159
|
if (job.rot === 0 && job.keep === void 0) boxOf.set(item, job.box);
|
|
2160
2160
|
items.push(item);
|
|
2161
2161
|
}
|
|
@@ -2169,7 +2169,7 @@ var OcrEngine = class _OcrEngine {
|
|
|
2169
2169
|
const merged = rereadNumberText(it.text, r.text);
|
|
2170
2170
|
if (merged === null) return;
|
|
2171
2171
|
it.text = merged;
|
|
2172
|
-
|
|
2172
|
+
_chunkDFFUNHVLcjs.rememberOcrTextGaps.call(void 0, it, _chunkDFFUNHVLcjs.findOcrTextGaps.call(void 0, rgba, width, boxOf.get(it), r.text, it.text, r.steps, r.stepPx));
|
|
2173
2173
|
});
|
|
2174
2174
|
}
|
|
2175
2175
|
const pairs = tuning.postprocess ? items.filter((it) => boxOf.has(it) && NUMBER_PAIR.test(it.text.trim())) : [];
|
|
@@ -2197,8 +2197,8 @@ var OcrEngine = class _OcrEngine {
|
|
|
2197
2197
|
const halves = [];
|
|
2198
2198
|
for (const it of tall) {
|
|
2199
2199
|
const b = boxOf.get(it);
|
|
2200
|
-
const gray =
|
|
2201
|
-
const cut = _nullishCoalesce(midBlankRow(gray, b.w, b.h,
|
|
2200
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, b);
|
|
2201
|
+
const cut = _nullishCoalesce(midBlankRow(gray, b.w, b.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, gray)), () => ( valleyRow(gray, b.w, b.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, gray))));
|
|
2202
2202
|
if (cut) halves.push({ it, top: { ...b, h: cut[0] }, bottom: { ...b, y: b.y + cut[1], h: b.h - cut[1] } });
|
|
2203
2203
|
}
|
|
2204
2204
|
const res = halves.length ? await this.recognizeJobs(rgba, width, halves.flatMap((hv, k) => [{ box: hv.top, rot: 0, group: 2 * k }, { box: hv.bottom, rot: 0, group: 2 * k + 1 }]), tuning.recBatch) : [];
|
|
@@ -2219,15 +2219,15 @@ var OcrEngine = class _OcrEngine {
|
|
|
2219
2219
|
const subs = [];
|
|
2220
2220
|
const stacks = [];
|
|
2221
2221
|
for (const b of [...retry, ...blank2]) {
|
|
2222
|
-
const gray =
|
|
2223
|
-
const ink =
|
|
2222
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, b);
|
|
2223
|
+
const ink = _chunkDFFUNHVLcjs.inkStats.call(void 0, gray);
|
|
2224
2224
|
const cut = retry.includes(b) ? midBlankRow(gray, b.w, b.h, ink) : null;
|
|
2225
2225
|
const inCell = cellRules.some((r) => r.x1 <= b.x + 2 && r.y1 <= b.y && r.y2 >= b.y + b.h) && cellRules.some((r) => r.x1 >= b.x + b.w - 2 && r.y1 <= b.y && r.y2 >= b.y + b.h);
|
|
2226
2226
|
if (cut && b.w >= (inCell ? 2 : 3) * Math.max(cut[0], b.h - cut[1])) {
|
|
2227
2227
|
subs.push({ ...b, h: cut[0] }, { ...b, y: b.y + cut[1], h: b.h - cut[1] });
|
|
2228
2228
|
continue;
|
|
2229
2229
|
}
|
|
2230
|
-
const bands =
|
|
2230
|
+
const bands = _chunkDFFUNHVLcjs.stackedGlyphBands.call(void 0, gray, b.w, b.h, ink);
|
|
2231
2231
|
if (bands) stacks.push({ box: b, parts: bandBoxes(b, bands, height), word: bands.every((x, i) => i === 0 || x.y0 - bands[i - 1].y1 <= STACK_WORD_GAP * Math.max(x.y1 - x.y0, bands[i - 1].y1 - bands[i - 1].y0)) });
|
|
2232
2232
|
}
|
|
2233
2233
|
const overlap = (a, o) => Math.max(0, Math.min(a.x + a.w, o.x + o.w) - Math.max(a.x, o.x)) * Math.max(0, Math.min(a.y + a.h, o.y + o.h) - Math.max(a.y, o.y));
|
|
@@ -2306,8 +2306,8 @@ var OcrEngine = class _OcrEngine {
|
|
|
2306
2306
|
/** 결과 좌표 — det 박스 그대로 또는 박스 안 잉크 외곽 (tightBoxes) */
|
|
2307
2307
|
itemBox(rgba, width, b, tuning) {
|
|
2308
2308
|
if (!tuning.tightBoxes) return b;
|
|
2309
|
-
const gray =
|
|
2310
|
-
const t =
|
|
2309
|
+
const gray = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, width, b);
|
|
2310
|
+
const t = _chunkDFFUNHVLcjs.inkBounds.call(void 0, gray, b.w, b.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, gray));
|
|
2311
2311
|
return { x: b.x + t.x0, y: b.y + t.y0, w: t.x1 - t.x0, h: t.y1 - t.y0 };
|
|
2312
2312
|
}
|
|
2313
2313
|
// ─── det ─────────────────────────────────────────────
|
|
@@ -2378,7 +2378,7 @@ var OcrEngine = class _OcrEngine {
|
|
|
2378
2378
|
const out = await this.rec.run({ [this.rec.inputNames[0]]: tensor });
|
|
2379
2379
|
const logits = out[this.rec.outputNames[0]];
|
|
2380
2380
|
const [, T, C] = logits.dims;
|
|
2381
|
-
if (C !== this.dict.length + 2) throw new (0,
|
|
2381
|
+
if (C !== this.dict.length + 2) throw new (0, _chunkY7LMYK5Ccjs.KordocError)(`OCR rec \uCD9C\uB825 \uD074\uB798\uC2A4 ${C}\uAC1C\uAC00 \uC0AC\uC804 ${this.dict.length}\uC790 + 2 \uC640 \uB2E4\uB985\uB2C8\uB2E4 \u2014 \uBAA8\uB378\uC5D0 \uB9DE\uB294 \uC0AC\uC804(ocrRecDict)\uC744 \uC9C0\uC815\uD558\uC138\uC694`);
|
|
2382
2382
|
const data = logits.data;
|
|
2383
2383
|
idx.forEach((ci, k) => {
|
|
2384
2384
|
const r = ctcDecode(data.subarray(k * T * C, (k + 1) * T * C), T, C, this.dict);
|
|
@@ -2388,9 +2388,9 @@ var OcrEngine = class _OcrEngine {
|
|
|
2388
2388
|
const chars = r ? [...r.text] : [];
|
|
2389
2389
|
if (r && job.rot === 0 && chars.length === r.steps.length && r.steps.some((t) => t > last) && !r.text.includes("(cid:")) {
|
|
2390
2390
|
const tallCh = (c) => !/[\s.,:;\u00b7\u2026'"\u2018-\u201d`\-_~]/.test(c);
|
|
2391
|
-
const g =
|
|
2391
|
+
const g = _chunkDFFUNHVLcjs.grayCrop.call(void 0, rgba, pageW, job.box);
|
|
2392
2392
|
const inside = chars.filter((c, i) => r.steps[i] <= last && tallCh(c)).length;
|
|
2393
|
-
let budget = inside <= 2 ?
|
|
2393
|
+
let budget = inside <= 2 ? _chunkDFFUNHVLcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkDFFUNHVLcjs.inkStats.call(void 0, g)) - inside : Infinity;
|
|
2394
2394
|
const keep = chars.map((c, i) => r.steps[i] <= last || !tallCh(c) || budget-- > 0);
|
|
2395
2395
|
if (!keep.every(Boolean)) kept = { ...r, text: chars.filter((_, i) => keep[i]).join(""), steps: r.steps.filter((_, i) => keep[i]) };
|
|
2396
2396
|
}
|
|
@@ -2501,13 +2501,13 @@ async function tryImport(name, loader) {
|
|
|
2501
2501
|
return await loader();
|
|
2502
2502
|
} catch (e) {
|
|
2503
2503
|
throw new Error(
|
|
2504
|
-
`\uB0B4\uC7A5 OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${
|
|
2504
|
+
`\uB0B4\uC7A5 OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkY7LMYK5Ccjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
|
|
2505
2505
|
);
|
|
2506
2506
|
}
|
|
2507
2507
|
}
|
|
2508
2508
|
async function verifiedBytes(s) {
|
|
2509
2509
|
const name = _path.basename.call(void 0, s.file.path);
|
|
2510
|
-
const fail = (why2) => new (0,
|
|
2510
|
+
const fail = (why2) => new (0, _chunkY7LMYK5Ccjs.KordocError)(`OCR \uBAA8\uB378 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${name} (${why2})`);
|
|
2511
2511
|
const why = (e) => {
|
|
2512
2512
|
const code = e.code;
|
|
2513
2513
|
return code === "ENOENT" ? "\uD30C\uC77C\uC774 \uC5C6\uC74C" : code === "EACCES" || code === "EPERM" ? "\uAD8C\uD55C \uC5C6\uC74C" : "\uC77D\uAE30 \uC2E4\uD328";
|
|
@@ -2528,13 +2528,13 @@ async function verifiedBytes(s) {
|
|
|
2528
2528
|
}
|
|
2529
2529
|
const actual = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex");
|
|
2530
2530
|
if (actual !== s.file.sha256) {
|
|
2531
|
-
throw new (0,
|
|
2531
|
+
throw new (0, _chunkY7LMYK5Ccjs.KordocError)(`OCR \uBAA8\uB378 SHA256 mismatch: ${_path.basename.call(void 0, s.file.path)} \u2014 expected ${s.file.sha256}, got ${actual} (\uB85C\uB4DC \uAC70\uBD80)`);
|
|
2532
2532
|
}
|
|
2533
2533
|
return bytes;
|
|
2534
2534
|
}
|
|
2535
2535
|
var engines = /* @__PURE__ */ new Map();
|
|
2536
|
-
function getOcrEngine(models =
|
|
2537
|
-
const key =
|
|
2536
|
+
function getOcrEngine(models = _chunkDFFUNHVLcjs.DEFAULT_OCR_MODELS) {
|
|
2537
|
+
const key = _chunkDFFUNHVLcjs.ocrSelectionKey.call(void 0, models);
|
|
2538
2538
|
let p = engines.get(key);
|
|
2539
2539
|
if (!p) {
|
|
2540
2540
|
p = OcrEngine.create(models).catch((err) => {
|
|
@@ -3010,20 +3010,20 @@ var REDETECT = { minDropped: 15, minShare: 0.15, scale: 5 / 3 };
|
|
|
3010
3010
|
var AUTO_REC = { pageConf: 0.9, gain: 0.06 };
|
|
3011
3011
|
var DEFAULT_AUTO_REC = { pageConf: 0.9, gain: 0.08, altConf: 0.95, sureGain: 0.1, minDiff: 0.08, minChars: 80, lazy: true };
|
|
3012
3012
|
var DEFAULT_BUILTIN_OCR = Object.freeze({
|
|
3013
|
-
models:
|
|
3013
|
+
models: _chunkDFFUNHVLcjs.DEFAULT_OCR_MODELS,
|
|
3014
3014
|
tuning: DEFAULT_OCR_TUNING,
|
|
3015
|
-
handwriting:
|
|
3015
|
+
handwriting: _chunkDFFUNHVLcjs.handwritingFallbackModels.call(void 0, _chunkDFFUNHVLcjs.DEFAULT_OCR_MODELS),
|
|
3016
3016
|
autoRec: DEFAULT_AUTO_REC
|
|
3017
3017
|
});
|
|
3018
3018
|
var DEFAULT_BUILTIN_OCR_FETCH = Object.freeze({ ...DEFAULT_BUILTIN_OCR, autoRec: { ...DEFAULT_AUTO_REC, fetch: true } });
|
|
3019
3019
|
function builtinOcrConfig(o) {
|
|
3020
3020
|
if (!o || o.ocrDet === void 0 && o.ocrDetLongSide === void 0 && o.ocrRec === void 0 && o.ocrRecDict === void 0 && !o.ocrLines) return _optionalChain([o, 'optionalAccess', _78 => _78.ocr]) ? DEFAULT_BUILTIN_OCR_FETCH : DEFAULT_BUILTIN_OCR;
|
|
3021
3021
|
const bad = _chunkMMK32GPDcjs.validateOcrOptions.call(void 0, o);
|
|
3022
|
-
if (bad) throw new (0,
|
|
3023
|
-
const models =
|
|
3022
|
+
if (bad) throw new (0, _chunkY7LMYK5Ccjs.KordocError)(bad);
|
|
3023
|
+
const models = _chunkDFFUNHVLcjs.resolveOcrModels.call(void 0, o);
|
|
3024
3024
|
return {
|
|
3025
3025
|
models,
|
|
3026
|
-
...o.ocrRec === "auto" ? { handwriting:
|
|
3026
|
+
...o.ocrRec === "auto" ? { handwriting: _chunkDFFUNHVLcjs.handwritingFallbackModels.call(void 0, models), autoRec: AUTO_REC } : o.ocrRec === void 0 ? { handwriting: _chunkDFFUNHVLcjs.handwritingFallbackModels.call(void 0, models), autoRec: o.ocr ? { ...DEFAULT_AUTO_REC, fetch: true } : DEFAULT_AUTO_REC } : {},
|
|
3027
3027
|
tuning: o.ocrDetLongSide === void 0 ? DEFAULT_OCR_TUNING : { ...DEFAULT_OCR_TUNING, detLongSide: o.ocrDetLongSide },
|
|
3028
3028
|
lines: o.ocrLines === "all" ? "all" : o.ocrLines ? "kept" : void 0
|
|
3029
3029
|
};
|
|
@@ -3049,8 +3049,8 @@ async function withHandwritingRec(items, config, tuning, rgba, width, height, st
|
|
|
3049
3049
|
const altStats = { droppedLowConf: 0, ...stats.dropped ? { dropped: [] } : {} };
|
|
3050
3050
|
let alt;
|
|
3051
3051
|
try {
|
|
3052
|
-
if (auto.lazy && !auto.fetch && !await
|
|
3053
|
-
if (auto.lazy) await
|
|
3052
|
+
if (auto.lazy && !auto.fetch && !await _chunkDFFUNHVLcjs.ocrModelsCached.call(void 0, config.handwriting)) return items;
|
|
3053
|
+
if (auto.lazy) await _chunkDFFUNHVLcjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
|
|
3054
3054
|
alt = await (await getOcrEngine(config.handwriting)).recognizePage(rgba, width, height, altStats, tuning, cellRules, rowRules);
|
|
3055
3055
|
} catch (e) {
|
|
3056
3056
|
if (!auto.lazy) throw e;
|
|
@@ -3096,8 +3096,8 @@ async function runPdfOcr(buffer, targets, mode, warnings, onProgress, detectTabl
|
|
|
3096
3096
|
"@hyzyla/pdfium",
|
|
3097
3097
|
() => Promise.resolve().then(() => _interopRequireWildcard(require("@hyzyla/pdfium")))
|
|
3098
3098
|
);
|
|
3099
|
-
if (mode === "builtin") await
|
|
3100
|
-
if (mode === "builtin" && config.handwriting && !_optionalChain([config, 'access', _79 => _79.autoRec, 'optionalAccess', _80 => _80.lazy])) await
|
|
3099
|
+
if (mode === "builtin") await _chunkDFFUNHVLcjs.ensureOcrModelsFor.call(void 0, config.models, reportModelDownload);
|
|
3100
|
+
if (mode === "builtin" && config.handwriting && !_optionalChain([config, 'access', _79 => _79.autoRec, 'optionalAccess', _80 => _80.lazy])) await _chunkDFFUNHVLcjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
|
|
3101
3101
|
const engine = mode === "builtin" ? await getOcrEngine(config.models) : null;
|
|
3102
3102
|
const pdfium = await pdfiumMod.PDFiumLibrary.init();
|
|
3103
3103
|
const doc = await pdfium.loadDocument(new Uint8Array(buffer));
|
|
@@ -3210,7 +3210,7 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
|
|
|
3210
3210
|
const x1 = r.x1 * scale - 2, x2 = r.x2 * scale + 2, y1 = (pdfH - r.y2) * scale - 2, y2 = (pdfH - r.y1) * scale + 2;
|
|
3211
3211
|
const columnRules = _nullishCoalesce(_optionalChain([ruling, 'optionalAccess', _89 => _89.verticals, 'access', _90 => _90.filter, 'call', _91 => _91((s) => Math.min(s.x1, s.x2) >= x1 && Math.max(s.x1, s.x2) <= x2 && Math.min(s.y1, s.y2) >= y1 && Math.max(s.y1, s.y2) <= y2), 'access', _92 => _92.length]), () => ( 0));
|
|
3212
3212
|
if (columnRules < 2) {
|
|
3213
|
-
for (const b of blocks) if (b.type === "table")
|
|
3213
|
+
for (const b of blocks) if (b.type === "table") _chunkDFFUNHVLcjs.UNRULED_REGION_TABLES.add(b);
|
|
3214
3214
|
}
|
|
3215
3215
|
return blocks;
|
|
3216
3216
|
});
|
|
@@ -3282,7 +3282,7 @@ async function closerReads(rgba, rw, rh, pdfH, hi, regions, engine, tuning = REG
|
|
|
3282
3282
|
const items = await engine.recognizePage(crop, cw, ch, void 0, tuning);
|
|
3283
3283
|
out.push(items.map((it) => {
|
|
3284
3284
|
const placed = { ...it, x: (it.x + x0) / 2, y: (it.y + y0) / 2, w: it.w / 2, h: it.h / 2 };
|
|
3285
|
-
|
|
3285
|
+
_chunkDFFUNHVLcjs.copyOcrTextGaps.call(void 0, it, placed, 0.5, x0 / 2);
|
|
3286
3286
|
return placed;
|
|
3287
3287
|
}));
|
|
3288
3288
|
}
|
|
@@ -3374,7 +3374,7 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
|
|
|
3374
3374
|
isHidden: false,
|
|
3375
3375
|
...xs[i].space ? { hasSpaceBefore: true } : {}
|
|
3376
3376
|
};
|
|
3377
|
-
|
|
3377
|
+
_chunkDFFUNHVLcjs.copyOcrTextGaps.call(void 0, it, normalized, 1 / scale);
|
|
3378
3378
|
return normalized;
|
|
3379
3379
|
}).filter((it) => it.text);
|
|
3380
3380
|
if (_optionalChain([extraLines, 'optionalAccess', _96 => _96.verticals, 'access', _97 => _97.length]) && items.length) {
|
|
@@ -3390,7 +3390,7 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
|
|
|
3390
3390
|
})
|
|
3391
3391
|
};
|
|
3392
3392
|
}
|
|
3393
|
-
const laid = unframeOcrLayoutTables(splitOcrJoinedHeaders(splitOcrContactColumns(splitOcrNameValueColumns(splitStackedOcrRows(
|
|
3393
|
+
const laid = unframeOcrLayoutTables(splitOcrJoinedHeaders(splitOcrContactColumns(splitOcrNameValueColumns(splitStackedOcrRows(_chunkDFFUNHVLcjs.extractPageBlocksWithLines.call(void 0, norm, pageNumber, opList, pdfW, pdfH, extraLines, detectTables))))), pdfH);
|
|
3394
3394
|
const blocks = figureRegion ? laid : splitOcrProseRows(laid);
|
|
3395
3395
|
if (!figureRegion) markOcrHeadings(blocks);
|
|
3396
3396
|
return blocks;
|
|
@@ -3451,7 +3451,7 @@ async function tryImport2(name, loader) {
|
|
|
3451
3451
|
return await loader();
|
|
3452
3452
|
} catch (e) {
|
|
3453
3453
|
throw new Error(
|
|
3454
|
-
`OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${
|
|
3454
|
+
`OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkY7LMYK5Ccjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
|
|
3455
3455
|
);
|
|
3456
3456
|
}
|
|
3457
3457
|
}
|
|
@@ -3504,4 +3504,4 @@ function bgraToRgba(bgra) {
|
|
|
3504
3504
|
|
|
3505
3505
|
|
|
3506
3506
|
exports.rescueEmptyCells = rescueEmptyCells; exports.getOcrEngine = getOcrEngine; exports.detectRulingLines = detectRulingLines; exports.rulingToPdfLines = rulingToPdfLines; exports.deskewPage = deskewPage; exports.rotateQuarter = rotateQuarter; exports.MAX_OCR_PIXELS = MAX_OCR_PIXELS; exports.DEFAULT_BUILTIN_OCR = DEFAULT_BUILTIN_OCR; exports.builtinOcrConfig = builtinOcrConfig; exports.recognizeOcrPage = recognizeOcrPage; exports.reportModelDownload = reportModelDownload; exports.toOcrLine = toOcrLine; exports.pageLines = pageLines; exports.cellEdgeVerticals = cellEdgeVerticals; exports.cellEdgeHorizontals = cellEdgeHorizontals; exports.runPdfOcr = runPdfOcr; exports.ocrOnePage = ocrOnePage; exports.stretchFaintCrop = stretchFaintCrop; exports.groupOcrLines = groupOcrLines; exports.ocrItemsToBlocks = ocrItemsToBlocks; exports.markOcrHeadings = markOcrHeadings;
|
|
3507
|
-
//# sourceMappingURL=chunk-
|
|
3507
|
+
//# sourceMappingURL=chunk-7WYZNELF.cjs.map
|