@heripo/pdf-parser 0.1.38 → 0.1.39
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/index.cjs +10 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -60,6 +60,13 @@ interface PDFCorrectionOptions {
|
|
|
60
60
|
* text-correction stage runs. Defaults to true.
|
|
61
61
|
*/
|
|
62
62
|
reviewAssistanceEnabled?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When false, the table-correction work item is not generated during review
|
|
65
|
+
* assistance scheduling. The rest of the review-assistance pipeline (text
|
|
66
|
+
* OCR, text integrity, footnotes, pictures, layout) continues to run. Only
|
|
67
|
+
* relevant when `reviewAssistanceEnabled` is true. Defaults to true.
|
|
68
|
+
*/
|
|
69
|
+
tableCorrectionEnabled?: boolean;
|
|
63
70
|
temperature?: number;
|
|
64
71
|
}
|
|
65
72
|
interface NormalizedPDFCorrectionOptions {
|
|
@@ -74,6 +81,7 @@ interface NormalizedPDFCorrectionOptions {
|
|
|
74
81
|
proposalThreshold: number;
|
|
75
82
|
forceAutoApply: boolean;
|
|
76
83
|
reviewAssistanceEnabled: boolean;
|
|
84
|
+
tableCorrectionEnabled: boolean;
|
|
77
85
|
temperature: number;
|
|
78
86
|
}
|
|
79
87
|
declare const PDF_CORRECTION_DEFAULTS: Omit<NormalizedPDFCorrectionOptions, 'models'>;
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,13 @@ interface PDFCorrectionOptions {
|
|
|
60
60
|
* text-correction stage runs. Defaults to true.
|
|
61
61
|
*/
|
|
62
62
|
reviewAssistanceEnabled?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When false, the table-correction work item is not generated during review
|
|
65
|
+
* assistance scheduling. The rest of the review-assistance pipeline (text
|
|
66
|
+
* OCR, text integrity, footnotes, pictures, layout) continues to run. Only
|
|
67
|
+
* relevant when `reviewAssistanceEnabled` is true. Defaults to true.
|
|
68
|
+
*/
|
|
69
|
+
tableCorrectionEnabled?: boolean;
|
|
63
70
|
temperature?: number;
|
|
64
71
|
}
|
|
65
72
|
interface NormalizedPDFCorrectionOptions {
|
|
@@ -74,6 +81,7 @@ interface NormalizedPDFCorrectionOptions {
|
|
|
74
81
|
proposalThreshold: number;
|
|
75
82
|
forceAutoApply: boolean;
|
|
76
83
|
reviewAssistanceEnabled: boolean;
|
|
84
|
+
tableCorrectionEnabled: boolean;
|
|
77
85
|
temperature: number;
|
|
78
86
|
}
|
|
79
87
|
declare const PDF_CORRECTION_DEFAULTS: Omit<NormalizedPDFCorrectionOptions, 'models'>;
|
package/dist/index.js
CHANGED
|
@@ -7943,17 +7943,18 @@ var TEXT_ROLE_REASONS = /* @__PURE__ */ new Set([
|
|
|
7943
7943
|
]);
|
|
7944
7944
|
var SEVERE_TABLE_REASONS = /* @__PURE__ */ new Set(["multi_page_table_candidate"]);
|
|
7945
7945
|
var ReviewAssistanceWorkScheduler = class {
|
|
7946
|
-
build(context) {
|
|
7946
|
+
build(context, options) {
|
|
7947
7947
|
if (!context.reviewAssistanceEligibility.eligible) return [];
|
|
7948
|
-
|
|
7948
|
+
const items = [
|
|
7949
7949
|
...this.buildTextOcrItems(context),
|
|
7950
7950
|
...this.buildTextIntegrityItems(context),
|
|
7951
7951
|
...this.buildTextRoleItems(context),
|
|
7952
|
-
...this.buildTableItems(context),
|
|
7952
|
+
...options?.skipTableItems ? [] : this.buildTableItems(context),
|
|
7953
7953
|
...this.buildPictureCaptionItems(context),
|
|
7954
7954
|
...this.buildPictureSplitItems(context),
|
|
7955
7955
|
...this.buildLayoutItems(context)
|
|
7956
7956
|
];
|
|
7957
|
+
return items;
|
|
7957
7958
|
}
|
|
7958
7959
|
buildTextOcrItems(context) {
|
|
7959
7960
|
const targetRefs = context.textBlocks.filter(
|
|
@@ -9016,7 +9017,9 @@ var ReviewAssistanceRunner = class {
|
|
|
9016
9017
|
);
|
|
9017
9018
|
const image = new Uint8Array(await readFile(context.pageImagePath));
|
|
9018
9019
|
const scheduler = new ReviewAssistanceWorkScheduler();
|
|
9019
|
-
const workItems = scheduler.build(context
|
|
9020
|
+
const workItems = scheduler.build(context, {
|
|
9021
|
+
skipTableItems: !options.tableCorrectionEnabled
|
|
9022
|
+
});
|
|
9020
9023
|
if (workItems.length === 0) {
|
|
9021
9024
|
const result = {
|
|
9022
9025
|
pageNo: context.pageNo,
|
|
@@ -10469,6 +10472,7 @@ var PDF_CORRECTION_DEFAULTS = {
|
|
|
10469
10472
|
proposalThreshold: 0.5,
|
|
10470
10473
|
forceAutoApply: false,
|
|
10471
10474
|
reviewAssistanceEnabled: true,
|
|
10475
|
+
tableCorrectionEnabled: true,
|
|
10472
10476
|
temperature: 0
|
|
10473
10477
|
};
|
|
10474
10478
|
function normalizeNumber(value, fallback) {
|
|
@@ -10569,6 +10573,7 @@ function normalizePDFCorrectionOptions(value) {
|
|
|
10569
10573
|
proposalThreshold,
|
|
10570
10574
|
forceAutoApply: value.forceAutoApply ?? PDF_CORRECTION_DEFAULTS.forceAutoApply,
|
|
10571
10575
|
reviewAssistanceEnabled: value.reviewAssistanceEnabled ?? PDF_CORRECTION_DEFAULTS.reviewAssistanceEnabled,
|
|
10576
|
+
tableCorrectionEnabled: value.tableCorrectionEnabled ?? PDF_CORRECTION_DEFAULTS.tableCorrectionEnabled,
|
|
10572
10577
|
temperature: normalizeTemperature(
|
|
10573
10578
|
value.temperature,
|
|
10574
10579
|
PDF_CORRECTION_DEFAULTS.temperature
|
|
@@ -10637,6 +10642,7 @@ var PostDoclingCorrectionPipeline = class {
|
|
|
10637
10642
|
forceAutoApply: correction.forceAutoApply,
|
|
10638
10643
|
maxRetries: correction.maxRetries.reviewAssistance,
|
|
10639
10644
|
tableMaxRetries: correction.maxRetries.tableCorrection,
|
|
10645
|
+
tableCorrectionEnabled: correction.tableCorrectionEnabled,
|
|
10640
10646
|
temperature: correction.temperature,
|
|
10641
10647
|
outputLanguage: correction.outputLanguage,
|
|
10642
10648
|
aggregator: options.aggregator,
|