kordoc 4.18.4 → 4.18.5
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/dist/{-DDAVBMHD.js → -3HZVXMPX.js} +11 -11
- package/dist/{chunk-ELOPDQES.js → chunk-235UD74F.js} +2 -2
- package/dist/{chunk-KUUSP6OS.js → chunk-2CRD4Q76.js} +140 -10
- package/dist/{chunk-MXA6YW2W.js.map → chunk-2CRD4Q76.js.map} +1 -1
- package/dist/{chunk-OIUSF2VA.cjs → chunk-2UY3FG26.cjs} +12 -12
- package/dist/{chunk-OIUSF2VA.cjs.map → chunk-2UY3FG26.cjs.map} +1 -1
- package/dist/{chunk-LGF2IO66.js → chunk-33YID2RV.js} +2 -2
- package/dist/{chunk-RCI7LY4N.js → chunk-5SWBC7HH.js} +4 -4
- package/dist/{chunk-HRJJDNRD.js → chunk-BFFAHFG5.js} +2 -2
- package/dist/{chunk-QVCHFCT2.js → chunk-BXSMPCT5.js} +2 -2
- package/dist/{chunk-DUV7Y6IQ.js → chunk-DV7DQEYU.js} +3 -3
- package/dist/{chunk-3XSP7V5P.cjs → chunk-EFVBB45E.cjs} +2 -2
- package/dist/{chunk-3XSP7V5P.cjs.map → chunk-EFVBB45E.cjs.map} +1 -1
- package/dist/{chunk-SVNBZEL6.cjs → chunk-FBY574Q5.cjs} +3 -3
- package/dist/{chunk-SVNBZEL6.cjs.map → chunk-FBY574Q5.cjs.map} +1 -1
- package/dist/{chunk-IBQCK4F3.js → chunk-FYJDRO4B.js} +3 -3
- package/dist/{chunk-4IBY5LTJ.js → chunk-GYUV53LM.js} +2 -2
- package/dist/{chunk-AVIZ55NQ.cjs → chunk-H4NV5KRM.cjs} +3 -3
- package/dist/{chunk-AVIZ55NQ.cjs.map → chunk-H4NV5KRM.cjs.map} +1 -1
- package/dist/{chunk-V5X4LLVM.js → chunk-KDKPSX4V.js} +6 -6
- package/dist/{chunk-IAXGGQGD.js → chunk-L2K45SOK.js} +2 -2
- package/dist/{chunk-3WLZOJIE.cjs → chunk-MU7XW5KO.cjs} +6 -6
- package/dist/{chunk-3WLZOJIE.cjs.map → chunk-MU7XW5KO.cjs.map} +1 -1
- package/dist/{chunk-274ZPMHK.js → chunk-N7GNBY2F.js} +2 -2
- package/dist/{chunk-T2BJPT6D.js → chunk-OFSMOXS4.js} +2 -2
- package/dist/{chunk-TMJVD6FW.js → chunk-OLCBIT3I.js} +2 -2
- package/dist/{chunk-XG4SYOZL.js → chunk-PQ2ER3VQ.js} +2 -2
- package/dist/{chunk-F5YVCJVF.js → chunk-QAE2NVVO.js} +2 -2
- package/dist/{chunk-YCY2R4FM.js → chunk-U4SBX3B5.js} +2 -2
- package/dist/{chunk-E2644XCO.cjs → chunk-XGIUYCXI.cjs} +91 -41
- package/dist/chunk-XGIUYCXI.cjs.map +1 -0
- package/dist/{chunk-F2GDLA45.js → chunk-XNIVXYIZ.js} +10 -10
- package/dist/{chunk-VTVK2JMI.js → chunk-XSCQQ74A.js} +2 -2
- package/dist/{chunk-Z2PPDQK2.js → chunk-XTB2IERG.js} +2 -2
- package/dist/{chunk-MXA6YW2W.js → chunk-YON3IOC3.js} +60 -90
- package/dist/{chunk-KUUSP6OS.js.map → chunk-YON3IOC3.js.map} +1 -1
- package/dist/{chunk-7GR2GCJF.js → chunk-ZH5Y3JT6.js} +2 -2
- package/dist/chunks-ONP3Z3Z2.js +10 -0
- package/dist/cli.js +33 -27
- package/dist/cli.js.map +1 -1
- package/dist/{formula-YYJQBKEN.cjs → formula-DTPPV22Y.cjs} +9 -9
- package/dist/{formula-YYJQBKEN.cjs.map → formula-DTPPV22Y.cjs.map} +1 -1
- package/dist/{formula-HQFZEXFF.js → formula-EJQ6SI4B.js} +3 -3
- package/dist/{formula-7ZOZ5QJ6.js → formula-FFC3PUFZ.js} +4 -4
- package/dist/{image-ocr-CC26Q5KG.cjs → image-ocr-6JWCKPMH.cjs} +15 -15
- package/dist/{image-ocr-CC26Q5KG.cjs.map → image-ocr-6JWCKPMH.cjs.map} +1 -1
- package/dist/{image-ocr-RK3HJVCI.js → image-ocr-7KNVEPI5.js} +9 -9
- package/dist/{image-ocr-4BGX2EJJ.js → image-ocr-RCNFR4ET.js} +6 -6
- package/dist/index.cjs +277 -277
- package/dist/index.js +5 -5
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-VHRXG63R.js → model-bundle-NULKJLSH.js} +5 -5
- package/dist/{models-G3WA24SY.js → models-3TJW4OTW.js} +5 -5
- package/dist/{parser-GFDGAVLV.js → parser-2YBNBFSA.js} +8 -8
- package/dist/{parser-BGORCLIU.cjs → parser-NDX6SCHX.cjs} +126 -126
- package/dist/{parser-BGORCLIU.cjs.map → parser-NDX6SCHX.cjs.map} +1 -1
- package/dist/{parser-SOWTUOMK.js → parser-UL67LFWP.js} +11 -11
- package/dist/pdf-ocr-E5MEIMJO.cjs +17 -0
- package/dist/{pdf-ocr-EJ2HNZN6.cjs.map → pdf-ocr-E5MEIMJO.cjs.map} +1 -1
- package/dist/pdf-ocr-QPBJBELT.js +20 -0
- package/dist/pdf-ocr-RQ6FN3GA.js +16 -0
- package/dist/{profile-io-Q2T47RVH.js → profile-io-YVU5YX57.js} +3 -3
- package/dist/{rasterize-OAVMUTE6.js → rasterize-JLMPBFFB.js} +3 -3
- package/dist/{redact-doc-ECFOVR4X.js → redact-doc-PH37VIKN.js} +11 -11
- package/dist/{render-NSKWZVTD.js → render-E6K2EZZZ.js} +7 -7
- package/dist/seal-TJOKACHN.js +10 -0
- package/dist/{setup-REH2KZP2.js → setup-MRNDUCQQ.js} +3 -3
- package/dist/visual-T2YKRHW3.js +20 -0
- package/dist/{watch-JXDUZYBY.js → watch-ZGBBBTBH.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-E2644XCO.cjs.map +0 -1
- package/dist/chunks-5QTTAT5T.js +0 -10
- package/dist/pdf-ocr-7IOOVR2I.js +0 -20
- package/dist/pdf-ocr-EJ2HNZN6.cjs +0 -17
- package/dist/pdf-ocr-RACAZU3N.js +0 -16
- package/dist/seal-A4MG7MPQ.js +0 -10
- package/dist/visual-B56WQAGW.js +0 -20
- /package/dist/{-DDAVBMHD.js.map → -3HZVXMPX.js.map} +0 -0
- /package/dist/{chunk-ELOPDQES.js.map → chunk-235UD74F.js.map} +0 -0
- /package/dist/{chunk-LGF2IO66.js.map → chunk-33YID2RV.js.map} +0 -0
- /package/dist/{chunk-RCI7LY4N.js.map → chunk-5SWBC7HH.js.map} +0 -0
- /package/dist/{chunk-HRJJDNRD.js.map → chunk-BFFAHFG5.js.map} +0 -0
- /package/dist/{chunk-QVCHFCT2.js.map → chunk-BXSMPCT5.js.map} +0 -0
- /package/dist/{chunk-DUV7Y6IQ.js.map → chunk-DV7DQEYU.js.map} +0 -0
- /package/dist/{chunk-IBQCK4F3.js.map → chunk-FYJDRO4B.js.map} +0 -0
- /package/dist/{chunk-4IBY5LTJ.js.map → chunk-GYUV53LM.js.map} +0 -0
- /package/dist/{chunk-V5X4LLVM.js.map → chunk-KDKPSX4V.js.map} +0 -0
- /package/dist/{chunk-IAXGGQGD.js.map → chunk-L2K45SOK.js.map} +0 -0
- /package/dist/{chunk-274ZPMHK.js.map → chunk-N7GNBY2F.js.map} +0 -0
- /package/dist/{chunk-T2BJPT6D.js.map → chunk-OFSMOXS4.js.map} +0 -0
- /package/dist/{chunk-TMJVD6FW.js.map → chunk-OLCBIT3I.js.map} +0 -0
- /package/dist/{chunk-XG4SYOZL.js.map → chunk-PQ2ER3VQ.js.map} +0 -0
- /package/dist/{chunk-F5YVCJVF.js.map → chunk-QAE2NVVO.js.map} +0 -0
- /package/dist/{chunk-YCY2R4FM.js.map → chunk-U4SBX3B5.js.map} +0 -0
- /package/dist/{chunk-F2GDLA45.js.map → chunk-XNIVXYIZ.js.map} +0 -0
- /package/dist/{chunk-VTVK2JMI.js.map → chunk-XSCQQ74A.js.map} +0 -0
- /package/dist/{chunk-Z2PPDQK2.js.map → chunk-XTB2IERG.js.map} +0 -0
- /package/dist/{chunk-7GR2GCJF.js.map → chunk-ZH5Y3JT6.js.map} +0 -0
- /package/dist/{chunks-5QTTAT5T.js.map → chunks-ONP3Z3Z2.js.map} +0 -0
- /package/dist/{formula-HQFZEXFF.js.map → formula-EJQ6SI4B.js.map} +0 -0
- /package/dist/{formula-7ZOZ5QJ6.js.map → formula-FFC3PUFZ.js.map} +0 -0
- /package/dist/{image-ocr-RK3HJVCI.js.map → image-ocr-7KNVEPI5.js.map} +0 -0
- /package/dist/{image-ocr-4BGX2EJJ.js.map → image-ocr-RCNFR4ET.js.map} +0 -0
- /package/dist/{model-bundle-VHRXG63R.js.map → model-bundle-NULKJLSH.js.map} +0 -0
- /package/dist/{models-G3WA24SY.js.map → models-3TJW4OTW.js.map} +0 -0
- /package/dist/{parser-GFDGAVLV.js.map → parser-2YBNBFSA.js.map} +0 -0
- /package/dist/{parser-SOWTUOMK.js.map → parser-UL67LFWP.js.map} +0 -0
- /package/dist/{pdf-ocr-7IOOVR2I.js.map → pdf-ocr-QPBJBELT.js.map} +0 -0
- /package/dist/{pdf-ocr-RACAZU3N.js.map → pdf-ocr-RQ6FN3GA.js.map} +0 -0
- /package/dist/{profile-io-Q2T47RVH.js.map → profile-io-YVU5YX57.js.map} +0 -0
- /package/dist/{rasterize-OAVMUTE6.js.map → rasterize-JLMPBFFB.js.map} +0 -0
- /package/dist/{redact-doc-ECFOVR4X.js.map → redact-doc-PH37VIKN.js.map} +0 -0
- /package/dist/{render-NSKWZVTD.js.map → render-E6K2EZZZ.js.map} +0 -0
- /package/dist/{seal-A4MG7MPQ.js.map → seal-TJOKACHN.js.map} +0 -0
- /package/dist/{setup-REH2KZP2.js.map → setup-MRNDUCQQ.js.map} +0 -0
- /package/dist/{visual-B56WQAGW.js.map → visual-T2YKRHW3.js.map} +0 -0
- /package/dist/{watch-JXDUZYBY.js.map → watch-ZGBBBTBH.js.map} +0 -0
|
@@ -51,17 +51,17 @@ import {
|
|
|
51
51
|
unknownFontWarnings,
|
|
52
52
|
usesGaejosikMunche,
|
|
53
53
|
validateHwpx
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-XNIVXYIZ.js";
|
|
55
55
|
import {
|
|
56
56
|
blocksToPages
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-GYUV53LM.js";
|
|
58
58
|
import {
|
|
59
59
|
applySplices,
|
|
60
60
|
buildParagraphSplices,
|
|
61
61
|
buildRangeSplices,
|
|
62
62
|
placeSealHwpx,
|
|
63
63
|
scanSectionXml
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-DV7DQEYU.js";
|
|
65
65
|
import {
|
|
66
66
|
DEFAULT_REDACT_RULES,
|
|
67
67
|
redactMarkdown,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
} from "./chunk-3WSNLH4B.js";
|
|
70
70
|
import {
|
|
71
71
|
blocksToChunks
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-U4SBX3B5.js";
|
|
73
73
|
import {
|
|
74
74
|
SPACE_EM_FIXED,
|
|
75
75
|
SPACE_EM_FONT,
|
|
@@ -94,20 +94,20 @@ import {
|
|
|
94
94
|
renderSceneToHtml,
|
|
95
95
|
simulateWrap,
|
|
96
96
|
simulateWrapKeepWord
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-KDKPSX4V.js";
|
|
98
98
|
import "./chunk-7FCNOKOR.js";
|
|
99
|
-
import "./chunk-
|
|
99
|
+
import "./chunk-OLCBIT3I.js";
|
|
100
100
|
import "./chunk-VQFA55IC.js";
|
|
101
|
-
import "./chunk-
|
|
101
|
+
import "./chunk-33YID2RV.js";
|
|
102
102
|
import {
|
|
103
103
|
blocksToMarkdown,
|
|
104
104
|
flattenLayoutTables,
|
|
105
105
|
hasStructuredCellContent
|
|
106
|
-
} from "./chunk-
|
|
107
|
-
import "./chunk-
|
|
106
|
+
} from "./chunk-XSCQQ74A.js";
|
|
107
|
+
import "./chunk-L2K45SOK.js";
|
|
108
108
|
import {
|
|
109
109
|
VERSION
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-QAE2NVVO.js";
|
|
111
111
|
export {
|
|
112
112
|
BUILTIN_TEMPLATES,
|
|
113
113
|
DEFAULT_REDACT_RULES,
|
|
@@ -198,4 +198,4 @@ export {
|
|
|
198
198
|
usesGaejosikMunche,
|
|
199
199
|
validateHwpx
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=-
|
|
201
|
+
//# sourceMappingURL=-3HZVXMPX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KordocError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZH5Y3JT6.js";
|
|
4
4
|
|
|
5
5
|
// src/pdf/formula/models.ts
|
|
6
6
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -308,4 +308,4 @@ export {
|
|
|
308
308
|
ensureFormulaModels,
|
|
309
309
|
ensureSingleModel
|
|
310
310
|
};
|
|
311
|
-
//# sourceMappingURL=chunk-
|
|
311
|
+
//# sourceMappingURL=chunk-235UD74F.js.map
|
|
@@ -1,15 +1,88 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
import {
|
|
3
2
|
CELL_EDGES,
|
|
4
3
|
HEADING_RATIO_H1,
|
|
5
4
|
HEADING_RATIO_H2,
|
|
6
5
|
HEADING_RATIO_H3,
|
|
7
6
|
tidyScriptTags
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PQ2ER3VQ.js";
|
|
8
|
+
import {
|
|
9
|
+
ensureModelsIn,
|
|
10
|
+
getModelsDir
|
|
11
|
+
} from "./chunk-235UD74F.js";
|
|
9
12
|
import {
|
|
10
13
|
safeMax,
|
|
11
14
|
safeMin
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZH5Y3JT6.js";
|
|
16
|
+
|
|
17
|
+
// src/ocr/models.ts
|
|
18
|
+
import { join } from "path";
|
|
19
|
+
import { stat } from "fs/promises";
|
|
20
|
+
var OCR_DET_MODEL = {
|
|
21
|
+
name: "PP-OCRv5 mobile det",
|
|
22
|
+
filename: "det.onnx",
|
|
23
|
+
url: "https://huggingface.co/PaddlePaddle/PP-OCRv5_mobile_det_onnx/resolve/main/inference.onnx",
|
|
24
|
+
sha256: "a431985659dc921974177a95adcfbb90fd9e51989a5e04d70d0b75f597b6e61d",
|
|
25
|
+
sizeMb: 5
|
|
26
|
+
};
|
|
27
|
+
var OCR_REC_MODEL = {
|
|
28
|
+
name: "PP-OCRv5 korean rec",
|
|
29
|
+
filename: "rec_korean.onnx",
|
|
30
|
+
url: "https://huggingface.co/PaddlePaddle/korean_PP-OCRv5_mobile_rec_onnx/resolve/main/inference.onnx",
|
|
31
|
+
sha256: "92f0b7785e64fc9090106a241cf4c1eb97472824558272751b88a2a4476d3a08",
|
|
32
|
+
sizeMb: 13
|
|
33
|
+
};
|
|
34
|
+
var OCR_REC_DICT = {
|
|
35
|
+
name: "PP-OCRv5 korean dict",
|
|
36
|
+
filename: "rec_korean.yml",
|
|
37
|
+
url: "https://huggingface.co/PaddlePaddle/korean_PP-OCRv5_mobile_rec_onnx/resolve/main/inference.yml",
|
|
38
|
+
sha256: "f757fa1c40e99edcf27e9cce879b93eb2a51fa46f5ef39095689b8c37dd75998",
|
|
39
|
+
sizeMb: 1
|
|
40
|
+
};
|
|
41
|
+
var ALL_OCR_MODELS = [OCR_DET_MODEL, OCR_REC_MODEL, OCR_REC_DICT];
|
|
42
|
+
function getOcrModelsDir() {
|
|
43
|
+
return getModelsDir("ppocr");
|
|
44
|
+
}
|
|
45
|
+
async function ensureOcrModels(onProgress) {
|
|
46
|
+
return ensureModelsIn(getOcrModelsDir(), ALL_OCR_MODELS, onProgress);
|
|
47
|
+
}
|
|
48
|
+
async function ocrModelsCached() {
|
|
49
|
+
const dir = getOcrModelsDir();
|
|
50
|
+
for (const spec of ALL_OCR_MODELS) {
|
|
51
|
+
try {
|
|
52
|
+
if (!(await stat(join(dir, spec.filename))).size) return false;
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
function parseCharacterDict(yml) {
|
|
60
|
+
const lines = yml.split("\n");
|
|
61
|
+
const chars = [];
|
|
62
|
+
let inDict = false;
|
|
63
|
+
let dictIndent = -1;
|
|
64
|
+
for (const line of lines) {
|
|
65
|
+
if (!inDict) {
|
|
66
|
+
const m2 = /^(\s*)character_dict:\s*$/.exec(line);
|
|
67
|
+
if (m2) {
|
|
68
|
+
inDict = true;
|
|
69
|
+
dictIndent = m2[1].length;
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const m = /^(\s*)- (.*)$/.exec(line);
|
|
74
|
+
if (m && m[1].length >= dictIndent) {
|
|
75
|
+
let v = m[2];
|
|
76
|
+
if (v.length >= 2 && (v.startsWith("'") && v.endsWith("'") || v.startsWith('"') && v.endsWith('"'))) {
|
|
77
|
+
v = v.slice(1, -1).replace(/''/g, "'");
|
|
78
|
+
}
|
|
79
|
+
chars.push(v);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (line.trim() !== "") break;
|
|
83
|
+
}
|
|
84
|
+
return chars;
|
|
85
|
+
}
|
|
13
86
|
|
|
14
87
|
// src/pdf/line-extract.ts
|
|
15
88
|
import { OPS } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
@@ -6828,6 +6901,55 @@ function frameLayoutBoxes(blocks) {
|
|
|
6828
6901
|
}
|
|
6829
6902
|
return boxes;
|
|
6830
6903
|
}
|
|
6904
|
+
function takeFrameSpanningText(items, cutX, pageNum, lex) {
|
|
6905
|
+
let minX = Infinity, maxR = -Infinity;
|
|
6906
|
+
for (const item of items) {
|
|
6907
|
+
minX = Math.min(minX, item.x);
|
|
6908
|
+
maxR = Math.max(maxR, item.x + item.w);
|
|
6909
|
+
}
|
|
6910
|
+
const span = maxR - minX;
|
|
6911
|
+
const rows = groupByY([...items].sort((a, b) => b.y - a.y || a.x - b.x)).map((line) => {
|
|
6912
|
+
const runs = [];
|
|
6913
|
+
for (const item of [...line].sort((a, b) => a.x - b.x)) {
|
|
6914
|
+
const run = runs[runs.length - 1], prev = run?.[run.length - 1];
|
|
6915
|
+
if (prev && item.x - (prev.x + prev.w) <= Math.max(prev.fontSize, item.fontSize) * 0.6) run.push(item);
|
|
6916
|
+
else runs.push([item]);
|
|
6917
|
+
}
|
|
6918
|
+
return runs;
|
|
6919
|
+
});
|
|
6920
|
+
const taken = /* @__PURE__ */ new Set(), blocks = [];
|
|
6921
|
+
for (let r = 0; r < rows.length; r++) for (const run of rows[r]) {
|
|
6922
|
+
if (taken.has(run[0]) || run[0].x >= cutX || Math.max(...run.map((i) => i.x + i.w)) <= cutX) continue;
|
|
6923
|
+
const lines = [run], fs = Math.max(...run.map((i) => i.fontSize));
|
|
6924
|
+
const left = run[0].x, right = Math.max(...run.map((i) => i.x + i.w));
|
|
6925
|
+
if (right - left < span * 0.75) continue;
|
|
6926
|
+
let prevY = run[0].y;
|
|
6927
|
+
for (let next = r + 1; next < rows.length && rows[next].length === 1; next++) {
|
|
6928
|
+
const tail = rows[next][0], y = tail[0].y;
|
|
6929
|
+
if (taken.has(tail[0]) || prevY - y > fs * 1.8 || tail[0].x < left - 1 || tail[0].x > left + fs * 2 || tail.some((i) => Math.abs(i.fontSize - fs) > fs * 0.15) || Math.max(...tail.map((i) => i.x + i.w)) > right + 1) break;
|
|
6930
|
+
lines.push(tail);
|
|
6931
|
+
prevY = y;
|
|
6932
|
+
}
|
|
6933
|
+
for (const line of lines) for (const item of line) taken.add(item);
|
|
6934
|
+
pushLineParagraphs(blocks, mergeSuperscriptLines(lines), pageNum, lex);
|
|
6935
|
+
}
|
|
6936
|
+
let keep = 0;
|
|
6937
|
+
for (const item of items) if (!taken.has(item)) items[keep++] = item;
|
|
6938
|
+
items.length = keep;
|
|
6939
|
+
return blocks;
|
|
6940
|
+
}
|
|
6941
|
+
function frameColumnTextBands(items, spanning, cutX) {
|
|
6942
|
+
const tops = spanning.filter((b) => b.bbox).map((b) => b.bbox.y + b.bbox.height).sort((a, b) => b - a);
|
|
6943
|
+
const bands = /* @__PURE__ */ new Map();
|
|
6944
|
+
for (const item of items) {
|
|
6945
|
+
let band = 0;
|
|
6946
|
+
while (band < tops.length && tops[band] > item.y + item.h) band++;
|
|
6947
|
+
const sides = bands.get(band) ?? [[], [], []];
|
|
6948
|
+
sides[item.x + item.w <= cutX ? 0 : item.x >= cutX ? 2 : 1].push(item);
|
|
6949
|
+
bands.set(band, sides);
|
|
6950
|
+
}
|
|
6951
|
+
return [...bands].sort((a, b) => a[0] - b[0]).flatMap(([, sides]) => sides.filter((side) => side.length));
|
|
6952
|
+
}
|
|
6831
6953
|
function groupFrameParagraphUnits(units, frames) {
|
|
6832
6954
|
const source = /* @__PURE__ */ new Map();
|
|
6833
6955
|
for (const unit of units) for (const block of unit) source.set(block, unit);
|
|
@@ -7738,14 +7860,15 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
7738
7860
|
if (remaining.length > 0) {
|
|
7739
7861
|
if (gutterX !== null) {
|
|
7740
7862
|
const gx = gutterX;
|
|
7863
|
+
const spanning = detectListBlocks(takeFrameSpanningText(remaining, gx, pageNum, lex));
|
|
7864
|
+
for (const block of spanning) {
|
|
7865
|
+
finalTextBlocks.push(block);
|
|
7866
|
+
groupSizes.push(1);
|
|
7867
|
+
}
|
|
7741
7868
|
const allY = remaining.map((i) => i.y);
|
|
7742
7869
|
const pageH = safeMax(allY) - safeMin(allY);
|
|
7743
7870
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
7744
|
-
const sides =
|
|
7745
|
-
remaining.filter((i) => i.x + i.w <= gx),
|
|
7746
|
-
remaining.filter((i) => i.x < gx && i.x + i.w > gx),
|
|
7747
|
-
remaining.filter((i) => i.x >= gx)
|
|
7748
|
-
];
|
|
7871
|
+
const sides = frameColumnTextBands(remaining, spanning, gx);
|
|
7749
7872
|
const textBlocks = [];
|
|
7750
7873
|
for (const side of sides) {
|
|
7751
7874
|
if (side.length === 0) continue;
|
|
@@ -7756,7 +7879,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
7756
7879
|
groupSizes.push(groupBlocks.length);
|
|
7757
7880
|
}
|
|
7758
7881
|
}
|
|
7759
|
-
finalTextBlocks
|
|
7882
|
+
finalTextBlocks.push(...detectListBlocks(textBlocks));
|
|
7760
7883
|
} else {
|
|
7761
7884
|
const allY = remaining.map((i) => i.y);
|
|
7762
7885
|
const pageH = safeMax(allY) - safeMin(allY);
|
|
@@ -8105,6 +8228,13 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
|
|
|
8105
8228
|
}
|
|
8106
8229
|
|
|
8107
8230
|
export {
|
|
8231
|
+
OCR_DET_MODEL,
|
|
8232
|
+
OCR_REC_MODEL,
|
|
8233
|
+
OCR_REC_DICT,
|
|
8234
|
+
getOcrModelsDir,
|
|
8235
|
+
ensureOcrModels,
|
|
8236
|
+
ocrModelsCached,
|
|
8237
|
+
parseCharacterDict,
|
|
8108
8238
|
extractLines,
|
|
8109
8239
|
extractImageRegions,
|
|
8110
8240
|
filterHiddenText,
|
|
@@ -8155,4 +8285,4 @@ export {
|
|
|
8155
8285
|
removeSideTabs,
|
|
8156
8286
|
extractPageBlocksWithLines
|
|
8157
8287
|
};
|
|
8158
|
-
//# sourceMappingURL=chunk-
|
|
8288
|
+
//# sourceMappingURL=chunk-2CRD4Q76.js.map
|