mindee 3.10.2 → 4.0.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 +19 -0
- package/README.md +103 -41
- package/package.json +6 -6
- package/src/cli.js +96 -70
- package/src/client.d.ts +34 -65
- package/src/client.js +108 -172
- package/src/geometry/boundingBox.d.ts +5 -0
- package/src/geometry/boundingBox.js +2 -0
- package/src/geometry/boundingBoxUtils.d.ts +22 -0
- package/src/geometry/boundingBoxUtils.js +66 -0
- package/src/geometry/index.d.ts +6 -0
- package/src/geometry/index.js +21 -0
- package/src/geometry/minMax.d.ts +4 -0
- package/src/geometry/minMax.js +2 -0
- package/src/geometry/point.d.ts +2 -0
- package/src/geometry/point.js +2 -0
- package/src/geometry/polygon.d.ts +4 -0
- package/src/geometry/polygon.js +7 -0
- package/src/{geometry.d.ts → geometry/polygonUtils.d.ts} +7 -32
- package/src/{geometry.js → geometry/polygonUtils.js} +41 -64
- package/src/http/endpoint.d.ts +44 -0
- package/src/http/endpoint.js +188 -0
- package/src/http/error.d.ts +2 -0
- package/src/http/error.js +9 -0
- package/src/http/index.d.ts +3 -0
- package/src/http/index.js +11 -0
- package/src/http/mindeeApi.d.ts +20 -0
- package/src/http/mindeeApi.js +73 -0
- package/src/index.d.ts +4 -4
- package/src/index.js +33 -26
- package/src/{inputs → input}/base.d.ts +4 -3
- package/src/{inputs → input}/base.js +9 -7
- package/src/{inputs → input}/index.d.ts +1 -1
- package/src/{inputs → input}/index.js +1 -2
- package/src/{inputs → input}/sources.d.ts +10 -11
- package/src/{inputs → input}/sources.js +9 -9
- package/src/parsing/common/apiRequest.d.ts +10 -0
- package/src/parsing/common/apiRequest.js +13 -0
- package/src/parsing/common/apiResponse.d.ts +6 -0
- package/src/parsing/common/apiResponse.js +10 -0
- package/src/parsing/common/asyncPredictResponse.d.ts +21 -0
- package/src/parsing/common/asyncPredictResponse.js +39 -0
- package/src/parsing/common/document.d.ts +13 -0
- package/src/parsing/common/document.js +34 -0
- package/src/parsing/common/extras/cropperExtra.d.ts +8 -0
- package/src/parsing/common/extras/cropperExtra.js +26 -0
- package/src/parsing/common/extras/extras.d.ts +11 -0
- package/src/parsing/common/extras/extras.js +18 -0
- package/src/parsing/common/index.d.ts +9 -0
- package/src/parsing/common/index.js +20 -0
- package/src/parsing/common/inference.d.ts +26 -0
- package/src/parsing/common/inference.js +56 -0
- package/src/parsing/common/mvisionV1.d.ts +8 -0
- package/src/parsing/common/mvisionV1.js +17 -0
- package/src/parsing/common/ocr.d.ts +8 -0
- package/src/parsing/common/ocr.js +13 -0
- package/src/parsing/common/ocrPage.d.ts +16 -0
- package/src/parsing/common/ocrPage.js +66 -0
- package/src/{fields → parsing/common}/orientation.d.ts +2 -2
- package/src/{fields → parsing/common}/orientation.js +4 -4
- package/src/parsing/common/page.d.ts +12 -0
- package/src/parsing/common/page.js +40 -0
- package/src/parsing/common/predictResponse.d.ts +6 -0
- package/src/parsing/common/predictResponse.js +12 -0
- package/src/parsing/common/prediction.d.ts +2 -0
- package/src/parsing/common/prediction.js +6 -0
- package/src/parsing/common/product.d.ts +4 -0
- package/src/parsing/common/product.js +2 -0
- package/src/parsing/common/stringDict.d.ts +3 -0
- package/src/parsing/common/stringDict.js +2 -0
- package/src/parsing/common/summaryHelper.d.ts +8 -0
- package/src/parsing/common/summaryHelper.js +22 -0
- package/src/parsing/custom/classificationField.d.ts +16 -0
- package/src/parsing/custom/classificationField.js +14 -0
- package/src/parsing/custom/index.d.ts +3 -0
- package/src/parsing/custom/index.js +12 -0
- package/src/{documents/custom/lineitems.d.ts → parsing/custom/lineItems.d.ts} +4 -4
- package/src/{documents/custom/lineitems.js → parsing/custom/lineItems.js} +11 -9
- package/src/{documents/custom/fields.d.ts → parsing/custom/listField.d.ts} +3 -16
- package/src/{documents/custom/fields.js → parsing/custom/listField.js} +4 -14
- package/src/parsing/index.d.ts +3 -0
- package/src/parsing/index.js +29 -0
- package/src/{fields → parsing/standard}/amount.d.ts +2 -2
- package/src/{fields → parsing/standard}/amount.js +5 -5
- package/src/{fields → parsing/standard}/base.d.ts +5 -5
- package/src/{fields → parsing/standard}/base.js +3 -2
- package/src/{fields → parsing/standard}/classification.d.ts +1 -1
- package/src/{fields → parsing/standard}/classification.js +3 -3
- package/src/{fields → parsing/standard}/companyRegistration.d.ts +1 -1
- package/src/parsing/standard/companyRegistration.js +14 -0
- package/src/{fields → parsing/standard}/date.d.ts +1 -1
- package/src/{fields → parsing/standard}/date.js +2 -2
- package/src/{fields → parsing/standard}/field.d.ts +3 -4
- package/src/{fields → parsing/standard}/field.js +6 -7
- package/src/parsing/standard/index.d.ts +12 -0
- package/src/parsing/standard/index.js +27 -0
- package/src/{fields → parsing/standard}/locale.d.ts +4 -4
- package/src/parsing/standard/locale.js +42 -0
- package/src/{fields → parsing/standard}/paymentDetails.d.ts +3 -3
- package/src/{fields → parsing/standard}/paymentDetails.js +11 -11
- package/src/{fields → parsing/standard}/position.d.ts +2 -2
- package/src/{fields → parsing/standard}/position.js +5 -5
- package/src/{fields → parsing/standard}/tax.d.ts +3 -3
- package/src/{fields → parsing/standard}/tax.js +3 -3
- package/src/{fields → parsing/standard}/text.d.ts +2 -2
- package/src/{fields → parsing/standard}/text.js +4 -4
- package/src/parsing/standard/word.d.ts +10 -0
- package/src/parsing/standard/word.js +2 -0
- package/src/pdf/pdfOperation.d.ts +1 -1
- package/src/pdf/pdfOperation.js +3 -3
- package/src/product/cropper/cropperV1.d.ts +9 -0
- package/src/product/cropper/cropperV1.js +16 -0
- package/src/product/cropper/cropperV1Document.d.ts +8 -0
- package/src/product/cropper/cropperV1Document.js +26 -0
- package/src/product/custom/customV1.d.ts +10 -0
- package/src/product/custom/customV1.js +17 -0
- package/src/product/custom/customV1Document.d.ts +9 -0
- package/src/product/custom/customV1Document.js +43 -0
- package/src/product/custom/customV1Page.d.ts +7 -0
- package/src/product/custom/customV1Page.js +24 -0
- package/src/product/eu/licensePlate/licensePlateV1.d.ts +9 -0
- package/src/product/eu/licensePlate/licensePlateV1.js +16 -0
- package/src/product/eu/licensePlate/licensePlateV1Document.d.ts +11 -0
- package/src/product/eu/licensePlate/licensePlateV1Document.js +25 -0
- package/src/product/financialDocument/financialDocumentV1.d.ts +9 -0
- package/src/product/financialDocument/financialDocumentV1.js +16 -0
- package/src/{documents/financialDocument/financialDocumentV1.d.ts → product/financialDocument/financialDocumentV1Document.d.ts} +43 -44
- package/src/product/financialDocument/financialDocumentV1Document.js +158 -0
- package/src/{documents → product}/financialDocument/financialDocumentV1LineItem.d.ts +8 -8
- package/src/{documents → product}/financialDocument/financialDocumentV1LineItem.js +35 -34
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +9 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1.js +16 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1Document.d.ts +15 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV1Document.js +31 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV2.d.ts +9 -0
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV2.js +16 -0
- package/src/{documents → product}/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +5 -5
- package/src/{documents → product}/fr/bankAccountDetails/bankAccountDetailsV2Bban.js +1 -1
- package/src/{documents/fr/bankAccountDetails/bankAccountDetailsV2.d.ts → product/fr/bankAccountDetails/bankAccountDetailsV2Document.d.ts} +7 -7
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV2Document.js +37 -0
- package/src/product/fr/carteVitale/carteVitaleV1.d.ts +9 -0
- package/src/product/fr/carteVitale/carteVitaleV1.js +16 -0
- package/src/product/fr/carteVitale/carteVitaleV1Document.d.ts +17 -0
- package/src/product/fr/carteVitale/carteVitaleV1Document.js +40 -0
- package/src/product/fr/idCard/idCardV1.d.ts +10 -0
- package/src/product/fr/idCard/idCardV1.js +17 -0
- package/src/product/fr/idCard/idCardV1Document.d.ts +29 -0
- package/src/product/fr/idCard/idCardV1Document.js +70 -0
- package/src/product/fr/idCard/idCardV1Page.d.ts +12 -0
- package/src/product/fr/idCard/idCardV1Page.js +23 -0
- package/src/{documents → product}/index.d.ts +2 -7
- package/src/{documents → product}/index.js +3 -14
- package/src/product/invoice/invoiceV4.d.ts +9 -0
- package/src/product/invoice/invoiceV4.js +16 -0
- package/src/product/invoice/invoiceV4Document.d.ts +44 -0
- package/src/product/invoice/invoiceV4Document.js +146 -0
- package/src/{documents/invoice/invoiceLineItem.d.ts → product/invoice/invoiceV4LineItem.d.ts} +10 -8
- package/src/product/invoice/invoiceV4LineItem.js +101 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1.d.ts +9 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1.js +16 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +8 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.js +23 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.d.ts +7 -0
- package/src/product/invoiceSplitter/invoiceSplitterV1PageGroup.js +14 -0
- package/src/product/passport/passportV1.d.ts +9 -0
- package/src/product/passport/passportV1.js +16 -0
- package/src/product/passport/passportV1Document.d.ts +31 -0
- package/src/product/passport/passportV1Document.js +75 -0
- package/src/product/proofOfAddress/proofOfAddressV1.d.ts +9 -0
- package/src/product/proofOfAddress/proofOfAddressV1.js +16 -0
- package/src/product/proofOfAddress/proofOfAddressV1Document.d.ts +27 -0
- package/src/product/proofOfAddress/proofOfAddressV1Document.js +72 -0
- package/src/product/receipt/receiptV4.d.ts +9 -0
- package/src/product/receipt/receiptV4.js +15 -0
- package/src/{documents/receipt/receiptV4.d.ts → product/receipt/receiptV4Document.d.ts} +12 -12
- package/src/product/receipt/receiptV4Document.js +67 -0
- package/src/product/receipt/receiptV5.d.ts +9 -0
- package/src/product/receipt/receiptV5.js +16 -0
- package/src/{documents/receipt/receiptV5.d.ts → product/receipt/receiptV5Document.d.ts} +16 -17
- package/src/product/receipt/receiptV5Document.js +108 -0
- package/src/{documents → product}/receipt/receiptV5LineItem.d.ts +5 -5
- package/src/{documents → product}/receipt/receiptV5LineItem.js +20 -19
- package/src/product/us/bankCheck/bankCheckV1.d.ts +10 -0
- package/src/product/us/bankCheck/bankCheckV1.js +17 -0
- package/src/product/us/bankCheck/bankCheckV1Document.d.ts +21 -0
- package/src/product/us/bankCheck/bankCheckV1Document.js +50 -0
- package/src/product/us/bankCheck/bankCheckV1Page.d.ts +14 -0
- package/src/product/us/bankCheck/bankCheckV1Page.js +32 -0
- package/src/product/us/driverLicense/driverLicenseV1.d.ts +10 -0
- package/src/product/us/driverLicense/driverLicenseV1.js +17 -0
- package/src/product/us/driverLicense/driverLicenseV1Document.d.ts +43 -0
- package/src/product/us/driverLicense/driverLicenseV1Document.js +101 -0
- package/src/product/us/driverLicense/driverLicenseV1Page.d.ts +14 -0
- package/src/product/us/driverLicense/driverLicenseV1Page.js +29 -0
- package/src/product/us/index.d.ts +2 -0
- package/src/product/us/index.js +7 -0
- package/src/api/documentResponse.d.ts +0 -25
- package/src/api/documentResponse.js +0 -50
- package/src/api/endpoint.d.ts +0 -63
- package/src/api/endpoint.js +0 -216
- package/src/api/index.d.ts +0 -3
- package/src/api/index.js +0 -13
- package/src/api/predictResponse.d.ts +0 -33
- package/src/api/predictResponse.js +0 -52
- package/src/documents/cropper/cropperV1.d.ts +0 -7
- package/src/documents/cropper/cropperV1.js +0 -35
- package/src/documents/custom/customV1.d.ts +0 -10
- package/src/documents/custom/customV1.js +0 -53
- package/src/documents/document.d.ts +0 -47
- package/src/documents/document.js +0 -76
- package/src/documents/documentConfig.d.ts +0 -42
- package/src/documents/documentConfig.js +0 -118
- package/src/documents/eu/licensePlate/licensePlateV1.d.ts +0 -8
- package/src/documents/eu/licensePlate/licensePlateV1.js +0 -32
- package/src/documents/financialDocument/financialDocumentV0.d.ts +0 -28
- package/src/documents/financialDocument/financialDocumentV0.js +0 -140
- package/src/documents/financialDocument/financialDocumentV1.js +0 -197
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +0 -13
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV1.js +0 -39
- package/src/documents/fr/bankAccountDetails/bankAccountDetailsV2.js +0 -48
- package/src/documents/fr/carteVitale/carteVitaleV1.d.ts +0 -14
- package/src/documents/fr/carteVitale/carteVitaleV1.js +0 -45
- package/src/documents/fr/idCard/idCardV1.d.ts +0 -28
- package/src/documents/fr/idCard/idCardV1.js +0 -79
- package/src/documents/invoice/checks.d.ts +0 -5
- package/src/documents/invoice/checks.js +0 -87
- package/src/documents/invoice/invoiceLineItem.js +0 -66
- package/src/documents/invoice/invoiceV3.d.ts +0 -49
- package/src/documents/invoice/invoiceV3.js +0 -156
- package/src/documents/invoice/invoiceV4.d.ts +0 -45
- package/src/documents/invoice/invoiceV4.js +0 -166
- package/src/documents/invoice/reconstruction.d.ts +0 -6
- package/src/documents/invoice/reconstruction.js +0 -78
- package/src/documents/invoiceSplitter/invoiceSplitterV1.d.ts +0 -14
- package/src/documents/invoiceSplitter/invoiceSplitterV1.js +0 -47
- package/src/documents/mindeeVision/mindeeVisionV1.d.ts +0 -8
- package/src/documents/mindeeVision/mindeeVisionV1.js +0 -29
- package/src/documents/passport/passportV1.d.ts +0 -43
- package/src/documents/passport/passportV1.js +0 -220
- package/src/documents/proofOfAddress/proofOfAddressV1.d.ts +0 -24
- package/src/documents/proofOfAddress/proofOfAddressV1.js +0 -77
- package/src/documents/receipt/receiptV3.d.ts +0 -25
- package/src/documents/receipt/receiptV3.js +0 -136
- package/src/documents/receipt/receiptV4.js +0 -78
- package/src/documents/receipt/receiptV5.js +0 -137
- package/src/documents/us/bankCheck/bankCheckV1.d.ts +0 -22
- package/src/documents/us/bankCheck/bankCheckV1.js +0 -63
- package/src/documents/us/index.d.ts +0 -1
- package/src/documents/us/index.js +0 -5
- package/src/fields/companyRegistration.js +0 -14
- package/src/fields/fullText.d.ts +0 -27
- package/src/fields/fullText.js +0 -92
- package/src/fields/index.d.ts +0 -12
- package/src/fields/index.js +0 -28
- package/src/fields/locale.js +0 -45
- package/src/math/index.d.ts +0 -1
- package/src/math/index.js +0 -5
- package/src/math/precision.d.ts +0 -1
- package/src/math/precision.js +0 -13
- /package/src/{inputs → input}/pageOptions.d.ts +0 -0
- /package/src/{inputs → input}/pageOptions.js +0 -0
- /package/src/{documents → product}/eu/index.d.ts +0 -0
- /package/src/{documents → product}/eu/index.js +0 -0
- /package/src/{documents → product}/fr/index.d.ts +0 -0
- /package/src/{documents → product}/fr/index.js +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var _InvoiceV4LineItem_instances, _InvoiceV4LineItem_printableValues;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.InvoiceV4LineItem = void 0;
|
|
10
|
+
const standard_1 = require("../../parsing/standard");
|
|
11
|
+
class InvoiceV4LineItem {
|
|
12
|
+
constructor(rawPrediction) {
|
|
13
|
+
_InvoiceV4LineItem_instances.add(this);
|
|
14
|
+
/** Confidence score */
|
|
15
|
+
this.confidence = 0.0;
|
|
16
|
+
/**
|
|
17
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
18
|
+
* the field in the document.
|
|
19
|
+
*/
|
|
20
|
+
this.polygon = [];
|
|
21
|
+
this.productCode = rawPrediction["product_code"];
|
|
22
|
+
this.description =
|
|
23
|
+
rawPrediction["description"] !== undefined
|
|
24
|
+
? rawPrediction["description"]
|
|
25
|
+
: "";
|
|
26
|
+
this.quantity = +parseFloat(rawPrediction["quantity"]).toFixed(3);
|
|
27
|
+
if (isNaN(this.quantity)) {
|
|
28
|
+
this.quantity = undefined;
|
|
29
|
+
}
|
|
30
|
+
this.unitPrice = +parseFloat(rawPrediction["unit_price"]).toFixed(3);
|
|
31
|
+
if (isNaN(this.unitPrice)) {
|
|
32
|
+
this.unitPrice = undefined;
|
|
33
|
+
}
|
|
34
|
+
this.totalAmount = +parseFloat(rawPrediction["total_amount"]).toFixed(3);
|
|
35
|
+
if (isNaN(this.totalAmount)) {
|
|
36
|
+
this.totalAmount = undefined;
|
|
37
|
+
}
|
|
38
|
+
this.taxRate = +parseFloat(rawPrediction["tax_rate"]).toFixed(3);
|
|
39
|
+
if (isNaN(this.taxRate)) {
|
|
40
|
+
this.taxRate = undefined;
|
|
41
|
+
}
|
|
42
|
+
this.taxAmount = +parseFloat(rawPrediction["tax_amount"]).toFixed(3);
|
|
43
|
+
if (isNaN(this.taxAmount)) {
|
|
44
|
+
this.taxAmount = undefined;
|
|
45
|
+
}
|
|
46
|
+
this.pageId = rawPrediction["page_id"];
|
|
47
|
+
this.confidence = rawPrediction["confidence"]
|
|
48
|
+
? rawPrediction["confidence"]
|
|
49
|
+
: 0.0;
|
|
50
|
+
if (rawPrediction["polygon"]) {
|
|
51
|
+
this.polygon = rawPrediction["polygon"];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
toTableLine() {
|
|
55
|
+
const printable = __classPrivateFieldGet(this, _InvoiceV4LineItem_instances, "m", _InvoiceV4LineItem_printableValues).call(this);
|
|
56
|
+
return ("| " +
|
|
57
|
+
printable.productCode.padEnd(20) +
|
|
58
|
+
" | " +
|
|
59
|
+
printable.quantity.padEnd(7) +
|
|
60
|
+
" | " +
|
|
61
|
+
printable.unitPrice.padEnd(7) +
|
|
62
|
+
" | " +
|
|
63
|
+
printable.totalAmount.padEnd(8) +
|
|
64
|
+
" | " +
|
|
65
|
+
printable.tax.padEnd(16) +
|
|
66
|
+
" | " +
|
|
67
|
+
printable.description.padEnd(36) +
|
|
68
|
+
" |");
|
|
69
|
+
}
|
|
70
|
+
toString() {
|
|
71
|
+
const printable = __classPrivateFieldGet(this, _InvoiceV4LineItem_instances, "m", _InvoiceV4LineItem_printableValues).call(this);
|
|
72
|
+
return ("Code: " +
|
|
73
|
+
printable.productCode +
|
|
74
|
+
", Quantity: " +
|
|
75
|
+
printable.quantity +
|
|
76
|
+
", Price: " +
|
|
77
|
+
printable.unitPrice +
|
|
78
|
+
", Amount: " +
|
|
79
|
+
printable.totalAmount +
|
|
80
|
+
", Tax (Rate): " +
|
|
81
|
+
printable.tax +
|
|
82
|
+
" Description: " +
|
|
83
|
+
printable.description).trim();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.InvoiceV4LineItem = InvoiceV4LineItem;
|
|
87
|
+
_InvoiceV4LineItem_instances = new WeakSet(), _InvoiceV4LineItem_printableValues = function _InvoiceV4LineItem_printableValues() {
|
|
88
|
+
return {
|
|
89
|
+
productCode: this.productCode ?? "",
|
|
90
|
+
quantity: this.quantity !== undefined ? (0, standard_1.floatToString)(this.quantity) : "",
|
|
91
|
+
unitPrice: this.unitPrice !== undefined ? (0, standard_1.floatToString)(this.unitPrice) : "",
|
|
92
|
+
totalAmount: this.totalAmount !== undefined ? (0, standard_1.floatToString)(this.totalAmount) : "",
|
|
93
|
+
tax: (this.taxAmount !== undefined ? (0, standard_1.floatToString)(this.taxAmount) : "") +
|
|
94
|
+
(this.taxRate !== undefined
|
|
95
|
+
? " (" + (0, standard_1.floatToString)(this.taxRate) + "%)"
|
|
96
|
+
: ""),
|
|
97
|
+
description: this.description.length > 33
|
|
98
|
+
? this.description.substring(0, 33) + "..."
|
|
99
|
+
: this.description,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
|
+
import { InvoiceSplitterV1Document } from "./invoiceSplitterV1Document";
|
|
3
|
+
export declare class InvoiceSplitterV1 extends Inference {
|
|
4
|
+
endpointName: string;
|
|
5
|
+
endpointVersion: string;
|
|
6
|
+
prediction: InvoiceSplitterV1Document;
|
|
7
|
+
pages: Page<InvoiceSplitterV1Document>[];
|
|
8
|
+
constructor(rawPrediction: StringDict);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvoiceSplitterV1 = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const invoiceSplitterV1Document_1 = require("./invoiceSplitterV1Document");
|
|
6
|
+
class InvoiceSplitterV1 extends common_1.Inference {
|
|
7
|
+
constructor(rawPrediction) {
|
|
8
|
+
super(rawPrediction);
|
|
9
|
+
this.endpointName = "invoice_splitter";
|
|
10
|
+
this.endpointVersion = "1";
|
|
11
|
+
this.pages = [];
|
|
12
|
+
this.prediction = new invoiceSplitterV1Document_1.InvoiceSplitterV1Document(rawPrediction["prediction"]);
|
|
13
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(invoiceSplitterV1Document_1.InvoiceSplitterV1Document, page, page["id"], page["orientation"]));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.InvoiceSplitterV1 = InvoiceSplitterV1;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Inference, StringDict } from "../../parsing/common";
|
|
2
|
+
import { PageGroup } from "./invoiceSplitterV1PageGroup";
|
|
3
|
+
export declare class InvoiceSplitterV1Document extends Inference {
|
|
4
|
+
/** List of page indexes that belong to the same invoice in the PDF. */
|
|
5
|
+
invoicePageGroups: PageGroup[];
|
|
6
|
+
constructor(rawPrediction: StringDict);
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvoiceSplitterV1Document = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const invoiceSplitterV1PageGroup_1 = require("./invoiceSplitterV1PageGroup");
|
|
6
|
+
class InvoiceSplitterV1Document extends common_1.Inference {
|
|
7
|
+
constructor(rawPrediction) {
|
|
8
|
+
super(rawPrediction);
|
|
9
|
+
/** List of page indexes that belong to the same invoice in the PDF. */
|
|
10
|
+
this.invoicePageGroups = [];
|
|
11
|
+
rawPrediction["invoice_page_groups"] &&
|
|
12
|
+
rawPrediction["invoice_page_groups"].forEach((prediction) => this.invoicePageGroups.push(new invoiceSplitterV1PageGroup_1.PageGroup(prediction)));
|
|
13
|
+
}
|
|
14
|
+
toString() {
|
|
15
|
+
const invoicePageGroups = this.invoicePageGroups
|
|
16
|
+
.map((item) => "\n " + item.toString())
|
|
17
|
+
.join("")
|
|
18
|
+
.trimEnd();
|
|
19
|
+
const outStr = `:Invoice Page Groups:${invoicePageGroups}`;
|
|
20
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.InvoiceSplitterV1Document = InvoiceSplitterV1Document;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageGroup = void 0;
|
|
4
|
+
class PageGroup {
|
|
5
|
+
constructor(prediction) {
|
|
6
|
+
this.pageIndexes = [];
|
|
7
|
+
this.pageIndexes = prediction.page_indexes;
|
|
8
|
+
this.confidence = prediction["confidence"];
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return `:Page indexes: ${this.pageIndexes.join(", ")}`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.PageGroup = PageGroup;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
|
+
import { PassportV1Document } from "./passportV1Document";
|
|
3
|
+
export declare class PassportV1 extends Inference {
|
|
4
|
+
endpointName: string;
|
|
5
|
+
endpointVersion: string;
|
|
6
|
+
prediction: PassportV1Document;
|
|
7
|
+
pages: Page<PassportV1Document>[];
|
|
8
|
+
constructor(rawPrediction: StringDict);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PassportV1 = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const passportV1Document_1 = require("./passportV1Document");
|
|
6
|
+
class PassportV1 extends common_1.Inference {
|
|
7
|
+
constructor(rawPrediction) {
|
|
8
|
+
super(rawPrediction);
|
|
9
|
+
this.endpointName = "passport";
|
|
10
|
+
this.endpointVersion = "1";
|
|
11
|
+
this.pages = [];
|
|
12
|
+
this.prediction = new passportV1Document_1.PassportV1Document(rawPrediction["prediction"]);
|
|
13
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(passportV1Document_1.PassportV1Document, page, page["id"], page["orientation"]));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.PassportV1 = PassportV1;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
|
+
import { DateField, StringField } from "../../parsing/standard";
|
|
3
|
+
/**
|
|
4
|
+
* Document data for Passport, API version 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PassportV1Document implements Prediction {
|
|
7
|
+
/** The date of birth of the passport holder. */
|
|
8
|
+
birthDate: DateField;
|
|
9
|
+
/** The place of birth of the passport holder. */
|
|
10
|
+
birthPlace: StringField;
|
|
11
|
+
/** The country's 3 letter code (ISO 3166-1 alpha-3). */
|
|
12
|
+
country: StringField;
|
|
13
|
+
/** The expiry date of the passport. */
|
|
14
|
+
expiryDate: DateField;
|
|
15
|
+
/** The gender of the passport holder. */
|
|
16
|
+
gender: StringField;
|
|
17
|
+
/** The given name(s) of the passport holder. */
|
|
18
|
+
givenNames: StringField[];
|
|
19
|
+
/** The passport's identification number. */
|
|
20
|
+
idNumber: StringField;
|
|
21
|
+
/** The date the passport was issued. */
|
|
22
|
+
issuanceDate: DateField;
|
|
23
|
+
/** Machine Readable Zone, first line */
|
|
24
|
+
mrz1: StringField;
|
|
25
|
+
/** Machine Readable Zone, second line */
|
|
26
|
+
mrz2: StringField;
|
|
27
|
+
/** The surname of the passport holder. */
|
|
28
|
+
surname: StringField;
|
|
29
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
30
|
+
toString(): string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PassportV1Document = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../parsing/standard");
|
|
6
|
+
/**
|
|
7
|
+
* Document data for Passport, API version 1.
|
|
8
|
+
*/
|
|
9
|
+
class PassportV1Document {
|
|
10
|
+
constructor(rawPrediction, pageId) {
|
|
11
|
+
/** The given name(s) of the passport holder. */
|
|
12
|
+
this.givenNames = [];
|
|
13
|
+
this.birthDate = new standard_1.DateField({
|
|
14
|
+
prediction: rawPrediction["birth_date"],
|
|
15
|
+
pageId: pageId,
|
|
16
|
+
});
|
|
17
|
+
this.birthPlace = new standard_1.StringField({
|
|
18
|
+
prediction: rawPrediction["birth_place"],
|
|
19
|
+
pageId: pageId,
|
|
20
|
+
});
|
|
21
|
+
this.country = new standard_1.StringField({
|
|
22
|
+
prediction: rawPrediction["country"],
|
|
23
|
+
pageId: pageId,
|
|
24
|
+
});
|
|
25
|
+
this.expiryDate = new standard_1.DateField({
|
|
26
|
+
prediction: rawPrediction["expiry_date"],
|
|
27
|
+
pageId: pageId,
|
|
28
|
+
});
|
|
29
|
+
this.gender = new standard_1.StringField({
|
|
30
|
+
prediction: rawPrediction["gender"],
|
|
31
|
+
pageId: pageId,
|
|
32
|
+
});
|
|
33
|
+
rawPrediction["given_names"] &&
|
|
34
|
+
rawPrediction["given_names"].map((itemPrediction) => this.givenNames.push(new standard_1.StringField({
|
|
35
|
+
prediction: itemPrediction,
|
|
36
|
+
pageId: pageId,
|
|
37
|
+
})));
|
|
38
|
+
this.idNumber = new standard_1.StringField({
|
|
39
|
+
prediction: rawPrediction["id_number"],
|
|
40
|
+
pageId: pageId,
|
|
41
|
+
});
|
|
42
|
+
this.issuanceDate = new standard_1.DateField({
|
|
43
|
+
prediction: rawPrediction["issuance_date"],
|
|
44
|
+
pageId: pageId,
|
|
45
|
+
});
|
|
46
|
+
this.mrz1 = new standard_1.StringField({
|
|
47
|
+
prediction: rawPrediction["mrz1"],
|
|
48
|
+
pageId: pageId,
|
|
49
|
+
});
|
|
50
|
+
this.mrz2 = new standard_1.StringField({
|
|
51
|
+
prediction: rawPrediction["mrz2"],
|
|
52
|
+
pageId: pageId,
|
|
53
|
+
});
|
|
54
|
+
this.surname = new standard_1.StringField({
|
|
55
|
+
prediction: rawPrediction["surname"],
|
|
56
|
+
pageId: pageId,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
toString() {
|
|
60
|
+
const givenNames = this.givenNames.join("\n ");
|
|
61
|
+
const outStr = `:Country Code: ${this.country}
|
|
62
|
+
:ID Number: ${this.idNumber}
|
|
63
|
+
:Given Name(s): ${givenNames}
|
|
64
|
+
:Surname: ${this.surname}
|
|
65
|
+
:Date of Birth: ${this.birthDate}
|
|
66
|
+
:Place of Birth: ${this.birthPlace}
|
|
67
|
+
:Gender: ${this.gender}
|
|
68
|
+
:Date of Issue: ${this.issuanceDate}
|
|
69
|
+
:Expiry Date: ${this.expiryDate}
|
|
70
|
+
:MRZ Line 1: ${this.mrz1}
|
|
71
|
+
:MRZ Line 2: ${this.mrz2}`.trimEnd();
|
|
72
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.PassportV1Document = PassportV1Document;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
|
+
import { ProofOfAddressV1Document } from "./proofOfAddressV1Document";
|
|
3
|
+
export declare class ProofOfAddressV1 extends Inference {
|
|
4
|
+
endpointName: string;
|
|
5
|
+
endpointVersion: string;
|
|
6
|
+
prediction: ProofOfAddressV1Document;
|
|
7
|
+
pages: Page<ProofOfAddressV1Document>[];
|
|
8
|
+
constructor(rawPrediction: StringDict);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProofOfAddressV1 = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const proofOfAddressV1Document_1 = require("./proofOfAddressV1Document");
|
|
6
|
+
class ProofOfAddressV1 extends common_1.Inference {
|
|
7
|
+
constructor(rawPrediction) {
|
|
8
|
+
super(rawPrediction);
|
|
9
|
+
this.endpointName = "proof_of_address";
|
|
10
|
+
this.endpointVersion = "1";
|
|
11
|
+
this.pages = [];
|
|
12
|
+
this.prediction = new proofOfAddressV1Document_1.ProofOfAddressV1Document(rawPrediction["prediction"]);
|
|
13
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(proofOfAddressV1Document_1.ProofOfAddressV1Document, page, page["id"], page["orientation"]));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ProofOfAddressV1 = ProofOfAddressV1;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
|
+
import { CompanyRegistrationField, DateField, LocaleField, StringField } from "../../parsing/standard";
|
|
3
|
+
/**
|
|
4
|
+
* Document data for Proof of Address, API version 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ProofOfAddressV1Document implements Prediction {
|
|
7
|
+
/** The date the document was issued. */
|
|
8
|
+
date: DateField;
|
|
9
|
+
/** List of dates found on the document. */
|
|
10
|
+
dates: DateField[];
|
|
11
|
+
/** The address of the document's issuer. */
|
|
12
|
+
issuerAddress: StringField;
|
|
13
|
+
/** List of company registrations found for the issuer. */
|
|
14
|
+
issuerCompanyRegistration: CompanyRegistrationField[];
|
|
15
|
+
/** The name of the person or company issuing the document. */
|
|
16
|
+
issuerName: StringField;
|
|
17
|
+
/** The locale detected on the document. */
|
|
18
|
+
locale: LocaleField;
|
|
19
|
+
/** The address of the recipient. */
|
|
20
|
+
recipientAddress: StringField;
|
|
21
|
+
/** List of company registrations found for the recipient. */
|
|
22
|
+
recipientCompanyRegistration: CompanyRegistrationField[];
|
|
23
|
+
/** The name of the person or company receiving the document. */
|
|
24
|
+
recipientName: StringField;
|
|
25
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
26
|
+
toString(): string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProofOfAddressV1Document = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../parsing/standard");
|
|
6
|
+
/**
|
|
7
|
+
* Document data for Proof of Address, API version 1.
|
|
8
|
+
*/
|
|
9
|
+
class ProofOfAddressV1Document {
|
|
10
|
+
constructor(rawPrediction, pageId) {
|
|
11
|
+
/** List of dates found on the document. */
|
|
12
|
+
this.dates = [];
|
|
13
|
+
/** List of company registrations found for the issuer. */
|
|
14
|
+
this.issuerCompanyRegistration = [];
|
|
15
|
+
/** List of company registrations found for the recipient. */
|
|
16
|
+
this.recipientCompanyRegistration = [];
|
|
17
|
+
this.date = new standard_1.DateField({
|
|
18
|
+
prediction: rawPrediction["date"],
|
|
19
|
+
pageId: pageId,
|
|
20
|
+
});
|
|
21
|
+
rawPrediction["dates"] &&
|
|
22
|
+
rawPrediction["dates"].map((itemPrediction) => this.dates.push(new standard_1.DateField({
|
|
23
|
+
prediction: itemPrediction,
|
|
24
|
+
pageId: pageId,
|
|
25
|
+
})));
|
|
26
|
+
this.issuerAddress = new standard_1.StringField({
|
|
27
|
+
prediction: rawPrediction["issuer_address"],
|
|
28
|
+
pageId: pageId,
|
|
29
|
+
});
|
|
30
|
+
rawPrediction["issuer_company_registration"] &&
|
|
31
|
+
rawPrediction["issuer_company_registration"].map((itemPrediction) => this.issuerCompanyRegistration.push(new standard_1.CompanyRegistrationField({
|
|
32
|
+
prediction: itemPrediction,
|
|
33
|
+
pageId: pageId,
|
|
34
|
+
})));
|
|
35
|
+
this.issuerName = new standard_1.StringField({
|
|
36
|
+
prediction: rawPrediction["issuer_name"],
|
|
37
|
+
pageId: pageId,
|
|
38
|
+
});
|
|
39
|
+
this.locale = new standard_1.LocaleField({
|
|
40
|
+
prediction: rawPrediction["locale"],
|
|
41
|
+
});
|
|
42
|
+
this.recipientAddress = new standard_1.StringField({
|
|
43
|
+
prediction: rawPrediction["recipient_address"],
|
|
44
|
+
pageId: pageId,
|
|
45
|
+
});
|
|
46
|
+
rawPrediction["recipient_company_registration"] &&
|
|
47
|
+
rawPrediction["recipient_company_registration"].map((itemPrediction) => this.recipientCompanyRegistration.push(new standard_1.CompanyRegistrationField({
|
|
48
|
+
prediction: itemPrediction,
|
|
49
|
+
pageId: pageId,
|
|
50
|
+
})));
|
|
51
|
+
this.recipientName = new standard_1.StringField({
|
|
52
|
+
prediction: rawPrediction["recipient_name"],
|
|
53
|
+
pageId: pageId,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
toString() {
|
|
57
|
+
const issuerCompanyRegistration = this.issuerCompanyRegistration.join("\n ");
|
|
58
|
+
const recipientCompanyRegistration = this.recipientCompanyRegistration.join("\n ");
|
|
59
|
+
const dates = this.dates.join("\n ");
|
|
60
|
+
const outStr = `:Locale: ${this.locale}
|
|
61
|
+
:Issuer Name: ${this.issuerName}
|
|
62
|
+
:Issuer Company Registrations: ${issuerCompanyRegistration}
|
|
63
|
+
:Issuer Address: ${this.issuerAddress}
|
|
64
|
+
:Recipient Name: ${this.recipientName}
|
|
65
|
+
:Recipient Company Registrations: ${recipientCompanyRegistration}
|
|
66
|
+
:Recipient Address: ${this.recipientAddress}
|
|
67
|
+
:Dates: ${dates}
|
|
68
|
+
:Date of Issue: ${this.date}`.trimEnd();
|
|
69
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ProofOfAddressV1Document = ProofOfAddressV1Document;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
|
+
import { ReceiptV4Document } from "./receiptV4Document";
|
|
3
|
+
export declare class ReceiptV4 extends Inference {
|
|
4
|
+
endpointName: string;
|
|
5
|
+
endpointVersion: string;
|
|
6
|
+
prediction: ReceiptV4Document;
|
|
7
|
+
pages: Page<ReceiptV4Document>[];
|
|
8
|
+
constructor(rawPrediction: StringDict);
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReceiptV4 = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const receiptV4Document_1 = require("./receiptV4Document");
|
|
6
|
+
class ReceiptV4 extends common_1.Inference {
|
|
7
|
+
constructor(rawPrediction) {
|
|
8
|
+
super(rawPrediction);
|
|
9
|
+
this.endpointName = "expense_receipts";
|
|
10
|
+
this.endpointVersion = "4";
|
|
11
|
+
this.prediction = new receiptV4Document_1.ReceiptV4Document(rawPrediction["prediction"]);
|
|
12
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(receiptV4Document_1.ReceiptV4Document, page, page["id"], page["orientation"]));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ReceiptV4 = ReceiptV4;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ClassificationField,
|
|
3
|
-
export declare class
|
|
1
|
+
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
|
+
import { ClassificationField, AmountField, DateField, StringField, LocaleField, TaxField } from "../../parsing/standard";
|
|
3
|
+
export declare class ReceiptV4Document implements Prediction {
|
|
4
4
|
/** Where the purchase was made, the language, and the currency. */
|
|
5
|
-
locale:
|
|
5
|
+
locale: LocaleField;
|
|
6
6
|
/** The purchase date. */
|
|
7
7
|
date: DateField;
|
|
8
8
|
/** The receipt category among predefined classes. */
|
|
@@ -10,21 +10,21 @@ export declare class ReceiptV4 extends Document {
|
|
|
10
10
|
/** The receipt sub-category among predefined classes. */
|
|
11
11
|
subCategory: ClassificationField;
|
|
12
12
|
/** Whether the document is an expense receipt or a credit card receipt. */
|
|
13
|
-
documentType:
|
|
13
|
+
documentType: StringField;
|
|
14
14
|
/** The name of the supplier or merchant, as seen on the receipt. */
|
|
15
|
-
supplier:
|
|
15
|
+
supplier: StringField;
|
|
16
16
|
/** Time as seen on the receipt in HH:MM format. */
|
|
17
|
-
time:
|
|
17
|
+
time: StringField;
|
|
18
18
|
/** List of taxes detected on the receipt. */
|
|
19
19
|
taxes: TaxField[];
|
|
20
20
|
/** Total amount of tip and gratuity. */
|
|
21
|
-
tip:
|
|
21
|
+
tip: AmountField;
|
|
22
22
|
/** total spent including taxes, discounts, fees, tips, and gratuity. */
|
|
23
|
-
totalAmount:
|
|
23
|
+
totalAmount: AmountField;
|
|
24
24
|
/** Total amount of the purchase excluding taxes. */
|
|
25
|
-
totalNet:
|
|
25
|
+
totalNet: AmountField;
|
|
26
26
|
/** Total tax amount of the purchase. */
|
|
27
|
-
totalTax:
|
|
28
|
-
constructor(
|
|
27
|
+
totalTax: AmountField;
|
|
28
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
29
29
|
toString(): string;
|
|
30
30
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReceiptV4Document = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const standard_1 = require("../../parsing/standard");
|
|
6
|
+
class ReceiptV4Document {
|
|
7
|
+
constructor(rawPrediction, pageId) {
|
|
8
|
+
this.locale = new standard_1.LocaleField({
|
|
9
|
+
prediction: rawPrediction["locale"],
|
|
10
|
+
});
|
|
11
|
+
this.totalTax = new standard_1.AmountField({
|
|
12
|
+
prediction: rawPrediction["total_tax"],
|
|
13
|
+
pageId: pageId,
|
|
14
|
+
});
|
|
15
|
+
this.totalAmount = new standard_1.AmountField({
|
|
16
|
+
prediction: rawPrediction["total_amount"],
|
|
17
|
+
pageId: pageId,
|
|
18
|
+
});
|
|
19
|
+
this.totalNet = new standard_1.AmountField({
|
|
20
|
+
prediction: rawPrediction["total_net"],
|
|
21
|
+
pageId: pageId,
|
|
22
|
+
});
|
|
23
|
+
this.tip = new standard_1.AmountField({
|
|
24
|
+
prediction: rawPrediction["tip"],
|
|
25
|
+
pageId: pageId,
|
|
26
|
+
});
|
|
27
|
+
this.date = new standard_1.DateField({
|
|
28
|
+
prediction: rawPrediction["date"],
|
|
29
|
+
pageId: pageId,
|
|
30
|
+
});
|
|
31
|
+
this.category = new standard_1.ClassificationField({
|
|
32
|
+
prediction: rawPrediction["category"],
|
|
33
|
+
});
|
|
34
|
+
this.subCategory = new standard_1.ClassificationField({
|
|
35
|
+
prediction: rawPrediction["subcategory"],
|
|
36
|
+
});
|
|
37
|
+
this.documentType = new standard_1.StringField({
|
|
38
|
+
prediction: rawPrediction["document_type"],
|
|
39
|
+
pageId: pageId,
|
|
40
|
+
});
|
|
41
|
+
this.supplier = new standard_1.StringField({
|
|
42
|
+
prediction: rawPrediction["supplier"],
|
|
43
|
+
pageId: pageId,
|
|
44
|
+
});
|
|
45
|
+
this.time = new standard_1.StringField({
|
|
46
|
+
prediction: rawPrediction["time"],
|
|
47
|
+
pageId: pageId,
|
|
48
|
+
});
|
|
49
|
+
this.taxes = new standard_1.Taxes().init(rawPrediction["taxes"], pageId);
|
|
50
|
+
}
|
|
51
|
+
toString() {
|
|
52
|
+
const outStr = `:Locale: ${this.locale}
|
|
53
|
+
:Date: ${this.date}
|
|
54
|
+
:Category: ${this.category}
|
|
55
|
+
:Subcategory: ${this.subCategory}
|
|
56
|
+
:Document type: ${this.documentType}
|
|
57
|
+
:Time: ${this.time}
|
|
58
|
+
:Supplier name: ${this.supplier}
|
|
59
|
+
:Taxes: ${this.taxes}
|
|
60
|
+
:Total net: ${this.totalNet}
|
|
61
|
+
:Total tax: ${this.totalTax}
|
|
62
|
+
:Tip: ${this.tip}
|
|
63
|
+
:Total amount: ${this.totalAmount}`;
|
|
64
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.ReceiptV4Document = ReceiptV4Document;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../parsing/common";
|
|
2
|
+
import { ReceiptV5Document } from "./receiptV5Document";
|
|
3
|
+
export declare class ReceiptV5 extends Inference {
|
|
4
|
+
endpointName: string;
|
|
5
|
+
endpointVersion: string;
|
|
6
|
+
prediction: ReceiptV5Document;
|
|
7
|
+
pages: Page<ReceiptV5Document>[];
|
|
8
|
+
constructor(rawPrediction: StringDict);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReceiptV5 = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const receiptV5Document_1 = require("./receiptV5Document");
|
|
6
|
+
class ReceiptV5 extends common_1.Inference {
|
|
7
|
+
constructor(rawPrediction) {
|
|
8
|
+
super(rawPrediction);
|
|
9
|
+
this.endpointName = "expense_receipts";
|
|
10
|
+
this.endpointVersion = "5";
|
|
11
|
+
this.pages = [];
|
|
12
|
+
this.prediction = new receiptV5Document_1.ReceiptV5Document(rawPrediction["prediction"]);
|
|
13
|
+
this.pages = rawPrediction["pages"].map((page) => new common_1.Page(receiptV5Document_1.ReceiptV5Document, page, page["id"], page["orientation"]));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ReceiptV5 = ReceiptV5;
|