mindee 4.21.0 → 4.22.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 +1 -1
- package/src/cli.js +2 -2
- package/src/client.js +2 -2
- package/src/product/ind/indianPassport/indianPassportV1Document.d.ts +1 -1
- package/src/product/ind/indianPassport/indianPassportV1Document.js +1 -1
- package/src/product/us/index.d.ts +1 -0
- package/src/product/us/index.js +3 -1
- package/src/product/us/usMail/index.d.ts +1 -0
- package/src/product/us/usMail/index.js +3 -1
- package/src/product/us/usMail/internal.d.ts +4 -0
- package/src/product/us/usMail/internal.js +9 -1
- package/src/product/us/usMail/usMailV3.d.ts +16 -0
- package/src/product/us/usMail/usMailV3.js +27 -0
- package/src/product/us/usMail/usMailV3Document.d.ts +24 -0
- package/src/product/us/usMail/usMailV3Document.js +68 -0
- package/src/product/us/usMail/usMailV3RecipientAddress.d.ts +42 -0
- package/src/product/us/usMail/usMailV3RecipientAddress.js +128 -0
- package/src/product/us/usMail/usMailV3SenderAddress.d.ts +36 -0
- package/src/product/us/usMail/usMailV3SenderAddress.js +72 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -331,7 +331,7 @@ async function callEnqueueAndParse(productClass, command, inputPath, options) {
|
|
|
331
331
|
cropper: predictParams.cropper,
|
|
332
332
|
initialDelaySec: 2,
|
|
333
333
|
delaySec: 1.5,
|
|
334
|
-
maxRetries:
|
|
334
|
+
maxRetries: 80,
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
337
|
else {
|
|
@@ -341,7 +341,7 @@ async function callEnqueueAndParse(productClass, command, inputPath, options) {
|
|
|
341
341
|
cropper: predictParams.cropper,
|
|
342
342
|
initialDelaySec: 2,
|
|
343
343
|
delaySec: 1.5,
|
|
344
|
-
maxRetries:
|
|
344
|
+
maxRetries: 80,
|
|
345
345
|
});
|
|
346
346
|
if (!response.document) {
|
|
347
347
|
throw Error("Document could not be retrieved");
|
package/src/client.js
CHANGED
|
@@ -203,7 +203,7 @@ class Client {
|
|
|
203
203
|
pageOptions: undefined,
|
|
204
204
|
initialDelaySec: 2,
|
|
205
205
|
delaySec: 1.5,
|
|
206
|
-
maxRetries:
|
|
206
|
+
maxRetries: 80,
|
|
207
207
|
initialTimerOptions: undefined,
|
|
208
208
|
recurringTimerOptions: undefined,
|
|
209
209
|
}) {
|
|
@@ -339,7 +339,7 @@ _Client_instances = new WeakSet(), _Client_setAsyncParams = function _Client_set
|
|
|
339
339
|
const newAsyncParams = { ...asyncParams };
|
|
340
340
|
newAsyncParams.delaySec ?? (newAsyncParams.delaySec = 1.5);
|
|
341
341
|
newAsyncParams.initialDelaySec ?? (newAsyncParams.initialDelaySec = 2);
|
|
342
|
-
newAsyncParams.maxRetries ?? (newAsyncParams.maxRetries =
|
|
342
|
+
newAsyncParams.maxRetries ?? (newAsyncParams.maxRetries = 80);
|
|
343
343
|
if (newAsyncParams.delaySec < minDelaySec) {
|
|
344
344
|
throw Error(`Cannot set auto-parsing delay to less than ${minDelaySec} second(s).`);
|
|
345
345
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Prediction, StringDict } from "../../../parsing/common";
|
|
2
2
|
import { ClassificationField, DateField, StringField } from "../../../parsing/standard";
|
|
3
3
|
/**
|
|
4
|
-
* Passport - India API version 1.
|
|
4
|
+
* Passport - India API version 1.2 document data.
|
|
5
5
|
*/
|
|
6
6
|
export declare class IndianPassportV1Document implements Prediction {
|
|
7
7
|
/** The first line of the address of the passport holder. */
|
|
@@ -4,7 +4,7 @@ exports.IndianPassportV1Document = void 0;
|
|
|
4
4
|
const common_1 = require("../../../parsing/common");
|
|
5
5
|
const standard_1 = require("../../../parsing/standard");
|
|
6
6
|
/**
|
|
7
|
-
* Passport - India API version 1.
|
|
7
|
+
* Passport - India API version 1.2 document data.
|
|
8
8
|
*/
|
|
9
9
|
class IndianPassportV1Document {
|
|
10
10
|
constructor(rawPrediction, pageId) {
|
|
@@ -2,4 +2,5 @@ export { BankCheckV1 } from "./bankCheck/bankCheckV1";
|
|
|
2
2
|
export { DriverLicenseV1 } from "./driverLicense/driverLicenseV1";
|
|
3
3
|
export { HealthcareCardV1 } from "./healthcareCard/healthcareCardV1";
|
|
4
4
|
export { UsMailV2 } from "./usMail/usMailV2";
|
|
5
|
+
export { UsMailV3 } from "./usMail/usMailV3";
|
|
5
6
|
export { W9V1 } from "./w9/w9V1";
|
package/src/product/us/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.W9V1 = exports.UsMailV2 = exports.HealthcareCardV1 = exports.DriverLicenseV1 = exports.BankCheckV1 = void 0;
|
|
3
|
+
exports.W9V1 = exports.UsMailV3 = exports.UsMailV2 = exports.HealthcareCardV1 = exports.DriverLicenseV1 = exports.BankCheckV1 = void 0;
|
|
4
4
|
var bankCheckV1_1 = require("./bankCheck/bankCheckV1");
|
|
5
5
|
Object.defineProperty(exports, "BankCheckV1", { enumerable: true, get: function () { return bankCheckV1_1.BankCheckV1; } });
|
|
6
6
|
var driverLicenseV1_1 = require("./driverLicense/driverLicenseV1");
|
|
@@ -9,5 +9,7 @@ var healthcareCardV1_1 = require("./healthcareCard/healthcareCardV1");
|
|
|
9
9
|
Object.defineProperty(exports, "HealthcareCardV1", { enumerable: true, get: function () { return healthcareCardV1_1.HealthcareCardV1; } });
|
|
10
10
|
var usMailV2_1 = require("./usMail/usMailV2");
|
|
11
11
|
Object.defineProperty(exports, "UsMailV2", { enumerable: true, get: function () { return usMailV2_1.UsMailV2; } });
|
|
12
|
+
var usMailV3_1 = require("./usMail/usMailV3");
|
|
13
|
+
Object.defineProperty(exports, "UsMailV3", { enumerable: true, get: function () { return usMailV3_1.UsMailV3; } });
|
|
12
14
|
var w9V1_1 = require("./w9/w9V1");
|
|
13
15
|
Object.defineProperty(exports, "W9V1", { enumerable: true, get: function () { return w9V1_1.W9V1; } });
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UsMailV2 = void 0;
|
|
3
|
+
exports.UsMailV3 = exports.UsMailV2 = void 0;
|
|
4
4
|
var usMailV2_1 = require("./usMailV2");
|
|
5
5
|
Object.defineProperty(exports, "UsMailV2", { enumerable: true, get: function () { return usMailV2_1.UsMailV2; } });
|
|
6
|
+
var usMailV3_1 = require("./usMailV3");
|
|
7
|
+
Object.defineProperty(exports, "UsMailV3", { enumerable: true, get: function () { return usMailV3_1.UsMailV3; } });
|
|
@@ -2,3 +2,7 @@ export { UsMailV2 } from "./usMailV2";
|
|
|
2
2
|
export { UsMailV2Document } from "./usMailV2Document";
|
|
3
3
|
export { UsMailV2RecipientAddress } from "./usMailV2RecipientAddress";
|
|
4
4
|
export { UsMailV2SenderAddress } from "./usMailV2SenderAddress";
|
|
5
|
+
export { UsMailV3 } from "./usMailV3";
|
|
6
|
+
export { UsMailV3Document } from "./usMailV3Document";
|
|
7
|
+
export { UsMailV3RecipientAddress } from "./usMailV3RecipientAddress";
|
|
8
|
+
export { UsMailV3SenderAddress } from "./usMailV3SenderAddress";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UsMailV2SenderAddress = exports.UsMailV2RecipientAddress = exports.UsMailV2Document = exports.UsMailV2 = void 0;
|
|
3
|
+
exports.UsMailV3SenderAddress = exports.UsMailV3RecipientAddress = exports.UsMailV3Document = exports.UsMailV3 = exports.UsMailV2SenderAddress = exports.UsMailV2RecipientAddress = exports.UsMailV2Document = exports.UsMailV2 = void 0;
|
|
4
4
|
var usMailV2_1 = require("./usMailV2");
|
|
5
5
|
Object.defineProperty(exports, "UsMailV2", { enumerable: true, get: function () { return usMailV2_1.UsMailV2; } });
|
|
6
6
|
var usMailV2Document_1 = require("./usMailV2Document");
|
|
@@ -9,3 +9,11 @@ var usMailV2RecipientAddress_1 = require("./usMailV2RecipientAddress");
|
|
|
9
9
|
Object.defineProperty(exports, "UsMailV2RecipientAddress", { enumerable: true, get: function () { return usMailV2RecipientAddress_1.UsMailV2RecipientAddress; } });
|
|
10
10
|
var usMailV2SenderAddress_1 = require("./usMailV2SenderAddress");
|
|
11
11
|
Object.defineProperty(exports, "UsMailV2SenderAddress", { enumerable: true, get: function () { return usMailV2SenderAddress_1.UsMailV2SenderAddress; } });
|
|
12
|
+
var usMailV3_1 = require("./usMailV3");
|
|
13
|
+
Object.defineProperty(exports, "UsMailV3", { enumerable: true, get: function () { return usMailV3_1.UsMailV3; } });
|
|
14
|
+
var usMailV3Document_1 = require("./usMailV3Document");
|
|
15
|
+
Object.defineProperty(exports, "UsMailV3Document", { enumerable: true, get: function () { return usMailV3Document_1.UsMailV3Document; } });
|
|
16
|
+
var usMailV3RecipientAddress_1 = require("./usMailV3RecipientAddress");
|
|
17
|
+
Object.defineProperty(exports, "UsMailV3RecipientAddress", { enumerable: true, get: function () { return usMailV3RecipientAddress_1.UsMailV3RecipientAddress; } });
|
|
18
|
+
var usMailV3SenderAddress_1 = require("./usMailV3SenderAddress");
|
|
19
|
+
Object.defineProperty(exports, "UsMailV3SenderAddress", { enumerable: true, get: function () { return usMailV3SenderAddress_1.UsMailV3SenderAddress; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Inference, StringDict, Page } from "../../../parsing/common";
|
|
2
|
+
import { UsMailV3Document } from "./usMailV3Document";
|
|
3
|
+
/**
|
|
4
|
+
* US Mail API version 3 inference prediction.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UsMailV3 extends Inference {
|
|
7
|
+
/** The endpoint's name. */
|
|
8
|
+
endpointName: string;
|
|
9
|
+
/** The endpoint's version. */
|
|
10
|
+
endpointVersion: string;
|
|
11
|
+
/** The document-level prediction. */
|
|
12
|
+
prediction: UsMailV3Document;
|
|
13
|
+
/** The document's pages. */
|
|
14
|
+
pages: Page<UsMailV3Document>[];
|
|
15
|
+
constructor(rawPrediction: StringDict);
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsMailV3 = void 0;
|
|
4
|
+
const common_1 = require("../../../parsing/common");
|
|
5
|
+
const usMailV3Document_1 = require("./usMailV3Document");
|
|
6
|
+
/**
|
|
7
|
+
* US Mail API version 3 inference prediction.
|
|
8
|
+
*/
|
|
9
|
+
class UsMailV3 extends common_1.Inference {
|
|
10
|
+
constructor(rawPrediction) {
|
|
11
|
+
super(rawPrediction);
|
|
12
|
+
/** The endpoint's name. */
|
|
13
|
+
this.endpointName = "us_mail";
|
|
14
|
+
/** The endpoint's version. */
|
|
15
|
+
this.endpointVersion = "3";
|
|
16
|
+
/** The document's pages. */
|
|
17
|
+
this.pages = [];
|
|
18
|
+
this.prediction = new usMailV3Document_1.UsMailV3Document(rawPrediction["prediction"]);
|
|
19
|
+
rawPrediction["pages"].forEach((page) => {
|
|
20
|
+
if (page.prediction !== undefined && page.prediction !== null &&
|
|
21
|
+
Object.keys(page.prediction).length > 0) {
|
|
22
|
+
this.pages.push(new common_1.Page(usMailV3Document_1.UsMailV3Document, page, page["id"], page["orientation"]));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.UsMailV3 = UsMailV3;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Prediction, StringDict } from "../../../parsing/common";
|
|
2
|
+
import { UsMailV3SenderAddress } from "./usMailV3SenderAddress";
|
|
3
|
+
import { UsMailV3RecipientAddress } from "./usMailV3RecipientAddress";
|
|
4
|
+
import { BooleanField, StringField } from "../../../parsing/standard";
|
|
5
|
+
/**
|
|
6
|
+
* US Mail API version 3.0 document data.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UsMailV3Document implements Prediction {
|
|
9
|
+
/** Whether the mailing is marked as return to sender. */
|
|
10
|
+
isReturnToSender: BooleanField;
|
|
11
|
+
/** The addresses of the recipients. */
|
|
12
|
+
recipientAddresses: UsMailV3RecipientAddress[];
|
|
13
|
+
/** The names of the recipients. */
|
|
14
|
+
recipientNames: StringField[];
|
|
15
|
+
/** The address of the sender. */
|
|
16
|
+
senderAddress: UsMailV3SenderAddress;
|
|
17
|
+
/** The name of the sender. */
|
|
18
|
+
senderName: StringField;
|
|
19
|
+
constructor(rawPrediction: StringDict, pageId?: number);
|
|
20
|
+
/**
|
|
21
|
+
* Default string representation.
|
|
22
|
+
*/
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsMailV3Document = void 0;
|
|
4
|
+
const common_1 = require("../../../parsing/common");
|
|
5
|
+
const usMailV3SenderAddress_1 = require("./usMailV3SenderAddress");
|
|
6
|
+
const usMailV3RecipientAddress_1 = require("./usMailV3RecipientAddress");
|
|
7
|
+
const standard_1 = require("../../../parsing/standard");
|
|
8
|
+
/**
|
|
9
|
+
* US Mail API version 3.0 document data.
|
|
10
|
+
*/
|
|
11
|
+
class UsMailV3Document {
|
|
12
|
+
constructor(rawPrediction, pageId) {
|
|
13
|
+
/** The addresses of the recipients. */
|
|
14
|
+
this.recipientAddresses = [];
|
|
15
|
+
/** The names of the recipients. */
|
|
16
|
+
this.recipientNames = [];
|
|
17
|
+
this.isReturnToSender = new standard_1.BooleanField({
|
|
18
|
+
prediction: rawPrediction["is_return_to_sender"],
|
|
19
|
+
pageId: pageId,
|
|
20
|
+
});
|
|
21
|
+
rawPrediction["recipient_addresses"] &&
|
|
22
|
+
rawPrediction["recipient_addresses"].map((itemPrediction) => this.recipientAddresses.push(new usMailV3RecipientAddress_1.UsMailV3RecipientAddress({
|
|
23
|
+
prediction: itemPrediction,
|
|
24
|
+
pageId: pageId,
|
|
25
|
+
})));
|
|
26
|
+
rawPrediction["recipient_names"] &&
|
|
27
|
+
rawPrediction["recipient_names"].map((itemPrediction) => this.recipientNames.push(new standard_1.StringField({
|
|
28
|
+
prediction: itemPrediction,
|
|
29
|
+
pageId: pageId,
|
|
30
|
+
})));
|
|
31
|
+
this.senderAddress = new usMailV3SenderAddress_1.UsMailV3SenderAddress({
|
|
32
|
+
prediction: rawPrediction["sender_address"],
|
|
33
|
+
pageId: pageId,
|
|
34
|
+
});
|
|
35
|
+
this.senderName = new standard_1.StringField({
|
|
36
|
+
prediction: rawPrediction["sender_name"],
|
|
37
|
+
pageId: pageId,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Default string representation.
|
|
42
|
+
*/
|
|
43
|
+
toString() {
|
|
44
|
+
const recipientNames = this.recipientNames.join("\n ");
|
|
45
|
+
let recipientAddressesSummary = "";
|
|
46
|
+
if (this.recipientAddresses && this.recipientAddresses.length > 0) {
|
|
47
|
+
const recipientAddressesColSizes = [17, 37, 19, 13, 24, 7, 27, 17];
|
|
48
|
+
recipientAddressesSummary += "\n" + (0, common_1.lineSeparator)(recipientAddressesColSizes, "-") + "\n ";
|
|
49
|
+
recipientAddressesSummary += "| City ";
|
|
50
|
+
recipientAddressesSummary += "| Complete Address ";
|
|
51
|
+
recipientAddressesSummary += "| Is Address Change ";
|
|
52
|
+
recipientAddressesSummary += "| Postal Code ";
|
|
53
|
+
recipientAddressesSummary += "| Private Mailbox Number ";
|
|
54
|
+
recipientAddressesSummary += "| State ";
|
|
55
|
+
recipientAddressesSummary += "| Street ";
|
|
56
|
+
recipientAddressesSummary += "| Unit ";
|
|
57
|
+
recipientAddressesSummary += "|\n" + (0, common_1.lineSeparator)(recipientAddressesColSizes, "=");
|
|
58
|
+
recipientAddressesSummary += this.recipientAddresses.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(recipientAddressesColSizes, "-")).join("");
|
|
59
|
+
}
|
|
60
|
+
const outStr = `:Sender Name: ${this.senderName}
|
|
61
|
+
:Sender Address: ${this.senderAddress.toFieldList()}
|
|
62
|
+
:Recipient Names: ${recipientNames}
|
|
63
|
+
:Recipient Addresses: ${recipientAddressesSummary}
|
|
64
|
+
:Return to Sender: ${this.isReturnToSender}`.trimEnd();
|
|
65
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.UsMailV3Document = UsMailV3Document;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StringDict } from "../../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../../geometry";
|
|
3
|
+
/**
|
|
4
|
+
* The addresses of the recipients.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UsMailV3RecipientAddress {
|
|
7
|
+
#private;
|
|
8
|
+
/** The city of the recipient's address. */
|
|
9
|
+
city: string | null;
|
|
10
|
+
/** The complete address of the recipient. */
|
|
11
|
+
complete: string | null;
|
|
12
|
+
/** Indicates if the recipient's address is a change of address. */
|
|
13
|
+
isAddressChange: boolean | null;
|
|
14
|
+
/** The postal code of the recipient's address. */
|
|
15
|
+
postalCode: string | null;
|
|
16
|
+
/** The private mailbox number of the recipient's address. */
|
|
17
|
+
privateMailboxNumber: string | null;
|
|
18
|
+
/** Second part of the ISO 3166-2 code, consisting of two letters indicating the US State. */
|
|
19
|
+
state: string | null;
|
|
20
|
+
/** The street of the recipient's address. */
|
|
21
|
+
street: string | null;
|
|
22
|
+
/** The unit number of the recipient's address. */
|
|
23
|
+
unit: string | null;
|
|
24
|
+
/** Confidence score */
|
|
25
|
+
confidence: number;
|
|
26
|
+
/** The document page on which the information was found. */
|
|
27
|
+
pageId: number;
|
|
28
|
+
/**
|
|
29
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
30
|
+
* the field in the document.
|
|
31
|
+
*/
|
|
32
|
+
polygon: Polygon;
|
|
33
|
+
constructor({ prediction }: StringDict);
|
|
34
|
+
/**
|
|
35
|
+
* Default string representation.
|
|
36
|
+
*/
|
|
37
|
+
toString(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Output in a format suitable for inclusion in an rST table.
|
|
40
|
+
*/
|
|
41
|
+
toTableLine(): string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
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 _UsMailV3RecipientAddress_instances, _UsMailV3RecipientAddress_printableValues;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UsMailV3RecipientAddress = void 0;
|
|
10
|
+
const common_1 = require("../../../parsing/common");
|
|
11
|
+
/**
|
|
12
|
+
* The addresses of the recipients.
|
|
13
|
+
*/
|
|
14
|
+
class UsMailV3RecipientAddress {
|
|
15
|
+
constructor({ prediction = {} }) {
|
|
16
|
+
_UsMailV3RecipientAddress_instances.add(this);
|
|
17
|
+
/** Confidence score */
|
|
18
|
+
this.confidence = 0.0;
|
|
19
|
+
/**
|
|
20
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
21
|
+
* the field in the document.
|
|
22
|
+
*/
|
|
23
|
+
this.polygon = [];
|
|
24
|
+
this.city = prediction["city"];
|
|
25
|
+
this.complete = prediction["complete"];
|
|
26
|
+
this.isAddressChange = prediction["is_address_change"];
|
|
27
|
+
this.postalCode = prediction["postal_code"];
|
|
28
|
+
this.privateMailboxNumber = prediction["private_mailbox_number"];
|
|
29
|
+
this.state = prediction["state"];
|
|
30
|
+
this.street = prediction["street"];
|
|
31
|
+
this.unit = prediction["unit"];
|
|
32
|
+
this.pageId = prediction["page_id"];
|
|
33
|
+
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
|
|
34
|
+
if (prediction["polygon"]) {
|
|
35
|
+
this.polygon = prediction.polygon;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Default string representation.
|
|
40
|
+
*/
|
|
41
|
+
toString() {
|
|
42
|
+
const printable = __classPrivateFieldGet(this, _UsMailV3RecipientAddress_instances, "m", _UsMailV3RecipientAddress_printableValues).call(this);
|
|
43
|
+
return ("City: " +
|
|
44
|
+
printable.city +
|
|
45
|
+
", Complete Address: " +
|
|
46
|
+
printable.complete +
|
|
47
|
+
", Is Address Change: " +
|
|
48
|
+
printable.isAddressChange +
|
|
49
|
+
", Postal Code: " +
|
|
50
|
+
printable.postalCode +
|
|
51
|
+
", Private Mailbox Number: " +
|
|
52
|
+
printable.privateMailboxNumber +
|
|
53
|
+
", State: " +
|
|
54
|
+
printable.state +
|
|
55
|
+
", Street: " +
|
|
56
|
+
printable.street +
|
|
57
|
+
", Unit: " +
|
|
58
|
+
printable.unit);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Output in a format suitable for inclusion in an rST table.
|
|
62
|
+
*/
|
|
63
|
+
toTableLine() {
|
|
64
|
+
const printable = __classPrivateFieldGet(this, _UsMailV3RecipientAddress_instances, "m", _UsMailV3RecipientAddress_printableValues).call(this);
|
|
65
|
+
return ("| " +
|
|
66
|
+
printable.city.padEnd(15) +
|
|
67
|
+
" | " +
|
|
68
|
+
printable.complete.padEnd(35) +
|
|
69
|
+
" | " +
|
|
70
|
+
printable.isAddressChange.padEnd(17) +
|
|
71
|
+
" | " +
|
|
72
|
+
printable.postalCode.padEnd(11) +
|
|
73
|
+
" | " +
|
|
74
|
+
printable.privateMailboxNumber.padEnd(22) +
|
|
75
|
+
" | " +
|
|
76
|
+
printable.state.padEnd(5) +
|
|
77
|
+
" | " +
|
|
78
|
+
printable.street.padEnd(25) +
|
|
79
|
+
" | " +
|
|
80
|
+
printable.unit.padEnd(15) +
|
|
81
|
+
" |");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.UsMailV3RecipientAddress = UsMailV3RecipientAddress;
|
|
85
|
+
_UsMailV3RecipientAddress_instances = new WeakSet(), _UsMailV3RecipientAddress_printableValues = function _UsMailV3RecipientAddress_printableValues() {
|
|
86
|
+
return {
|
|
87
|
+
city: this.city ?
|
|
88
|
+
this.city.length <= 15 ?
|
|
89
|
+
(0, common_1.cleanSpecialChars)(this.city) :
|
|
90
|
+
(0, common_1.cleanSpecialChars)(this.city).slice(0, 12) + "..." :
|
|
91
|
+
"",
|
|
92
|
+
complete: this.complete ?
|
|
93
|
+
this.complete.length <= 35 ?
|
|
94
|
+
(0, common_1.cleanSpecialChars)(this.complete) :
|
|
95
|
+
(0, common_1.cleanSpecialChars)(this.complete).slice(0, 32) + "..." :
|
|
96
|
+
"",
|
|
97
|
+
isAddressChange: this.isAddressChange === true ?
|
|
98
|
+
"True" :
|
|
99
|
+
this.isAddressChange === false ?
|
|
100
|
+
"False" :
|
|
101
|
+
"",
|
|
102
|
+
postalCode: this.postalCode ?
|
|
103
|
+
this.postalCode.length <= 11 ?
|
|
104
|
+
(0, common_1.cleanSpecialChars)(this.postalCode) :
|
|
105
|
+
(0, common_1.cleanSpecialChars)(this.postalCode).slice(0, 8) + "..." :
|
|
106
|
+
"",
|
|
107
|
+
privateMailboxNumber: this.privateMailboxNumber ?
|
|
108
|
+
this.privateMailboxNumber.length <= 22 ?
|
|
109
|
+
(0, common_1.cleanSpecialChars)(this.privateMailboxNumber) :
|
|
110
|
+
(0, common_1.cleanSpecialChars)(this.privateMailboxNumber).slice(0, 19) + "..." :
|
|
111
|
+
"",
|
|
112
|
+
state: this.state ?
|
|
113
|
+
this.state.length <= 5 ?
|
|
114
|
+
(0, common_1.cleanSpecialChars)(this.state) :
|
|
115
|
+
(0, common_1.cleanSpecialChars)(this.state).slice(0, 2) + "..." :
|
|
116
|
+
"",
|
|
117
|
+
street: this.street ?
|
|
118
|
+
this.street.length <= 25 ?
|
|
119
|
+
(0, common_1.cleanSpecialChars)(this.street) :
|
|
120
|
+
(0, common_1.cleanSpecialChars)(this.street).slice(0, 22) + "..." :
|
|
121
|
+
"",
|
|
122
|
+
unit: this.unit ?
|
|
123
|
+
this.unit.length <= 15 ?
|
|
124
|
+
(0, common_1.cleanSpecialChars)(this.unit) :
|
|
125
|
+
(0, common_1.cleanSpecialChars)(this.unit).slice(0, 12) + "..." :
|
|
126
|
+
"",
|
|
127
|
+
};
|
|
128
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { StringDict } from "../../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../../geometry";
|
|
3
|
+
/**
|
|
4
|
+
* The address of the sender.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UsMailV3SenderAddress {
|
|
7
|
+
#private;
|
|
8
|
+
/** The city of the sender's address. */
|
|
9
|
+
city: string | null;
|
|
10
|
+
/** The complete address of the sender. */
|
|
11
|
+
complete: string | null;
|
|
12
|
+
/** The postal code of the sender's address. */
|
|
13
|
+
postalCode: string | null;
|
|
14
|
+
/** Second part of the ISO 3166-2 code, consisting of two letters indicating the US State. */
|
|
15
|
+
state: string | null;
|
|
16
|
+
/** The street of the sender's address. */
|
|
17
|
+
street: string | null;
|
|
18
|
+
/** Confidence score */
|
|
19
|
+
confidence: number;
|
|
20
|
+
/** The document page on which the information was found. */
|
|
21
|
+
pageId: number;
|
|
22
|
+
/**
|
|
23
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
24
|
+
* the field in the document.
|
|
25
|
+
*/
|
|
26
|
+
polygon: Polygon;
|
|
27
|
+
constructor({ prediction }: StringDict);
|
|
28
|
+
/**
|
|
29
|
+
* Default string representation.
|
|
30
|
+
*/
|
|
31
|
+
toString(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Output in a format suitable for inclusion in a field list.
|
|
34
|
+
*/
|
|
35
|
+
toFieldList(): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 _UsMailV3SenderAddress_instances, _UsMailV3SenderAddress_printableValues;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UsMailV3SenderAddress = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* The address of the sender.
|
|
12
|
+
*/
|
|
13
|
+
class UsMailV3SenderAddress {
|
|
14
|
+
constructor({ prediction = {} }) {
|
|
15
|
+
_UsMailV3SenderAddress_instances.add(this);
|
|
16
|
+
/** Confidence score */
|
|
17
|
+
this.confidence = 0.0;
|
|
18
|
+
/**
|
|
19
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
20
|
+
* the field in the document.
|
|
21
|
+
*/
|
|
22
|
+
this.polygon = [];
|
|
23
|
+
this.city = prediction["city"];
|
|
24
|
+
this.complete = prediction["complete"];
|
|
25
|
+
this.postalCode = prediction["postal_code"];
|
|
26
|
+
this.state = prediction["state"];
|
|
27
|
+
this.street = prediction["street"];
|
|
28
|
+
this.pageId = prediction["page_id"];
|
|
29
|
+
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
|
|
30
|
+
if (prediction["polygon"]) {
|
|
31
|
+
this.polygon = prediction.polygon;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Default string representation.
|
|
36
|
+
*/
|
|
37
|
+
toString() {
|
|
38
|
+
const printable = __classPrivateFieldGet(this, _UsMailV3SenderAddress_instances, "m", _UsMailV3SenderAddress_printableValues).call(this);
|
|
39
|
+
return ("City: " +
|
|
40
|
+
printable.city +
|
|
41
|
+
", Complete Address: " +
|
|
42
|
+
printable.complete +
|
|
43
|
+
", Postal Code: " +
|
|
44
|
+
printable.postalCode +
|
|
45
|
+
", State: " +
|
|
46
|
+
printable.state +
|
|
47
|
+
", Street: " +
|
|
48
|
+
printable.street);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Output in a format suitable for inclusion in a field list.
|
|
52
|
+
*/
|
|
53
|
+
toFieldList() {
|
|
54
|
+
const printable = __classPrivateFieldGet(this, _UsMailV3SenderAddress_instances, "m", _UsMailV3SenderAddress_printableValues).call(this);
|
|
55
|
+
return `
|
|
56
|
+
:City: ${printable.city}
|
|
57
|
+
:Complete Address: ${printable.complete}
|
|
58
|
+
:Postal Code: ${printable.postalCode}
|
|
59
|
+
:State: ${printable.state}
|
|
60
|
+
:Street: ${printable.street}`.trimEnd();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.UsMailV3SenderAddress = UsMailV3SenderAddress;
|
|
64
|
+
_UsMailV3SenderAddress_instances = new WeakSet(), _UsMailV3SenderAddress_printableValues = function _UsMailV3SenderAddress_printableValues() {
|
|
65
|
+
return {
|
|
66
|
+
city: this.city ?? "",
|
|
67
|
+
complete: this.complete ?? "",
|
|
68
|
+
postalCode: this.postalCode ?? "",
|
|
69
|
+
state: this.state ?? "",
|
|
70
|
+
street: this.street ?? "",
|
|
71
|
+
};
|
|
72
|
+
};
|