mindee 5.9.0 → 5.10.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 +6 -0
- package/package.json +12 -13
- package/src/geometry/bbox.d.ts +18 -6
- package/src/geometry/bbox.js +6 -2
- package/src/geometry/boundingBox.d.ts +3 -1
- package/src/geometry/boundingBox.js +3 -1
- package/src/geometry/boundingBoxUtils.d.ts +4 -4
- package/src/geometry/boundingBoxUtils.js +7 -7
- package/src/geometry/minMax.d.ts +9 -3
- package/src/geometry/point.d.ts +3 -1
- package/src/geometry/polygon.d.ts +3 -1
- package/src/geometry/polygon.js +3 -1
- package/src/http/apiCore.js +1 -1
- package/src/http/baseSettings.d.ts +15 -5
- package/src/http/baseSettings.js +4 -2
- package/src/http/dispatcher.js +4 -2
- package/src/image/extractedImage.d.ts +13 -5
- package/src/image/extractedImage.js +3 -3
- package/src/image/extractedImages.d.ts +3 -1
- package/src/image/extractedImages.js +3 -1
- package/src/image/imageCompressor.d.ts +1 -0
- package/src/image/imageCompressor.js +2 -2
- package/src/image/imageExtractor.d.ts +1 -1
- package/src/image/imageExtractor.js +12 -12
- package/src/input/base64Input.d.ts +9 -3
- package/src/input/base64Input.js +9 -3
- package/src/input/bufferInput.d.ts +7 -2
- package/src/input/bufferInput.js +6 -2
- package/src/input/bytesInput.d.ts +10 -3
- package/src/input/bytesInput.js +10 -3
- package/src/input/inputSource.d.ts +4 -2
- package/src/input/inputSource.js +3 -2
- package/src/input/localInputSource.d.ts +19 -6
- package/src/input/localInputSource.js +12 -5
- package/src/input/pageOptions.d.ts +9 -3
- package/src/input/pageOptions.js +6 -2
- package/src/input/pathInput.d.ts +12 -4
- package/src/input/pathInput.js +11 -5
- package/src/input/streamInput.d.ts +14 -5
- package/src/input/streamInput.js +13 -4
- package/src/input/urlInput.d.ts +19 -7
- package/src/input/urlInput.js +20 -12
- package/src/parsing/baseLocalResponse.d.ts +7 -3
- package/src/parsing/baseLocalResponse.js +15 -11
- package/src/parsing/stringDict.d.ts +3 -1
- package/src/pdf/extractedPdf.d.ts +16 -6
- package/src/pdf/extractedPdf.js +5 -3
- package/src/pdf/extractedPdfs.d.ts +3 -1
- package/src/pdf/extractedPdfs.js +3 -1
- package/src/pdf/pdfCompressor.js +14 -14
- package/src/pdf/pdfExtractor.js +1 -1
- package/src/pdf/pdfOperation.d.ts +9 -3
- package/src/pdf/pdfOperation.js +14 -14
- package/src/pdf/pdfUtils.js +1 -1
- package/src/v1/cli.js +1 -1
- package/src/v1/client.d.ts +42 -14
- package/src/v1/client.js +8 -8
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts +6 -2
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +4 -4
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.d.ts +6 -2
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +2 -2
- package/src/v1/http/apiSettingsV1.d.ts +15 -5
- package/src/v1/http/apiSettingsV1.js +12 -4
- package/src/v1/http/baseEndpoint.d.ts +6 -2
- package/src/v1/http/endpoint.d.ts +9 -3
- package/src/v1/http/endpoint.js +1 -1
- package/src/v1/http/errors.d.ts +9 -3
- package/src/v1/http/errors.js +6 -2
- package/src/v1/http/httpParams.d.ts +36 -12
- package/src/v1/http/workflowEndpoint.js +1 -1
- package/src/v1/parsing/common/apiRequest.d.ts +15 -5
- package/src/v1/parsing/common/apiResponse.d.ts +6 -2
- package/src/v1/parsing/common/asyncPredictResponse.d.ts +21 -7
- package/src/v1/parsing/common/document.d.ts +18 -6
- package/src/v1/parsing/common/document.js +2 -2
- package/src/v1/parsing/common/execution.d.ts +39 -13
- package/src/v1/parsing/common/executionFile.d.ts +6 -2
- package/src/v1/parsing/common/executionPriority.d.ts +12 -4
- package/src/v1/parsing/common/executionPriority.js +12 -4
- package/src/v1/parsing/common/extras/cropperExtra.d.ts +7 -3
- package/src/v1/parsing/common/extras/cropperExtra.js +6 -3
- package/src/v1/parsing/common/extras/extras.d.ts +9 -3
- package/src/v1/parsing/common/extras/extras.js +6 -2
- package/src/v1/parsing/common/extras/fullTextOcrExtra.d.ts +9 -3
- package/src/v1/parsing/common/extras/fullTextOcrExtra.js +3 -1
- package/src/v1/parsing/common/extras/ragExtra.d.ts +3 -1
- package/src/v1/parsing/common/extras/ragExtra.js +3 -1
- package/src/v1/parsing/common/feedback/feedbackResponse.d.ts +3 -1
- package/src/v1/parsing/common/feedback/feedbackResponse.js +0 -1
- package/src/v1/parsing/common/inference.d.ts +24 -8
- package/src/v1/parsing/common/inference.js +6 -2
- package/src/v1/parsing/common/mvisionV1.d.ts +3 -1
- package/src/v1/parsing/common/mvisionV1.js +3 -1
- package/src/v1/parsing/common/ocr.d.ts +3 -1
- package/src/v1/parsing/common/ocrPage.d.ts +6 -2
- package/src/v1/parsing/common/ocrPage.js +6 -2
- package/src/v1/parsing/common/orientation.d.ts +6 -2
- package/src/v1/parsing/common/page.d.ts +12 -4
- package/src/v1/parsing/common/predictResponse.d.ts +3 -1
- package/src/v1/parsing/common/prediction.d.ts +3 -1
- package/src/v1/parsing/common/prediction.js +3 -1
- package/src/v1/parsing/generated/generatedList.d.ts +6 -2
- package/src/v1/parsing/generated/generatedObject.d.ts +25 -9
- package/src/v1/parsing/generated/generatedObject.js +13 -7
- package/src/v1/parsing/localResponse.d.ts +3 -1
- package/src/v1/parsing/localResponse.js +3 -1
- package/src/v1/parsing/standard/addressField.d.ts +24 -8
- package/src/v1/parsing/standard/amount.d.ts +3 -1
- package/src/v1/parsing/standard/amount.js +3 -1
- package/src/v1/parsing/standard/base.d.ts +27 -9
- package/src/v1/parsing/standard/base.js +6 -2
- package/src/v1/parsing/standard/boolean.d.ts +3 -1
- package/src/v1/parsing/standard/classification.d.ts +6 -2
- package/src/v1/parsing/standard/companyRegistration.d.ts +9 -3
- package/src/v1/parsing/standard/companyRegistration.js +3 -1
- package/src/v1/parsing/standard/date.d.ts +12 -4
- package/src/v1/parsing/standard/date.js +3 -1
- package/src/v1/parsing/standard/field.d.ts +7 -5
- package/src/v1/parsing/standard/field.js +4 -4
- package/src/v1/parsing/standard/locale.d.ts +15 -5
- package/src/v1/parsing/standard/paymentDetails.d.ts +15 -5
- package/src/v1/parsing/standard/position.d.ts +15 -5
- package/src/v1/parsing/standard/tax.d.ts +18 -6
- package/src/v1/parsing/standard/tax.js +15 -5
- package/src/v1/parsing/standard/text.d.ts +6 -2
- package/src/v1/parsing/standard/word.d.ts +9 -3
- package/src/v1/parsing/standard/word.js +3 -1
- package/src/v1/product/barcodeReader/barcodeReaderV1.d.ts +12 -4
- package/src/v1/product/barcodeReader/barcodeReaderV1.js +9 -3
- package/src/v1/product/barcodeReader/barcodeReaderV1Document.d.ts +6 -2
- package/src/v1/product/barcodeReader/barcodeReaderV1Document.js +6 -2
- package/src/v1/product/cropper/cropperV1.d.ts +12 -4
- package/src/v1/product/cropper/cropperV1.js +9 -3
- package/src/v1/product/cropper/cropperV1Page.d.ts +3 -1
- package/src/v1/product/cropper/cropperV1Page.js +3 -1
- package/src/v1/product/driverLicense/driverLicenseV1.d.ts +12 -4
- package/src/v1/product/driverLicense/driverLicenseV1.js +9 -3
- package/src/v1/product/driverLicense/driverLicenseV1Document.d.ts +39 -13
- package/src/v1/product/financialDocument/financialDocumentV1.d.ts +12 -4
- package/src/v1/product/financialDocument/financialDocumentV1.js +9 -3
- package/src/v1/product/financialDocument/financialDocumentV1Document.d.ts +96 -32
- package/src/v1/product/financialDocument/financialDocumentV1Document.js +15 -5
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.d.ts +30 -10
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +3 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +12 -4
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.js +9 -3
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.d.ts +9 -3
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.d.ts +12 -4
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.js +9 -3
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +18 -6
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.js +3 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.d.ts +12 -4
- package/src/v1/product/fr/carteGrise/carteGriseV1.d.ts +12 -4
- package/src/v1/product/fr/carteGrise/carteGriseV1.js +9 -3
- package/src/v1/product/fr/carteGrise/carteGriseV1Document.d.ts +123 -41
- package/src/v1/product/fr/idCard/idCardV2.d.ts +12 -4
- package/src/v1/product/fr/idCard/idCardV2.js +9 -3
- package/src/v1/product/fr/idCard/idCardV2Document.d.ts +45 -15
- package/src/v1/product/fr/idCard/idCardV2Document.js +3 -1
- package/src/v1/product/fr/idCard/idCardV2Page.d.ts +6 -2
- package/src/v1/product/generated/generatedV1.d.ts +12 -4
- package/src/v1/product/generated/generatedV1.js +9 -3
- package/src/v1/product/generated/generatedV1Prediction.d.ts +6 -2
- package/src/v1/product/generated/generatedV1Prediction.js +3 -1
- package/src/v1/product/internationalId/internationalIdV2.d.ts +12 -4
- package/src/v1/product/internationalId/internationalIdV2.js +9 -3
- package/src/v1/product/internationalId/internationalIdV2Document.d.ts +51 -17
- package/src/v1/product/internationalId/internationalIdV2Document.js +6 -2
- package/src/v1/product/invoice/invoiceV4.d.ts +12 -4
- package/src/v1/product/invoice/invoiceV4.js +9 -3
- package/src/v1/product/invoice/invoiceV4Document.d.ts +87 -29
- package/src/v1/product/invoice/invoiceV4Document.js +15 -5
- package/src/v1/product/invoice/invoiceV4LineItem.d.ts +30 -10
- package/src/v1/product/invoice/invoiceV4LineItem.js +3 -1
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1.d.ts +12 -4
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1.js +9 -3
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +3 -1
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.js +3 -1
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.d.ts +9 -3
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.js +3 -1
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.d.ts +12 -4
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.js +9 -3
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.d.ts +3 -1
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.js +3 -1
- package/src/v1/product/passport/passportV1.d.ts +12 -4
- package/src/v1/product/passport/passportV1.js +9 -3
- package/src/v1/product/passport/passportV1Document.d.ts +33 -11
- package/src/v1/product/passport/passportV1Document.js +3 -1
- package/src/v1/product/receipt/receiptV5.d.ts +12 -4
- package/src/v1/product/receipt/receiptV5.js +9 -3
- package/src/v1/product/receipt/receiptV5Document.d.ts +51 -17
- package/src/v1/product/receipt/receiptV5Document.js +6 -2
- package/src/v1/product/receipt/receiptV5LineItem.d.ts +18 -6
- package/src/v1/product/receipt/receiptV5LineItem.js +3 -1
- package/src/v1/product/resume/resumeV1.d.ts +12 -4
- package/src/v1/product/resume/resumeV1.js +9 -3
- package/src/v1/product/resume/resumeV1Certificate.d.ts +18 -6
- package/src/v1/product/resume/resumeV1Certificate.js +3 -1
- package/src/v1/product/resume/resumeV1Document.d.ts +51 -17
- package/src/v1/product/resume/resumeV1Document.js +27 -9
- package/src/v1/product/resume/resumeV1Education.d.ts +27 -9
- package/src/v1/product/resume/resumeV1Education.js +3 -1
- package/src/v1/product/resume/resumeV1Language.d.ts +12 -4
- package/src/v1/product/resume/resumeV1Language.js +3 -1
- package/src/v1/product/resume/resumeV1ProfessionalExperience.d.ts +33 -11
- package/src/v1/product/resume/resumeV1ProfessionalExperience.js +3 -1
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.d.ts +12 -4
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +3 -1
- package/src/v1/product/us/bankCheck/bankCheckV1.d.ts +12 -4
- package/src/v1/product/us/bankCheck/bankCheckV1.js +9 -3
- package/src/v1/product/us/bankCheck/bankCheckV1Document.d.ts +18 -6
- package/src/v1/product/us/bankCheck/bankCheckV1Document.js +3 -1
- package/src/v1/product/us/bankCheck/bankCheckV1Page.d.ts +6 -2
- package/src/v1/product/us/bankCheck/bankCheckV1Page.js +3 -1
- package/src/v2/cli.js +1 -1
- package/src/v2/client.d.ts +9 -3
- package/src/v2/clientOptions/pollingOptions.d.ts +30 -10
- package/src/v2/clientOptions/pollingOptions.js +6 -2
- package/src/v2/http/mindeeApiV2.d.ts +1 -1
- package/src/v2/http/mindeeApiV2.js +1 -1
- package/src/v2/parsing/error/errorDetails.d.ts +3 -1
- package/src/v2/parsing/inference/baseInference.d.ts +6 -2
- package/src/v2/parsing/inference/baseInference.js +6 -2
- package/src/v2/parsing/inference/field/baseField.d.ts +9 -3
- package/src/v2/parsing/inference/field/fieldConfidence.d.ts +12 -4
- package/src/v2/parsing/inference/field/fieldConfidence.js +12 -4
- package/src/v2/parsing/inference/field/fieldLocation.d.ts +9 -3
- package/src/v2/parsing/inference/field/fieldLocation.js +3 -1
- package/src/v2/parsing/inference/field/inferenceFields.d.ts +6 -2
- package/src/v2/parsing/inference/field/inferenceFields.js +3 -1
- package/src/v2/parsing/inference/field/listField.d.ts +6 -2
- package/src/v2/parsing/inference/field/listField.js +6 -2
- package/src/v2/parsing/inference/field/objectField.d.ts +6 -2
- package/src/v2/parsing/inference/field/objectField.js +3 -1
- package/src/v2/parsing/inference/field/ragMetadata.d.ts +3 -1
- package/src/v2/parsing/inference/field/ragMetadata.js +3 -1
- package/src/v2/parsing/inference/field/rawText.d.ts +6 -2
- package/src/v2/parsing/inference/field/rawText.js +6 -2
- package/src/v2/parsing/inference/field/simpleField.d.ts +6 -2
- package/src/v2/parsing/inference/field/simpleField.js +8 -4
- package/src/v2/parsing/inference/inferenceFile.d.ts +6 -2
- package/src/v2/parsing/inference/inferenceFile.js +6 -2
- package/src/v2/parsing/inference/inferenceModel.d.ts +6 -2
- package/src/v2/parsing/inference/inferenceModel.js +6 -2
- package/src/v2/product/classification/classification.d.ts +9 -3
- package/src/v2/product/classification/classification.js +9 -3
- package/src/v2/product/classification/classificationClassifier.d.ts +6 -2
- package/src/v2/product/classification/classificationClassifier.js +6 -2
- package/src/v2/product/classification/classificationInference.d.ts +6 -2
- package/src/v2/product/classification/classificationInference.js +6 -2
- package/src/v2/product/classification/classificationResponse.d.ts +3 -1
- package/src/v2/product/classification/classificationResponse.js +3 -1
- package/src/v2/product/classification/classificationResult.d.ts +6 -2
- package/src/v2/product/classification/classificationResult.js +6 -2
- package/src/v2/product/crop/crop.d.ts +9 -3
- package/src/v2/product/crop/crop.js +9 -3
- package/src/v2/product/crop/cropInference.d.ts +6 -2
- package/src/v2/product/crop/cropInference.js +6 -2
- package/src/v2/product/crop/cropItem.d.ts +6 -2
- package/src/v2/product/crop/cropItem.js +6 -2
- package/src/v2/product/crop/cropResponse.d.ts +3 -1
- package/src/v2/product/crop/cropResponse.js +3 -1
- package/src/v2/product/crop/cropResult.d.ts +6 -2
- package/src/v2/product/crop/cropResult.js +6 -2
- package/src/v2/product/extraction/dataSchemaActiveOption.d.ts +3 -1
- package/src/v2/product/extraction/dataSchemaActiveOption.js +3 -1
- package/src/v2/product/extraction/extraction.d.ts +18 -6
- package/src/v2/product/extraction/extraction.js +18 -6
- package/src/v2/product/extraction/extractionActiveOptions.d.ts +6 -2
- package/src/v2/product/extraction/extractionActiveOptions.js +6 -2
- package/src/v2/product/extraction/extractionInference.d.ts +6 -2
- package/src/v2/product/extraction/extractionInference.js +6 -2
- package/src/v2/product/extraction/extractionResponse.d.ts +3 -1
- package/src/v2/product/extraction/extractionResponse.js +3 -1
- package/src/v2/product/extraction/extractionResult.d.ts +6 -2
- package/src/v2/product/extraction/extractionResult.js +6 -2
- package/src/v2/product/extraction/params/dataSchema.d.ts +12 -4
- package/src/v2/product/extraction/params/dataSchema.js +6 -2
- package/src/v2/product/extraction/params/dataSchemaField.d.ts +39 -13
- package/src/v2/product/extraction/params/dataSchemaField.js +9 -3
- package/src/v2/product/extraction/params/dataSchemaReplace.d.ts +12 -4
- package/src/v2/product/extraction/params/dataSchemaReplace.js +6 -2
- package/src/v2/product/extraction/params/extractionParameters.js +3 -3
- package/src/v2/product/extraction/ragDocuments/annotatedListField.d.ts +3 -1
- package/src/v2/product/extraction/ragDocuments/annotatedListField.js +3 -1
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.js +1 -1
- package/src/v2/product/ocr/ocr.d.ts +9 -3
- package/src/v2/product/ocr/ocr.js +9 -3
- package/src/v2/product/ocr/ocrInference.d.ts +6 -2
- package/src/v2/product/ocr/ocrInference.js +6 -2
- package/src/v2/product/ocr/ocrPage.d.ts +6 -2
- package/src/v2/product/ocr/ocrPage.js +6 -2
- package/src/v2/product/ocr/ocrResponse.d.ts +3 -1
- package/src/v2/product/ocr/ocrResponse.js +3 -1
- package/src/v2/product/ocr/ocrResult.d.ts +3 -1
- package/src/v2/product/ocr/ocrResult.js +3 -1
- package/src/v2/product/ocr/ocrWord.d.ts +6 -2
- package/src/v2/product/ocr/ocrWord.js +6 -2
- package/src/v2/product/split/split.d.ts +9 -3
- package/src/v2/product/split/split.js +9 -3
- package/src/v2/product/split/splitInference.d.ts +6 -2
- package/src/v2/product/split/splitInference.js +6 -2
- package/src/v2/product/split/splitRange.d.ts +3 -1
- package/src/v2/product/split/splitRange.js +3 -1
- package/src/v2/product/split/splitResponse.d.ts +3 -1
- package/src/v2/product/split/splitResponse.js +3 -1
- package/src/v2/product/split/splitResult.d.ts +3 -1
- package/src/v2/product/split/splitResult.js +3 -1
- package/src/v2/search/baseSearch.d.ts +9 -3
- package/src/v2/search/baseSearch.js +9 -3
- package/src/v2/search/models/modelSearch.d.ts +9 -3
- package/src/v2/search/models/modelSearch.js +9 -3
- package/src/v2/search/models/modelSearchParameters.d.ts +3 -1
- package/src/v2/search/models/modelSearchParameters.js +3 -1
- package/src/v2/search/ragDocuments/ragDocumentSearch.d.ts +9 -3
- package/src/v2/search/ragDocuments/ragDocumentSearch.js +9 -3
- package/src/v2/search/ragDocuments/ragDocumentSearchParameters.d.ts +3 -1
- package/src/v2/search/ragDocuments/ragDocumentSearchParameters.js +3 -1
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
2
2
|
import { BaseFieldConstructor } from "../standard/index.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* A JSON-like object, with miscellaneous values.
|
|
5
|
+
*/
|
|
4
6
|
export declare class GeneratedObjectField {
|
|
5
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The document page on which the information was found.
|
|
9
|
+
*/
|
|
6
10
|
pageId?: number;
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Confidence with which the value was assessed.
|
|
13
|
+
*/
|
|
8
14
|
confidence?: number;
|
|
9
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Raw unprocessed value, as it was sent by the server.
|
|
17
|
+
*/
|
|
10
18
|
rawValue?: string;
|
|
11
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* List of all printable field names.
|
|
21
|
+
*/
|
|
12
22
|
private printableValues;
|
|
13
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* All potentially present fields.
|
|
25
|
+
*/
|
|
14
26
|
[key: string]: string | number | boolean | object | undefined;
|
|
15
27
|
constructor({ prediction, pageId, }: BaseFieldConstructor);
|
|
16
28
|
private static readonly positionFieldNames;
|
|
@@ -19,7 +31,7 @@ export declare class GeneratedObjectField {
|
|
|
19
31
|
private assignScalarField;
|
|
20
32
|
/**
|
|
21
33
|
* ReSTructured-compliant string representation.
|
|
22
|
-
Takes into account level of indentation & displays elements as list elements.
|
|
34
|
+
* Takes into account level of indentation & displays elements as list elements.
|
|
23
35
|
* @param level Level of indentation. 0 by default.
|
|
24
36
|
*/
|
|
25
37
|
toStringLevel(level?: number): string;
|
|
@@ -29,9 +41,13 @@ export declare class GeneratedObjectField {
|
|
|
29
41
|
* @returns
|
|
30
42
|
*/
|
|
31
43
|
private toNumberString;
|
|
32
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Returns the default string representation.
|
|
46
|
+
*/
|
|
33
47
|
toString(): string;
|
|
34
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Returns a field value by key from this generated object.
|
|
50
|
+
*/
|
|
35
51
|
get(fieldName: string): string | number | boolean | object | undefined;
|
|
36
52
|
}
|
|
37
53
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PositionField } from "../standard/index.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* A JSON-like object, with miscellaneous values.
|
|
4
|
+
*/
|
|
3
5
|
export class GeneratedObjectField {
|
|
4
6
|
constructor({ prediction = {}, pageId, }) {
|
|
5
7
|
let itemPageId = null;
|
|
@@ -54,7 +56,7 @@ export class GeneratedObjectField {
|
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
58
|
* ReSTructured-compliant string representation.
|
|
57
|
-
Takes into account level of indentation & displays elements as list elements.
|
|
59
|
+
* Takes into account level of indentation & displays elements as list elements.
|
|
58
60
|
* @param level Level of indentation. 0 by default.
|
|
59
61
|
*/
|
|
60
62
|
toStringLevel(level = 0) {
|
|
@@ -77,11 +79,15 @@ export class GeneratedObjectField {
|
|
|
77
79
|
}
|
|
78
80
|
return n.toString();
|
|
79
81
|
}
|
|
80
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Returns the default string representation.
|
|
84
|
+
*/
|
|
81
85
|
toString() {
|
|
82
86
|
return this.toStringLevel();
|
|
83
87
|
}
|
|
84
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Returns a field value by key from this generated object.
|
|
90
|
+
*/
|
|
85
91
|
get(fieldName) {
|
|
86
92
|
return this[fieldName];
|
|
87
93
|
}
|
|
@@ -94,7 +100,7 @@ GeneratedObjectField.positionFieldNames = new Set([
|
|
|
94
100
|
* @param strDict input dictionary to check.
|
|
95
101
|
*/
|
|
96
102
|
export function isGeneratedObject(strDict) {
|
|
97
|
-
const commonKeys = [
|
|
103
|
+
const commonKeys = new Set([
|
|
98
104
|
"value",
|
|
99
105
|
"polygon",
|
|
100
106
|
"rectangle",
|
|
@@ -103,9 +109,9 @@ export function isGeneratedObject(strDict) {
|
|
|
103
109
|
"quadrangle",
|
|
104
110
|
"values",
|
|
105
111
|
"raw_value",
|
|
106
|
-
];
|
|
112
|
+
]);
|
|
107
113
|
for (const key in strDict) {
|
|
108
|
-
if (Object.prototype.hasOwnProperty.call(strDict, key) && !commonKeys.
|
|
114
|
+
if (Object.prototype.hasOwnProperty.call(strDict, key) && !commonKeys.has(key)) {
|
|
109
115
|
return true;
|
|
110
116
|
}
|
|
111
117
|
}
|
|
@@ -6,6 +6,8 @@ import { StringDict } from "../../parsing/index.js";
|
|
|
6
6
|
* Note: Has to be initialized through init() before use.
|
|
7
7
|
*/
|
|
8
8
|
export declare class LocalResponse extends BaseLocalResponse {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Loads a local JSON payload into a typed prediction response wrapper.
|
|
11
|
+
*/
|
|
10
12
|
loadPrediction<T extends Inference>(productClass: new (httpResponse: StringDict) => T): Promise<AsyncPredictResponse<T> | PredictResponse<T>>;
|
|
11
13
|
}
|
|
@@ -6,7 +6,9 @@ import { MindeeError } from "../../errors/index.js";
|
|
|
6
6
|
* Note: Has to be initialized through init() before use.
|
|
7
7
|
*/
|
|
8
8
|
export class LocalResponse extends BaseLocalResponse {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Loads a local JSON payload into a typed prediction response wrapper.
|
|
11
|
+
*/
|
|
10
12
|
async loadPrediction(productClass) {
|
|
11
13
|
/**
|
|
12
14
|
* Load a prediction.
|
|
@@ -5,21 +5,37 @@ import { StringField, FieldConstructor } from "./text.js";
|
|
|
5
5
|
* address string through {@link StringField.value}.
|
|
6
6
|
*/
|
|
7
7
|
export declare class AddressField extends StringField {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Street number.
|
|
10
|
+
*/
|
|
9
11
|
streetNumber?: string;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Street name.
|
|
14
|
+
*/
|
|
11
15
|
streetName?: string;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* PO-box number.
|
|
18
|
+
*/
|
|
13
19
|
poBox?: string;
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Additional address complement.
|
|
22
|
+
*/
|
|
15
23
|
addressComplement?: string;
|
|
16
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* City or locality.
|
|
26
|
+
*/
|
|
17
27
|
city?: string;
|
|
18
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Postal / ZIP code.
|
|
30
|
+
*/
|
|
19
31
|
postalCode?: string;
|
|
20
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* State, province or region.
|
|
34
|
+
*/
|
|
21
35
|
state?: string;
|
|
22
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Country.
|
|
38
|
+
*/
|
|
23
39
|
country?: string;
|
|
24
40
|
constructor({ prediction, valueKey, reconstructed, pageId, }: FieldConstructor);
|
|
25
41
|
}
|
|
@@ -4,7 +4,9 @@ import { BaseFieldConstructor } from "./base.js";
|
|
|
4
4
|
* A field containing an amount value.
|
|
5
5
|
*/
|
|
6
6
|
export declare class AmountField extends Field {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The value.
|
|
9
|
+
*/
|
|
8
10
|
value?: number;
|
|
9
11
|
/**
|
|
10
12
|
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
@@ -9,7 +9,9 @@ export class AmountField extends Field {
|
|
|
9
9
|
*/
|
|
10
10
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId = undefined, }) {
|
|
11
11
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The value.
|
|
14
|
+
*/
|
|
13
15
|
this.value = undefined;
|
|
14
16
|
this.value = +parseFloat(prediction[valueKey]);
|
|
15
17
|
if (isNaN(this.value)) {
|
|
@@ -5,32 +5,50 @@ import { StringDict } from "../../../parsing/stringDict.js";
|
|
|
5
5
|
* @property {boolean} reconstructed - Is the object reconstructed (not extracted by the API).
|
|
6
6
|
* @property {number} pageId - Page ID for multi-page document.
|
|
7
7
|
*/
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Constructor payload shared by standard v1 fields.
|
|
10
|
+
*/
|
|
9
11
|
export interface BaseFieldConstructor {
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Raw field payload from API response.
|
|
14
|
+
*/
|
|
11
15
|
prediction: StringDict;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Key to read from `prediction` as field value.
|
|
18
|
+
*/
|
|
13
19
|
valueKey?: string;
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Whether the field was reconstructed locally.
|
|
22
|
+
*/
|
|
15
23
|
reconstructed?: boolean;
|
|
16
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Optional page identifier for multi-page documents.
|
|
26
|
+
*/
|
|
17
27
|
pageId?: number;
|
|
18
28
|
}
|
|
19
29
|
/**
|
|
20
30
|
* Base class for most fields.
|
|
21
31
|
*/
|
|
22
32
|
export declare class BaseField {
|
|
23
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The value.
|
|
35
|
+
*/
|
|
24
36
|
value?: string | number | boolean;
|
|
25
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* `true` when the field was reconstructed or computed using other fields.
|
|
39
|
+
*/
|
|
26
40
|
reconstructed: boolean;
|
|
27
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Page ID for multi-page document.
|
|
43
|
+
*/
|
|
28
44
|
pageId?: number;
|
|
29
45
|
/**
|
|
30
46
|
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
31
47
|
*/
|
|
32
48
|
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
33
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Compares two field values for semantic equality.
|
|
51
|
+
*/
|
|
34
52
|
compare(other: BaseField): boolean;
|
|
35
53
|
/**
|
|
36
54
|
* @param {BaseField[]} array - Array of Fields
|
|
@@ -6,7 +6,9 @@ export class BaseField {
|
|
|
6
6
|
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
7
7
|
*/
|
|
8
8
|
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId = undefined, }) {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The value.
|
|
11
|
+
*/
|
|
10
12
|
this.value = undefined;
|
|
11
13
|
this.reconstructed = reconstructed;
|
|
12
14
|
if (prediction !== undefined &&
|
|
@@ -17,7 +19,9 @@ export class BaseField {
|
|
|
17
19
|
this.pageId = pageId !== undefined ? pageId : prediction["page_id"];
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Compares two field values for semantic equality.
|
|
24
|
+
*/
|
|
21
25
|
compare(other) {
|
|
22
26
|
if (this.value === null && other.value === null)
|
|
23
27
|
return true;
|
|
@@ -10,7 +10,9 @@ export interface FieldConstructor {
|
|
|
10
10
|
* A field containing a text value.
|
|
11
11
|
*/
|
|
12
12
|
export declare class BooleanField extends Field {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The value.
|
|
15
|
+
*/
|
|
14
16
|
value?: boolean;
|
|
15
17
|
constructor({ prediction, valueKey, reconstructed, pageId, }: FieldConstructor);
|
|
16
18
|
toString(): string;
|
|
@@ -3,9 +3,13 @@ import { BaseField, BaseFieldConstructor } from "./base.js";
|
|
|
3
3
|
* Represents a classifier value.
|
|
4
4
|
*/
|
|
5
5
|
export declare class ClassificationField extends BaseField {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The confidence score of the prediction.
|
|
8
|
+
*/
|
|
7
9
|
confidence: number;
|
|
8
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The classification.
|
|
12
|
+
*/
|
|
9
13
|
value?: string;
|
|
10
14
|
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
11
15
|
}
|
|
@@ -4,12 +4,18 @@ import { BaseFieldConstructor } from "./base.js";
|
|
|
4
4
|
* A company registration item.
|
|
5
5
|
*/
|
|
6
6
|
export declare class CompanyRegistrationField extends Field {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Registration identifier.
|
|
9
|
+
*/
|
|
8
10
|
value?: string;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Type of company registration.
|
|
13
|
+
*/
|
|
10
14
|
type: string;
|
|
11
15
|
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Returns a row-formatted representation for table output.
|
|
18
|
+
*/
|
|
13
19
|
toTableLine(): string;
|
|
14
20
|
toString(): string;
|
|
15
21
|
private printableValues;
|
|
@@ -8,7 +8,9 @@ export class CompanyRegistrationField extends Field {
|
|
|
8
8
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
9
9
|
this.type = prediction["type"];
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Returns a row-formatted representation for table output.
|
|
13
|
+
*/
|
|
12
14
|
toTableLine() {
|
|
13
15
|
const printable = this.printableValues();
|
|
14
16
|
return `| ${printable["type"].padEnd(15)} | ${printable["value"].padEnd(20)} `;
|
|
@@ -4,16 +4,24 @@ import { BaseFieldConstructor } from "./base.js";
|
|
|
4
4
|
* A field containing a date value.
|
|
5
5
|
*/
|
|
6
6
|
export declare class DateField extends Field {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Date string in ISO format.
|
|
9
|
+
*/
|
|
8
10
|
value?: string;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Date as a standard JavaScript `Date` object.
|
|
13
|
+
*/
|
|
10
14
|
dateObject?: Date;
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Whether the field was computed or retrieved directly from the document.
|
|
17
|
+
*/
|
|
12
18
|
isComputed?: boolean;
|
|
13
19
|
/**
|
|
14
20
|
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
15
21
|
*/
|
|
16
22
|
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
17
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Compares two dates by calendar day (year/month/day).
|
|
25
|
+
*/
|
|
18
26
|
static compareDates(date1: Date, date2: Date): boolean;
|
|
19
27
|
}
|
|
@@ -23,7 +23,9 @@ export class DateField extends Field {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Compares two dates by calendar day (year/month/day).
|
|
28
|
+
*/
|
|
27
29
|
static compareDates(date1, date2) {
|
|
28
30
|
return date1.getFullYear() === date2.getFullYear() &&
|
|
29
31
|
date1.getMonth() === date2.getMonth() &&
|
|
@@ -14,17 +14,19 @@ export declare class Field extends BaseField {
|
|
|
14
14
|
* the field in the document.
|
|
15
15
|
*/
|
|
16
16
|
polygon: Polygon;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The confidence score of the prediction.
|
|
19
|
+
*/
|
|
18
20
|
confidence: number;
|
|
19
21
|
/**
|
|
20
22
|
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
21
23
|
*/
|
|
22
24
|
constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor);
|
|
23
25
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
* @param array1 first Array of Fields
|
|
27
|
+
* @param array2 second Array of Fields
|
|
28
|
+
* @param attr Attribute to compare
|
|
29
|
+
* @returns true if all elements in array1 exist in array2 and vice-versa, false otherwise
|
|
28
30
|
*/
|
|
29
31
|
static compareArrays(array1: Field[], array2: Field[], attr?: string): boolean;
|
|
30
32
|
/**
|
|
@@ -21,10 +21,10 @@ export class Field extends BaseField {
|
|
|
21
21
|
this.boundingBox = getBoundingBox(this.polygon);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
* @param array1 first Array of Fields
|
|
25
|
+
* @param array2 second Array of Fields
|
|
26
|
+
* @param attr Attribute to compare
|
|
27
|
+
* @returns true if all elements in array1 exist in array2 and vice-versa, false otherwise
|
|
28
28
|
*/
|
|
29
29
|
static compareArrays(array1, array2, attr = "value") {
|
|
30
30
|
const list1 = array1.map((item) => item[attr]);
|
|
@@ -3,15 +3,25 @@ import { BaseField, BaseFieldConstructor } from "./base.js";
|
|
|
3
3
|
* The locale detected on the document.
|
|
4
4
|
*/
|
|
5
5
|
export declare class LocaleField extends BaseField {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Locale in ISO format.
|
|
8
|
+
*/
|
|
7
9
|
value?: string;
|
|
8
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The confidence score of the prediction.
|
|
12
|
+
*/
|
|
9
13
|
confidence: number;
|
|
10
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* ISO 639-1 language code
|
|
16
|
+
*/
|
|
11
17
|
language?: string;
|
|
12
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* ISO 3166-1 alpha-2 (or alpha-3) country code
|
|
20
|
+
*/
|
|
13
21
|
country?: string;
|
|
14
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* ISO 4217 currency code
|
|
24
|
+
*/
|
|
15
25
|
currency?: string;
|
|
16
26
|
/**
|
|
17
27
|
* @param {BaseFieldConstructor} constructor Constructor parameters.
|
|
@@ -25,15 +25,25 @@ interface PaymentDetailsConstructor {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare class PaymentDetailsField extends Field {
|
|
27
27
|
#private;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Synonym for the `iban` property
|
|
30
|
+
*/
|
|
29
31
|
value?: string;
|
|
30
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* The account number.
|
|
34
|
+
*/
|
|
31
35
|
accountNumber?: string;
|
|
32
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The International Bank Account Number (IBAN).
|
|
38
|
+
*/
|
|
33
39
|
iban?: string;
|
|
34
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* The routing number.
|
|
42
|
+
*/
|
|
35
43
|
routingNumber?: string;
|
|
36
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* The bank's SWIFT Business Identifier Code (BIC).
|
|
46
|
+
*/
|
|
37
47
|
swift?: string;
|
|
38
48
|
/**
|
|
39
49
|
* @param {PaymentDetailsConstructor} constructor Constructor parameters.
|
|
@@ -9,15 +9,25 @@ export interface PositionFieldConstructor {
|
|
|
9
9
|
* A field indicating a position or area on the document.
|
|
10
10
|
*/
|
|
11
11
|
export declare class PositionField {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Straight rectangle.
|
|
14
|
+
*/
|
|
13
15
|
boundingBox: Polygon;
|
|
14
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Free polygon with up to 30 vertices.
|
|
18
|
+
*/
|
|
15
19
|
polygon: Polygon;
|
|
16
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Free polygon with 4 vertices.
|
|
22
|
+
*/
|
|
17
23
|
quadrangle: Polygon;
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Rectangle that may be oriented (can go beyond the canvas).
|
|
26
|
+
*/
|
|
19
27
|
rectangle: Polygon;
|
|
20
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* The document page on which the information was found.
|
|
30
|
+
*/
|
|
21
31
|
pageId?: number;
|
|
22
32
|
constructor({ prediction, pageId }: PositionFieldConstructor);
|
|
23
33
|
/**
|
|
@@ -16,15 +16,25 @@ interface TaxConstructor extends BaseFieldConstructor {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class TaxField extends Field {
|
|
18
18
|
#private;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The tax amount.
|
|
21
|
+
*/
|
|
20
22
|
value?: number;
|
|
21
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The tax rate.
|
|
25
|
+
*/
|
|
22
26
|
rate?: number;
|
|
23
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The tax code (HST, GST... for Canadian; City Tax, State tax for US, etc..).
|
|
29
|
+
*/
|
|
24
30
|
code?: string;
|
|
25
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* The tax base
|
|
33
|
+
*/
|
|
26
34
|
base?: number;
|
|
27
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* The document page on which the information was found.
|
|
37
|
+
*/
|
|
28
38
|
pageId: number;
|
|
29
39
|
/**
|
|
30
40
|
* @param {TaxConstructor} constructor Constructor parameters.
|
|
@@ -44,7 +54,9 @@ export declare class TaxField extends Field {
|
|
|
44
54
|
*/
|
|
45
55
|
export declare class Taxes extends Array<TaxField> {
|
|
46
56
|
#private;
|
|
47
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Populates the taxes collection from raw prediction entries.
|
|
59
|
+
*/
|
|
48
60
|
init(prediction: StringDict[] | undefined, pageId: number | undefined): this;
|
|
49
61
|
/**
|
|
50
62
|
* Default string representation.
|
|
@@ -16,13 +16,21 @@ export class TaxField extends Field {
|
|
|
16
16
|
constructor({ prediction = {}, valueKey = "value", rateKey = "rate", codeKey = "code", baseKey = "base", reconstructed = false, pageId = undefined, }) {
|
|
17
17
|
super({ prediction, valueKey, reconstructed, pageId });
|
|
18
18
|
_TaxField_instances.add(this);
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The tax amount.
|
|
21
|
+
*/
|
|
20
22
|
this.value = undefined;
|
|
21
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The tax rate.
|
|
25
|
+
*/
|
|
22
26
|
this.rate = undefined;
|
|
23
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The tax code (HST, GST... for Canadian; City Tax, State tax for US, etc..).
|
|
29
|
+
*/
|
|
24
30
|
this.code = undefined;
|
|
25
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* The tax base
|
|
33
|
+
*/
|
|
26
34
|
this.base = undefined;
|
|
27
35
|
this.rate = +parseFloat(prediction[rateKey]);
|
|
28
36
|
if (isNaN(this.rate))
|
|
@@ -86,7 +94,9 @@ export class Taxes extends Array {
|
|
|
86
94
|
super(...arguments);
|
|
87
95
|
_Taxes_instances.add(this);
|
|
88
96
|
}
|
|
89
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Populates the taxes collection from raw prediction entries.
|
|
99
|
+
*/
|
|
90
100
|
init(prediction = [], pageId) {
|
|
91
101
|
for (const entry of prediction) {
|
|
92
102
|
this.push(new TaxField({
|
|
@@ -10,9 +10,13 @@ export interface FieldConstructor {
|
|
|
10
10
|
* A field containing a text value.
|
|
11
11
|
*/
|
|
12
12
|
export declare class StringField extends Field {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The value.
|
|
15
|
+
*/
|
|
14
16
|
value?: string;
|
|
15
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Value as it appears on the document.
|
|
19
|
+
*/
|
|
16
20
|
rawValue?: string;
|
|
17
21
|
constructor({ prediction, valueKey, reconstructed, pageId, }: FieldConstructor);
|
|
18
22
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { Polygon } from "../../../geometry/index.js";
|
|
2
2
|
import { StringDict } from "../../../parsing/index.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* OCR word item with text, confidence, and location polygon.
|
|
5
|
+
*/
|
|
4
6
|
export declare class Word {
|
|
5
7
|
/**
|
|
6
8
|
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
7
9
|
* the field in the document.
|
|
8
10
|
*/
|
|
9
11
|
polygon: Polygon;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* OCR text content for the word.
|
|
14
|
+
*/
|
|
11
15
|
text: string;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Confidence score for the OCR word.
|
|
18
|
+
*/
|
|
13
19
|
confidence: number;
|
|
14
20
|
constructor(rawPrediction: StringDict);
|
|
15
21
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Polygon } from "../../../geometry/index.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* OCR word item with text, confidence, and location polygon.
|
|
4
|
+
*/
|
|
3
5
|
export class Word {
|
|
4
6
|
constructor(rawPrediction) {
|
|
5
7
|
this.polygon = new Polygon(...rawPrediction["polygon"]);
|