mindee 5.4.0 → 5.6.0
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/CHANGELOG.md +24 -2
- package/package.json +26 -14
- package/src/geometry/bbox.d.ts +5 -0
- package/src/geometry/bbox.js +1 -0
- package/src/geometry/minMax.d.ts +3 -0
- package/src/geometry/polygonUtils.d.ts +23 -0
- package/src/geometry/polygonUtils.js +23 -0
- package/src/http/apiCore.d.ts +1 -0
- package/src/http/apiCore.js +21 -3
- package/src/http/baseSettings.d.ts +5 -0
- package/src/http/baseSettings.js +2 -0
- package/src/image/extractedImage.d.ts +9 -5
- package/src/image/extractedImage.js +2 -2
- package/src/image/extractedImages.d.ts +1 -0
- package/src/image/extractedImages.js +1 -0
- package/src/image/imageCompressor.d.ts +1 -1
- package/src/image/imageExtractor.d.ts +7 -8
- package/src/image/imageExtractor.js +74 -75
- package/src/input/base64Input.d.ts +3 -0
- package/src/input/base64Input.js +3 -0
- package/src/input/bufferInput.d.ts +2 -0
- package/src/input/bufferInput.js +2 -0
- package/src/input/bytesInput.d.ts +3 -0
- package/src/input/bytesInput.js +3 -0
- package/src/input/inputSource.d.ts +15 -0
- package/src/input/inputSource.js +15 -0
- package/src/input/localInputSource.d.ts +6 -0
- package/src/input/localInputSource.js +3 -0
- package/src/input/pathInput.d.ts +4 -0
- package/src/input/pathInput.js +3 -0
- package/src/input/streamInput.d.ts +4 -0
- package/src/input/streamInput.js +4 -0
- package/src/input/urlInput.d.ts +12 -0
- package/src/input/urlInput.js +52 -10
- package/src/logger.js +1 -1
- package/src/parsing/dateParser.d.ts +4 -0
- package/src/parsing/dateParser.js +5 -1
- package/src/parsing/localResponseBase.d.ts +2 -0
- package/src/parsing/localResponseBase.js +2 -0
- package/src/parsing/stringDict.d.ts +1 -0
- package/src/pdf/extractedPdf.d.ts +8 -2
- package/src/pdf/extractedPdf.js +5 -3
- package/src/pdf/extractedPdfs.d.ts +1 -0
- package/src/pdf/extractedPdfs.js +1 -0
- package/src/pdf/pdfCompressor.js +12 -0
- package/src/pdf/pdfExtractor.d.ts +2 -2
- package/src/pdf/pdfExtractor.js +4 -1
- package/src/pdf/pdfOperation.d.ts +3 -0
- package/src/pdf/pdfOperation.js +3 -0
- package/src/pdf/pdfUtils.js +5 -0
- package/src/v1/cli.d.ts +3 -0
- package/src/v1/cli.js +84 -26
- package/src/v1/client.d.ts +16 -16
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts +5 -3
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.js +4 -4
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +14 -0
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.d.ts +2 -0
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.js +1 -1
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -0
- package/src/v1/http/apiSettingsV1.d.ts +5 -0
- package/src/v1/http/apiSettingsV1.js +4 -0
- package/src/v1/http/errors.d.ts +7 -1
- package/src/v1/http/errors.js +65 -86
- package/src/v1/http/httpParams.d.ts +12 -0
- package/src/v1/parsing/common/asyncPredictResponse.d.ts +4 -0
- package/src/v1/parsing/common/asyncPredictResponse.js +5 -2
- package/src/v1/parsing/common/executionPriority.d.ts +4 -0
- package/src/v1/parsing/common/executionPriority.js +4 -0
- package/src/v1/parsing/common/extras/cropperExtra.d.ts +2 -0
- package/src/v1/parsing/common/extras/cropperExtra.js +3 -0
- package/src/v1/parsing/common/extras/extras.d.ts +3 -0
- package/src/v1/parsing/common/extras/extras.js +2 -0
- package/src/v1/parsing/common/extras/fullTextOcrExtra.d.ts +3 -0
- package/src/v1/parsing/common/extras/fullTextOcrExtra.js +1 -0
- package/src/v1/parsing/common/extras/ragExtra.d.ts +1 -0
- package/src/v1/parsing/common/extras/ragExtra.js +1 -0
- package/src/v1/parsing/common/feedback/feedbackResponse.js +1 -0
- package/src/v1/parsing/common/index.d.ts +1 -1
- package/src/v1/parsing/common/index.js +1 -1
- package/src/v1/parsing/common/inference.d.ts +2 -0
- package/src/v1/parsing/common/inference.js +2 -0
- package/src/v1/parsing/common/prediction.d.ts +1 -0
- package/src/v1/parsing/common/prediction.js +1 -0
- package/src/v1/parsing/common/summaryHelper.d.ts +12 -1
- package/src/v1/parsing/common/summaryHelper.js +18 -1
- package/src/v1/parsing/generated/generatedObject.d.ts +6 -0
- package/src/v1/parsing/generated/generatedObject.js +38 -27
- package/src/v1/parsing/localResponse.d.ts +1 -0
- package/src/v1/parsing/localResponse.js +1 -0
- package/src/v1/parsing/standard/base.d.ts +6 -0
- package/src/v1/parsing/standard/base.js +1 -0
- package/src/v1/parsing/standard/boolean.d.ts +1 -1
- package/src/v1/parsing/standard/companyRegistration.d.ts +1 -0
- package/src/v1/parsing/standard/companyRegistration.js +1 -0
- package/src/v1/parsing/standard/date.d.ts +1 -0
- package/src/v1/parsing/standard/date.js +1 -0
- package/src/v1/parsing/standard/paymentDetails.d.ts +5 -5
- package/src/v1/parsing/standard/position.d.ts +2 -2
- package/src/v1/parsing/standard/tax.d.ts +1 -0
- package/src/v1/parsing/standard/tax.js +1 -0
- package/src/v1/parsing/standard/text.d.ts +1 -1
- package/src/v1/parsing/standard/word.d.ts +3 -0
- package/src/v1/parsing/standard/word.js +1 -0
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +16 -58
- package/src/v1/product/generated/generatedV1Prediction.d.ts +1 -0
- package/src/v1/product/generated/generatedV1Prediction.js +2 -1
- package/src/v1/product/invoice/invoiceV4LineItem.js +5 -16
- package/src/v1/product/receipt/receiptV5LineItem.js +2 -6
- package/src/v1/product/resume/resumeV1Certificate.js +5 -21
- package/src/v1/product/resume/resumeV1Education.js +8 -36
- package/src/v1/product/resume/resumeV1Language.js +3 -11
- package/src/v1/product/resume/resumeV1ProfessionalExperience.js +10 -46
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +3 -11
- package/src/v2/cli.d.ts +3 -0
- package/src/v2/cli.js +21 -0
- package/src/v2/client.d.ts +10 -1
- package/src/v2/client.js +18 -8
- package/src/v2/clientOptions/baseParameters.d.ts +3 -2
- package/src/v2/clientOptions/pollingOptions.d.ts +6 -1
- package/src/v2/clientOptions/pollingOptions.js +4 -2
- package/src/v2/fileOperations/crop.js +1 -3
- package/src/v2/fileOperations/split.js +1 -1
- package/src/v2/http/mindeeApiV2.d.ts +23 -10
- package/src/v2/http/mindeeApiV2.js +79 -68
- package/src/v2/parsing/baseResponse.d.ts +2 -0
- package/src/v2/parsing/baseResponse.js +1 -0
- package/src/v2/parsing/error/errorDetails.d.ts +1 -0
- package/src/v2/parsing/index.d.ts +1 -1
- package/src/v2/parsing/index.js +1 -1
- package/src/v2/parsing/inference/baseInference.d.ts +2 -0
- package/src/v2/parsing/inference/baseInference.js +2 -0
- package/src/v2/parsing/inference/failedInferenceResponse.d.ts +33 -0
- package/src/v2/parsing/inference/failedInferenceResponse.js +17 -0
- package/src/v2/parsing/inference/field/baseField.d.ts +3 -0
- package/src/v2/parsing/inference/field/fieldConfidence.d.ts +4 -0
- package/src/v2/parsing/inference/field/fieldConfidence.js +4 -0
- package/src/v2/parsing/inference/field/fieldFactory.d.ts +5 -0
- package/src/v2/parsing/inference/field/fieldFactory.js +5 -0
- package/src/v2/parsing/inference/field/fieldLocation.d.ts +1 -0
- package/src/v2/parsing/inference/field/fieldLocation.js +1 -0
- package/src/v2/parsing/inference/field/inferenceFields.d.ts +5 -0
- package/src/v2/parsing/inference/field/inferenceFields.js +4 -0
- package/src/v2/parsing/inference/field/listField.d.ts +2 -0
- package/src/v2/parsing/inference/field/listField.js +2 -0
- package/src/v2/parsing/inference/field/objectField.d.ts +4 -0
- package/src/v2/parsing/inference/field/objectField.js +3 -0
- package/src/v2/parsing/inference/field/ragMetadata.d.ts +1 -0
- package/src/v2/parsing/inference/field/ragMetadata.js +1 -0
- package/src/v2/parsing/inference/field/rawText.d.ts +2 -0
- package/src/v2/parsing/inference/field/rawText.js +2 -0
- package/src/v2/parsing/inference/field/simpleField.d.ts +2 -0
- package/src/v2/parsing/inference/field/simpleField.js +2 -0
- package/src/v2/parsing/inference/inferenceFile.d.ts +2 -0
- package/src/v2/parsing/inference/inferenceFile.js +2 -0
- package/src/v2/parsing/inference/inferenceModel.d.ts +2 -0
- package/src/v2/parsing/inference/inferenceModel.js +2 -0
- package/src/v2/parsing/job/job.d.ts +1 -1
- package/src/v2/parsing/job/job.js +1 -3
- package/src/v2/parsing/job/jobResponse.d.ts +3 -0
- package/src/v2/parsing/job/jobResponse.js +3 -0
- package/src/v2/parsing/search/index.d.ts +4 -0
- package/src/v2/parsing/search/index.js +4 -0
- package/src/v2/parsing/search/modelWebhook.d.ts +19 -0
- package/src/v2/parsing/search/modelWebhook.js +10 -0
- package/src/v2/parsing/search/paginationMetadata.d.ts +24 -0
- package/src/v2/parsing/search/paginationMetadata.js +19 -0
- package/src/v2/parsing/search/searchModel.d.ts +25 -0
- package/src/v2/parsing/search/searchModel.js +19 -0
- package/src/v2/parsing/search/searchResponse.d.ts +19 -0
- package/src/v2/parsing/search/searchResponse.js +24 -0
- package/src/v2/product/classification/classification.d.ts +3 -0
- package/src/v2/product/classification/classification.js +3 -0
- package/src/v2/product/classification/classificationClassifier.d.ts +2 -0
- package/src/v2/product/classification/classificationClassifier.js +2 -0
- package/src/v2/product/classification/classificationInference.d.ts +2 -0
- package/src/v2/product/classification/classificationInference.js +2 -0
- package/src/v2/product/classification/classificationResponse.d.ts +1 -0
- package/src/v2/product/classification/classificationResponse.js +1 -0
- package/src/v2/product/classification/classificationResult.d.ts +2 -0
- package/src/v2/product/classification/classificationResult.js +2 -0
- package/src/v2/product/crop/crop.d.ts +3 -0
- package/src/v2/product/crop/crop.js +3 -0
- package/src/v2/product/crop/cropInference.d.ts +2 -0
- package/src/v2/product/crop/cropInference.js +2 -0
- package/src/v2/product/crop/cropItem.d.ts +2 -0
- package/src/v2/product/crop/cropItem.js +2 -0
- package/src/v2/product/crop/cropResponse.d.ts +1 -0
- package/src/v2/product/crop/cropResponse.js +1 -0
- package/src/v2/product/crop/cropResult.d.ts +2 -0
- package/src/v2/product/crop/cropResult.js +2 -0
- package/src/v2/product/extraction/dataSchemaActiveOption.d.ts +1 -0
- package/src/v2/product/extraction/dataSchemaActiveOption.js +1 -0
- package/src/v2/product/extraction/extraction.d.ts +3 -0
- package/src/v2/product/extraction/extraction.js +3 -0
- package/src/v2/product/extraction/extractionActiveOptions.d.ts +2 -0
- package/src/v2/product/extraction/extractionActiveOptions.js +2 -0
- package/src/v2/product/extraction/extractionInference.d.ts +2 -0
- package/src/v2/product/extraction/extractionInference.js +2 -0
- package/src/v2/product/extraction/extractionResponse.d.ts +1 -0
- package/src/v2/product/extraction/extractionResponse.js +1 -0
- package/src/v2/product/extraction/extractionResult.d.ts +2 -0
- package/src/v2/product/extraction/extractionResult.js +2 -0
- package/src/v2/product/extraction/params/dataSchema.d.ts +9 -6
- package/src/v2/product/extraction/params/dataSchema.js +2 -0
- package/src/v2/product/extraction/params/dataSchemaField.d.ts +25 -1
- package/src/v2/product/extraction/params/dataSchemaField.js +3 -0
- package/src/v2/product/extraction/params/dataSchemaReplace.d.ts +9 -4
- package/src/v2/product/extraction/params/dataSchemaReplace.js +2 -0
- package/src/v2/product/ocr/ocr.d.ts +3 -0
- package/src/v2/product/ocr/ocr.js +3 -0
- package/src/v2/product/ocr/ocrInference.d.ts +2 -0
- package/src/v2/product/ocr/ocrInference.js +2 -0
- package/src/v2/product/ocr/ocrPage.d.ts +2 -0
- package/src/v2/product/ocr/ocrPage.js +2 -0
- package/src/v2/product/ocr/ocrResponse.d.ts +1 -0
- package/src/v2/product/ocr/ocrResponse.js +1 -0
- package/src/v2/product/ocr/ocrResult.d.ts +1 -0
- package/src/v2/product/ocr/ocrResult.js +1 -0
- package/src/v2/product/ocr/ocrWord.d.ts +2 -0
- package/src/v2/product/ocr/ocrWord.js +2 -0
- package/src/v2/product/split/split.d.ts +3 -0
- package/src/v2/product/split/split.js +3 -0
- package/src/v2/product/split/splitInference.d.ts +2 -0
- package/src/v2/product/split/splitInference.js +2 -0
- package/src/v2/product/split/splitRange.d.ts +1 -0
- package/src/v2/product/split/splitRange.js +1 -0
- package/src/v2/product/split/splitResponse.d.ts +1 -0
- package/src/v2/product/split/splitResponse.js +1 -0
- package/src/v2/product/split/splitResult.d.ts +1 -0
- package/src/v2/product/split/splitResult.js +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InferenceFields } from "../../../v2/parsing/inference/field/index.js";
|
|
2
2
|
import { RawText } from "../../../v2/parsing/inference/field/rawText.js";
|
|
3
3
|
import { RagMetadata } from "../../../v2/parsing/inference/field/ragMetadata.js";
|
|
4
|
+
/** Extraction result payload containing fields and optional extras. */
|
|
4
5
|
export class ExtractionResult {
|
|
5
6
|
constructor(serverResponse) {
|
|
6
7
|
this.fields = new InferenceFields(serverResponse["fields"]);
|
|
@@ -11,6 +12,7 @@ export class ExtractionResult {
|
|
|
11
12
|
this.rag = new RagMetadata(serverResponse["rag"]);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
/** Returns a readable representation of extracted fields. */
|
|
14
16
|
toString() {
|
|
15
17
|
return `Fields\n======\n${this.fields}`;
|
|
16
18
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
2
|
-
import { DataSchemaReplace } from "./dataSchemaReplace.js";
|
|
2
|
+
import { DataSchemaReplace, DataSchemaReplaceJson } from "./dataSchemaReplace.js";
|
|
3
|
+
/** JSON payload for top-level data schema options. */
|
|
4
|
+
export interface DataSchemaJson {
|
|
5
|
+
/** Optional full replacement schema. */
|
|
6
|
+
replace?: DataSchemaReplaceJson;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Modify the Data Schema.
|
|
5
10
|
*/
|
|
@@ -9,10 +14,8 @@ export declare class DataSchema {
|
|
|
9
14
|
*/
|
|
10
15
|
replace?: DataSchemaReplace;
|
|
11
16
|
constructor(dataSchema: StringDict | string);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} | undefined;
|
|
16
|
-
};
|
|
17
|
+
/** Serializes the data schema parameters to API format. */
|
|
18
|
+
toJSON(): DataSchemaJson;
|
|
19
|
+
/** Returns a JSON string representation of the data schema parameters. */
|
|
17
20
|
toString(): string;
|
|
18
21
|
}
|
|
@@ -14,9 +14,11 @@ export class DataSchema {
|
|
|
14
14
|
this.replace = new DataSchemaReplace(dataSchema["replace"]);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
/** Serializes the data schema parameters to API format. */
|
|
17
18
|
toJSON() {
|
|
18
19
|
return { replace: this.replace?.toJSON() };
|
|
19
20
|
}
|
|
21
|
+
/** Returns a JSON string representation of the data schema parameters. */
|
|
20
22
|
toString() {
|
|
21
23
|
return JSON.stringify(this.toJSON());
|
|
22
24
|
}
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import { StringDict } from "../../../../parsing/index.js";
|
|
2
|
+
/** JSON payload for a single data schema field definition. */
|
|
3
|
+
export interface DataSchemaFieldJson {
|
|
4
|
+
/** Field key used in results. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Human-readable field title. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Whether the field accepts multiple values. */
|
|
9
|
+
is_array: boolean;
|
|
10
|
+
/** Field type name. */
|
|
11
|
+
type: string;
|
|
12
|
+
/** Optional allowed classes for classification fields. */
|
|
13
|
+
classification_values?: Array<string>;
|
|
14
|
+
/** Optional deduplication behavior for array fields. */
|
|
15
|
+
unique_values?: boolean;
|
|
16
|
+
/** Optional field description. */
|
|
17
|
+
description?: string;
|
|
18
|
+
/** Optional extraction guidelines. */
|
|
19
|
+
guidelines?: string;
|
|
20
|
+
/** Optional nested schema for object fields. */
|
|
21
|
+
nested_fields?: StringDict;
|
|
22
|
+
}
|
|
23
|
+
/** Data schema field definition used by extraction parameters. */
|
|
2
24
|
export declare class DataSchemaField {
|
|
3
25
|
/**
|
|
4
26
|
* Display name for the field, also impacts inference results.
|
|
@@ -38,6 +60,8 @@ export declare class DataSchemaField {
|
|
|
38
60
|
*/
|
|
39
61
|
nestedFields?: StringDict;
|
|
40
62
|
constructor(fields: StringDict);
|
|
41
|
-
|
|
63
|
+
/** Serializes the field definition to API format. */
|
|
64
|
+
toJSON(): DataSchemaFieldJson;
|
|
65
|
+
/** Returns a JSON string representation of the field definition. */
|
|
42
66
|
toString(): string;
|
|
43
67
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Data schema field definition used by extraction parameters. */
|
|
1
2
|
export class DataSchemaField {
|
|
2
3
|
constructor(fields) {
|
|
3
4
|
this.name = fields["name"];
|
|
@@ -10,6 +11,7 @@ export class DataSchemaField {
|
|
|
10
11
|
this.guidelines = fields["guidelines"];
|
|
11
12
|
this.nestedFields = fields["nested_fields"];
|
|
12
13
|
}
|
|
14
|
+
/** Serializes the field definition to API format. */
|
|
13
15
|
toJSON() {
|
|
14
16
|
const out = {
|
|
15
17
|
name: this.name,
|
|
@@ -33,6 +35,7 @@ export class DataSchemaField {
|
|
|
33
35
|
out.nested_fields = this.nestedFields;
|
|
34
36
|
return out;
|
|
35
37
|
}
|
|
38
|
+
/** Returns a JSON string representation of the field definition. */
|
|
36
39
|
toString() {
|
|
37
40
|
return JSON.stringify(this.toJSON());
|
|
38
41
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { StringDict } from "../../../../parsing/index.js";
|
|
2
|
-
import { DataSchemaField } from "./dataSchemaField.js";
|
|
2
|
+
import { DataSchemaField, DataSchemaFieldJson } from "./dataSchemaField.js";
|
|
3
|
+
/** JSON payload for replacement data schema options. */
|
|
4
|
+
export interface DataSchemaReplaceJson {
|
|
5
|
+
/** Field definitions replacing the current schema. */
|
|
6
|
+
fields: Array<DataSchemaFieldJson>;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* The structure to completely replace the data schema of the model.
|
|
5
10
|
*/
|
|
@@ -9,8 +14,8 @@ export declare class DataSchemaReplace {
|
|
|
9
14
|
*/
|
|
10
15
|
fields: Array<DataSchemaField>;
|
|
11
16
|
constructor(dataSchemaReplace: StringDict);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
/** Serializes the replacement schema to API format. */
|
|
18
|
+
toJSON(): DataSchemaReplaceJson;
|
|
19
|
+
/** Returns a JSON string representation of the replacement schema. */
|
|
15
20
|
toString(): string;
|
|
16
21
|
}
|
|
@@ -13,9 +13,11 @@ export class DataSchemaReplace {
|
|
|
13
13
|
}
|
|
14
14
|
this.fields = dataSchemaReplace["fields"].map((field) => (new DataSchemaField(field)));
|
|
15
15
|
}
|
|
16
|
+
/** Serializes the replacement schema to API format. */
|
|
16
17
|
toJSON() {
|
|
17
18
|
return { fields: this.fields.map(e => e.toJSON()) };
|
|
18
19
|
}
|
|
20
|
+
/** Returns a JSON string representation of the replacement schema. */
|
|
19
21
|
toString() {
|
|
20
22
|
return JSON.stringify(this.toJSON());
|
|
21
23
|
}
|
|
@@ -5,7 +5,10 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
|
|
|
5
5
|
* Extract raw text (OCR) from any image or scanned document.
|
|
6
6
|
*/
|
|
7
7
|
export declare class Ocr extends BaseProduct {
|
|
8
|
+
/** Parameter class accepted by this product. */
|
|
8
9
|
static get parametersClass(): typeof OcrParameters;
|
|
10
|
+
/** Response class returned by this product. */
|
|
9
11
|
static get responseClass(): typeof OcrResponse;
|
|
12
|
+
/** API slug for this product. */
|
|
10
13
|
static get slug(): string;
|
|
11
14
|
}
|
|
@@ -5,12 +5,15 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
|
|
|
5
5
|
* Extract raw text (OCR) from any image or scanned document.
|
|
6
6
|
*/
|
|
7
7
|
export class Ocr extends BaseProduct {
|
|
8
|
+
/** Parameter class accepted by this product. */
|
|
8
9
|
static get parametersClass() {
|
|
9
10
|
return OcrParameters;
|
|
10
11
|
}
|
|
12
|
+
/** Response class returned by this product. */
|
|
11
13
|
static get responseClass() {
|
|
12
14
|
return OcrResponse;
|
|
13
15
|
}
|
|
16
|
+
/** API slug for this product. */
|
|
14
17
|
static get slug() {
|
|
15
18
|
return "ocr";
|
|
16
19
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/index.js";
|
|
2
2
|
import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
|
|
3
3
|
import { OcrResult } from "../../../v2/product/ocr/ocrResult.js";
|
|
4
|
+
/** Inference payload for OCR responses. */
|
|
4
5
|
export declare class OcrInference extends BaseInference {
|
|
5
6
|
/**
|
|
6
7
|
* Result of an OCR inference.
|
|
7
8
|
*/
|
|
8
9
|
result: OcrResult;
|
|
9
10
|
constructor(serverResponse: StringDict);
|
|
11
|
+
/** Returns a readable representation of OCR inference output. */
|
|
10
12
|
toString(): string;
|
|
11
13
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
|
|
2
2
|
import { OcrResult } from "../../../v2/product/ocr/ocrResult.js";
|
|
3
|
+
/** Inference payload for OCR responses. */
|
|
3
4
|
export class OcrInference extends BaseInference {
|
|
4
5
|
constructor(serverResponse) {
|
|
5
6
|
super(serverResponse);
|
|
6
7
|
this.result = new OcrResult(serverResponse["result"]);
|
|
7
8
|
}
|
|
9
|
+
/** Returns a readable representation of OCR inference output. */
|
|
8
10
|
toString() {
|
|
9
11
|
return ("Inference\n" +
|
|
10
12
|
"#########\n" +
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OcrWord } from "./ocrWord.js";
|
|
2
2
|
import { StringDict } from "../../../parsing/index.js";
|
|
3
|
+
/** OCR payload for a single page. */
|
|
3
4
|
export declare class OcrPage {
|
|
4
5
|
/**
|
|
5
6
|
* List of words extracted from the document page.
|
|
@@ -10,5 +11,6 @@ export declare class OcrPage {
|
|
|
10
11
|
*/
|
|
11
12
|
content: string;
|
|
12
13
|
constructor(serverResponse: StringDict);
|
|
14
|
+
/** Returns a readable representation of page OCR content. */
|
|
13
15
|
toString(): string;
|
|
14
16
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { OcrWord } from "./ocrWord.js";
|
|
2
|
+
/** OCR payload for a single page. */
|
|
2
3
|
export class OcrPage {
|
|
3
4
|
constructor(serverResponse) {
|
|
4
5
|
this.words = serverResponse["words"].map(word => new OcrWord(word));
|
|
5
6
|
this.content = serverResponse["content"];
|
|
6
7
|
}
|
|
8
|
+
/** Returns a readable representation of page OCR content. */
|
|
7
9
|
toString() {
|
|
8
10
|
let ocrWords = "\n";
|
|
9
11
|
if (this.words.length > 0) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
2
2
|
import { OcrInference } from "./ocrInference.js";
|
|
3
3
|
import { BaseResponse } from "../../../v2/parsing/index.js";
|
|
4
|
+
/** Response wrapper for OCR product calls. */
|
|
4
5
|
export declare class OcrResponse extends BaseResponse {
|
|
5
6
|
/**
|
|
6
7
|
* Response for an OCR utility inference.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OcrInference } from "./ocrInference.js";
|
|
2
2
|
import { BaseResponse } from "../../../v2/parsing/index.js";
|
|
3
|
+
/** Response wrapper for OCR product calls. */
|
|
3
4
|
export class OcrResponse extends BaseResponse {
|
|
4
5
|
/**
|
|
5
6
|
* @param serverResponse JSON response from the server.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Polygon } from "../../../geometry/index.js";
|
|
2
2
|
import { StringDict } from "../../../parsing/index.js";
|
|
3
|
+
/** OCR word token with geometry. */
|
|
3
4
|
export declare class OcrWord {
|
|
4
5
|
/**
|
|
5
6
|
* Text content of the word.
|
|
@@ -10,5 +11,6 @@ export declare class OcrWord {
|
|
|
10
11
|
*/
|
|
11
12
|
polygon: Polygon;
|
|
12
13
|
constructor(serverResponse: StringDict);
|
|
14
|
+
/** Returns the OCR token text. */
|
|
13
15
|
toString(): string;
|
|
14
16
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Polygon } from "../../../geometry/index.js";
|
|
2
|
+
/** OCR word token with geometry. */
|
|
2
3
|
export class OcrWord {
|
|
3
4
|
constructor(serverResponse) {
|
|
4
5
|
this.content = serverResponse["content"];
|
|
5
6
|
this.polygon = new Polygon(...serverResponse["polygon"]);
|
|
6
7
|
}
|
|
8
|
+
/** Returns the OCR token text. */
|
|
7
9
|
toString() {
|
|
8
10
|
return this.content;
|
|
9
11
|
}
|
|
@@ -5,7 +5,10 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
|
|
|
5
5
|
* Break a multipage source file into separate documents, associating a class for each one.
|
|
6
6
|
*/
|
|
7
7
|
export declare class Split extends BaseProduct {
|
|
8
|
+
/** Parameter class accepted by this product. */
|
|
8
9
|
static get parametersClass(): typeof SplitParameters;
|
|
10
|
+
/** Response class returned by this product. */
|
|
9
11
|
static get responseClass(): typeof SplitResponse;
|
|
12
|
+
/** API slug for this product. */
|
|
10
13
|
static get slug(): string;
|
|
11
14
|
}
|
|
@@ -5,12 +5,15 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
|
|
|
5
5
|
* Break a multipage source file into separate documents, associating a class for each one.
|
|
6
6
|
*/
|
|
7
7
|
export class Split extends BaseProduct {
|
|
8
|
+
/** Parameter class accepted by this product. */
|
|
8
9
|
static get parametersClass() {
|
|
9
10
|
return SplitParameters;
|
|
10
11
|
}
|
|
12
|
+
/** Response class returned by this product. */
|
|
11
13
|
static get responseClass() {
|
|
12
14
|
return SplitResponse;
|
|
13
15
|
}
|
|
16
|
+
/** API slug for this product. */
|
|
14
17
|
static get slug() {
|
|
15
18
|
return "split";
|
|
16
19
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/index.js";
|
|
2
2
|
import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
|
|
3
3
|
import { SplitResult } from "./splitResult.js";
|
|
4
|
+
/** Inference payload for split responses. */
|
|
4
5
|
export declare class SplitInference extends BaseInference {
|
|
5
6
|
/**
|
|
6
7
|
* Result of a split inference.
|
|
7
8
|
*/
|
|
8
9
|
result: SplitResult;
|
|
9
10
|
constructor(serverResponse: StringDict);
|
|
11
|
+
/** Returns a readable representation of the split inference. */
|
|
10
12
|
toString(): string;
|
|
11
13
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
|
|
2
2
|
import { SplitResult } from "./splitResult.js";
|
|
3
|
+
/** Inference payload for split responses. */
|
|
3
4
|
export class SplitInference extends BaseInference {
|
|
4
5
|
constructor(serverResponse) {
|
|
5
6
|
super(serverResponse);
|
|
6
7
|
this.result = new SplitResult(serverResponse["result"]);
|
|
7
8
|
}
|
|
9
|
+
/** Returns a readable representation of the split inference. */
|
|
8
10
|
toString() {
|
|
9
11
|
return (super.toString() +
|
|
10
12
|
this.result.toString() + "\n");
|
|
@@ -20,6 +20,7 @@ export declare class SplitRange {
|
|
|
20
20
|
*/
|
|
21
21
|
extractionResponse?: ExtractionResponse;
|
|
22
22
|
constructor(serverResponse: StringDict);
|
|
23
|
+
/** Returns a readable summary of the split range. */
|
|
23
24
|
toString(): string;
|
|
24
25
|
/**
|
|
25
26
|
* Extracts a single split from the input file.
|
|
@@ -11,6 +11,7 @@ export class SplitRange {
|
|
|
11
11
|
? new ExtractionResponse(serverResponse["extraction_response"])
|
|
12
12
|
: undefined;
|
|
13
13
|
}
|
|
14
|
+
/** Returns a readable summary of the split range. */
|
|
14
15
|
toString() {
|
|
15
16
|
const pageRange = this.pageRange.join(",");
|
|
16
17
|
return `* :Page Range: ${pageRange}\n :Document Type: ${this.documentType}`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
2
2
|
import { SplitInference } from "./splitInference.js";
|
|
3
3
|
import { BaseResponse } from "../../../v2/parsing/index.js";
|
|
4
|
+
/** Response wrapper for split product calls. */
|
|
4
5
|
export declare class SplitResponse extends BaseResponse {
|
|
5
6
|
/**
|
|
6
7
|
* Response for an OCR utility inference.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SplitInference } from "./splitInference.js";
|
|
2
2
|
import { BaseResponse } from "../../../v2/parsing/index.js";
|
|
3
|
+
/** Response wrapper for split product calls. */
|
|
3
4
|
export class SplitResponse extends BaseResponse {
|
|
4
5
|
/**
|
|
5
6
|
* @param serverResponse JSON response from the server.
|