mindee 4.14.1 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/package.json +2 -1
- package/src/client.d.ts +5 -3
- package/src/client.js +7 -1
- package/src/http/endpoint.d.ts +3 -1
- package/src/http/endpoint.js +12 -8
- package/src/http/responseValidation.js +11 -4
- package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.d.ts +2 -1
- package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.js +2 -1
- package/src/imageOperations/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -1
- package/src/input/localResponse.d.ts +1 -0
- package/src/input/localResponse.js +1 -0
- package/src/parsing/common/document.d.ts +1 -0
- package/src/parsing/common/document.js +27 -6
- package/src/parsing/common/extras/fullTextOcrExtra.d.ts +11 -0
- package/src/parsing/common/extras/fullTextOcrExtra.js +20 -0
- package/src/parsing/common/extras/index.d.ts +3 -0
- package/src/parsing/common/extras/index.js +9 -0
- package/src/parsing/common/index.d.ts +2 -0
- package/src/parsing/common/index.js +28 -1
- package/src/parsing/common/page.d.ts +1 -0
- package/src/parsing/common/page.js +30 -7
- package/src/parsing/common/summaryHelper.d.ts +10 -0
- package/src/parsing/common/summaryHelper.js +27 -1
- package/src/parsing/generated/generatedObject.d.ts +3 -3
- package/src/parsing/generated/generatedObject.js +14 -5
- package/src/parsing/standard/amount.d.ts +0 -1
- package/src/parsing/standard/amount.js +4 -11
- package/src/parsing/standard/index.d.ts +1 -1
- package/src/parsing/standard/index.js +1 -2
- package/src/parsing/standard/tax.js +4 -4
- package/src/pdf/pdfOperation.d.ts +1 -1
- package/src/pdf/pdfOperation.js +12 -7
- package/src/product/billOfLading/billOfLadingV1.d.ts +16 -0
- package/src/product/billOfLading/billOfLadingV1.js +27 -0
- package/src/product/billOfLading/billOfLadingV1Carrier.d.ts +32 -0
- package/src/product/billOfLading/billOfLadingV1Carrier.js +62 -0
- package/src/product/billOfLading/billOfLadingV1CarrierItem.d.ts +38 -0
- package/src/product/billOfLading/billOfLadingV1CarrierItem.js +117 -0
- package/src/product/billOfLading/billOfLadingV1Consignee.d.ts +34 -0
- package/src/product/billOfLading/billOfLadingV1Consignee.js +67 -0
- package/src/product/billOfLading/billOfLadingV1Document.d.ts +39 -0
- package/src/product/billOfLading/billOfLadingV1Document.js +95 -0
- package/src/product/billOfLading/billOfLadingV1NotifyParty.d.ts +34 -0
- package/src/product/billOfLading/billOfLadingV1NotifyParty.js +67 -0
- package/src/product/billOfLading/billOfLadingV1Shipper.d.ts +34 -0
- package/src/product/billOfLading/billOfLadingV1Shipper.js +67 -0
- package/src/product/billOfLading/index.d.ts +1 -0
- package/src/product/billOfLading/index.js +5 -0
- package/src/product/billOfLading/internal.d.ts +7 -0
- package/src/product/billOfLading/internal.js +17 -0
- package/src/product/financialDocument/financialDocumentV1LineItem.d.ts +8 -8
- package/src/product/financialDocument/financialDocumentV1LineItem.js +47 -22
- package/src/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +4 -4
- package/src/product/fr/energyBill/energyBillV1.d.ts +16 -0
- package/src/product/fr/energyBill/energyBillV1.js +27 -0
- package/src/product/fr/energyBill/energyBillV1Document.d.ts +49 -0
- package/src/product/fr/energyBill/energyBillV1Document.js +143 -0
- package/src/product/fr/energyBill/energyBillV1EnergyConsumer.d.ts +30 -0
- package/src/product/fr/energyBill/energyBillV1EnergyConsumer.js +57 -0
- package/src/product/fr/energyBill/energyBillV1EnergySupplier.d.ts +30 -0
- package/src/product/fr/energyBill/energyBillV1EnergySupplier.js +57 -0
- package/src/product/fr/energyBill/energyBillV1EnergyUsage.d.ts +38 -0
- package/src/product/fr/energyBill/energyBillV1EnergyUsage.js +117 -0
- package/src/product/fr/energyBill/energyBillV1MeterDetail.d.ts +32 -0
- package/src/product/fr/energyBill/energyBillV1MeterDetail.js +62 -0
- package/src/product/fr/energyBill/energyBillV1Subscription.d.ts +38 -0
- package/src/product/fr/energyBill/energyBillV1Subscription.js +117 -0
- package/src/product/fr/energyBill/energyBillV1TaxesAndContribution.d.ts +38 -0
- package/src/product/fr/energyBill/energyBillV1TaxesAndContribution.js +117 -0
- package/src/product/fr/energyBill/index.d.ts +1 -0
- package/src/product/fr/energyBill/index.js +5 -0
- package/src/product/fr/energyBill/internal.d.ts +8 -0
- package/src/product/fr/energyBill/internal.js +19 -0
- package/src/product/fr/index.d.ts +2 -0
- package/src/product/fr/index.js +5 -1
- package/src/product/fr/internal.d.ts +2 -0
- package/src/product/fr/internal.js +3 -1
- package/src/product/fr/payslip/index.d.ts +1 -0
- package/src/product/fr/payslip/index.js +5 -0
- package/src/product/fr/payslip/internal.d.ts +10 -0
- package/src/product/fr/payslip/internal.js +23 -0
- package/src/product/fr/payslip/payslipV2.d.ts +16 -0
- package/src/product/fr/payslip/payslipV2.js +27 -0
- package/src/product/fr/payslip/payslipV2BankAccountDetail.d.ts +32 -0
- package/src/product/fr/payslip/payslipV2BankAccountDetail.js +62 -0
- package/src/product/fr/payslip/payslipV2Document.d.ts +35 -0
- package/src/product/fr/payslip/payslipV2Document.js +80 -0
- package/src/product/fr/payslip/payslipV2Employee.d.ts +40 -0
- package/src/product/fr/payslip/payslipV2Employee.js +82 -0
- package/src/product/fr/payslip/payslipV2Employer.d.ts +40 -0
- package/src/product/fr/payslip/payslipV2Employer.js +82 -0
- package/src/product/fr/payslip/payslipV2Employment.d.ts +38 -0
- package/src/product/fr/payslip/payslipV2Employment.js +85 -0
- package/src/product/fr/payslip/payslipV2PayDetail.d.ts +46 -0
- package/src/product/fr/payslip/payslipV2PayDetail.js +168 -0
- package/src/product/fr/payslip/payslipV2PayPeriod.d.ts +36 -0
- package/src/product/fr/payslip/payslipV2PayPeriod.js +72 -0
- package/src/product/fr/payslip/payslipV2Pto.d.ts +32 -0
- package/src/product/fr/payslip/payslipV2Pto.js +84 -0
- package/src/product/fr/payslip/payslipV2SalaryDetail.d.ts +34 -0
- package/src/product/fr/payslip/payslipV2SalaryDetail.js +97 -0
- package/src/product/generated/generatedV1.js +2 -1
- package/src/product/index.d.ts +2 -0
- package/src/product/index.js +5 -1
- package/src/product/internal.d.ts +2 -0
- package/src/product/internal.js +3 -1
- package/src/product/invoice/invoiceV4LineItem.d.ts +8 -8
- package/src/product/invoice/invoiceV4LineItem.js +47 -22
- package/src/product/nutritionFactsLabel/index.d.ts +1 -0
- package/src/product/nutritionFactsLabel/index.js +5 -0
- package/src/product/nutritionFactsLabel/internal.d.ts +15 -0
- package/src/product/nutritionFactsLabel/internal.js +33 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1.d.ts +16 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1.js +27 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1AddedSugar.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1AddedSugar.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Calorie.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Calorie.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Cholesterol.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Cholesterol.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1DietaryFiber.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1DietaryFiber.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Document.d.ts +53 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Document.js +117 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Nutrient.d.ts +36 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Nutrient.js +107 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Protein.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Protein.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1SaturatedFat.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1SaturatedFat.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1ServingSize.d.ts +30 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1ServingSize.js +65 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Sodium.d.ts +34 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Sodium.js +89 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalCarbohydrate.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalCarbohydrate.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalFat.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalFat.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalSugar.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalSugar.js +84 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TransFat.d.ts +32 -0
- package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TransFat.js +84 -0
- package/src/product/receipt/receiptV5LineItem.d.ts +4 -4
- package/src/product/receipt/receiptV5LineItem.js +27 -12
- package/src/product/resume/resumeV1Certificate.d.ts +4 -4
- package/src/product/resume/resumeV1Certificate.js +9 -8
- package/src/product/resume/resumeV1Education.d.ts +7 -7
- package/src/product/resume/resumeV1Education.js +15 -14
- package/src/product/resume/resumeV1Language.d.ts +2 -2
- package/src/product/resume/resumeV1Language.js +5 -4
- package/src/product/resume/resumeV1ProfessionalExperience.d.ts +8 -8
- package/src/product/resume/resumeV1ProfessionalExperience.js +17 -16
- package/src/product/resume/resumeV1SocialNetworksUrl.d.ts +2 -2
- package/src/product/resume/resumeV1SocialNetworksUrl.js +5 -4
- package/src/product/us/healthcareCard/healthcareCardV1Copay.d.ts +2 -2
- package/src/product/us/healthcareCard/healthcareCardV1Copay.js +11 -6
- package/src/product/us/usMail/index.d.ts +1 -0
- package/src/product/us/usMail/index.js +5 -0
- package/src/product/us/usMail/usMailV2RecipientAddress.d.ts +7 -7
- package/src/product/us/usMail/usMailV2RecipientAddress.js +17 -15
- package/src/product/us/usMail/usMailV2SenderAddress.d.ts +5 -5
- package/src/product/us/usMail/usMailV2SenderAddress.js +5 -25
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NutritionFactsLabelV1Document = void 0;
|
|
4
|
+
const common_1 = require("../../parsing/common");
|
|
5
|
+
const nutritionFactsLabelV1ServingSize_1 = require("./nutritionFactsLabelV1ServingSize");
|
|
6
|
+
const nutritionFactsLabelV1Calorie_1 = require("./nutritionFactsLabelV1Calorie");
|
|
7
|
+
const nutritionFactsLabelV1TotalFat_1 = require("./nutritionFactsLabelV1TotalFat");
|
|
8
|
+
const nutritionFactsLabelV1SaturatedFat_1 = require("./nutritionFactsLabelV1SaturatedFat");
|
|
9
|
+
const nutritionFactsLabelV1TransFat_1 = require("./nutritionFactsLabelV1TransFat");
|
|
10
|
+
const nutritionFactsLabelV1Cholesterol_1 = require("./nutritionFactsLabelV1Cholesterol");
|
|
11
|
+
const nutritionFactsLabelV1TotalCarbohydrate_1 = require("./nutritionFactsLabelV1TotalCarbohydrate");
|
|
12
|
+
const nutritionFactsLabelV1DietaryFiber_1 = require("./nutritionFactsLabelV1DietaryFiber");
|
|
13
|
+
const nutritionFactsLabelV1TotalSugar_1 = require("./nutritionFactsLabelV1TotalSugar");
|
|
14
|
+
const nutritionFactsLabelV1AddedSugar_1 = require("./nutritionFactsLabelV1AddedSugar");
|
|
15
|
+
const nutritionFactsLabelV1Protein_1 = require("./nutritionFactsLabelV1Protein");
|
|
16
|
+
const nutritionFactsLabelV1Sodium_1 = require("./nutritionFactsLabelV1Sodium");
|
|
17
|
+
const nutritionFactsLabelV1Nutrient_1 = require("./nutritionFactsLabelV1Nutrient");
|
|
18
|
+
const standard_1 = require("../../parsing/standard");
|
|
19
|
+
/**
|
|
20
|
+
* Nutrition Facts Label API version 1.0 document data.
|
|
21
|
+
*/
|
|
22
|
+
class NutritionFactsLabelV1Document {
|
|
23
|
+
constructor(rawPrediction, pageId) {
|
|
24
|
+
/** The amount of nutrients in the product. */
|
|
25
|
+
this.nutrients = [];
|
|
26
|
+
this.addedSugars = new nutritionFactsLabelV1AddedSugar_1.NutritionFactsLabelV1AddedSugar({
|
|
27
|
+
prediction: rawPrediction["added_sugars"],
|
|
28
|
+
pageId: pageId,
|
|
29
|
+
});
|
|
30
|
+
this.calories = new nutritionFactsLabelV1Calorie_1.NutritionFactsLabelV1Calorie({
|
|
31
|
+
prediction: rawPrediction["calories"],
|
|
32
|
+
pageId: pageId,
|
|
33
|
+
});
|
|
34
|
+
this.cholesterol = new nutritionFactsLabelV1Cholesterol_1.NutritionFactsLabelV1Cholesterol({
|
|
35
|
+
prediction: rawPrediction["cholesterol"],
|
|
36
|
+
pageId: pageId,
|
|
37
|
+
});
|
|
38
|
+
this.dietaryFiber = new nutritionFactsLabelV1DietaryFiber_1.NutritionFactsLabelV1DietaryFiber({
|
|
39
|
+
prediction: rawPrediction["dietary_fiber"],
|
|
40
|
+
pageId: pageId,
|
|
41
|
+
});
|
|
42
|
+
rawPrediction["nutrients"] &&
|
|
43
|
+
rawPrediction["nutrients"].map((itemPrediction) => this.nutrients.push(new nutritionFactsLabelV1Nutrient_1.NutritionFactsLabelV1Nutrient({
|
|
44
|
+
prediction: itemPrediction,
|
|
45
|
+
pageId: pageId,
|
|
46
|
+
})));
|
|
47
|
+
this.protein = new nutritionFactsLabelV1Protein_1.NutritionFactsLabelV1Protein({
|
|
48
|
+
prediction: rawPrediction["protein"],
|
|
49
|
+
pageId: pageId,
|
|
50
|
+
});
|
|
51
|
+
this.saturatedFat = new nutritionFactsLabelV1SaturatedFat_1.NutritionFactsLabelV1SaturatedFat({
|
|
52
|
+
prediction: rawPrediction["saturated_fat"],
|
|
53
|
+
pageId: pageId,
|
|
54
|
+
});
|
|
55
|
+
this.servingPerBox = new standard_1.AmountField({
|
|
56
|
+
prediction: rawPrediction["serving_per_box"],
|
|
57
|
+
pageId: pageId,
|
|
58
|
+
});
|
|
59
|
+
this.servingSize = new nutritionFactsLabelV1ServingSize_1.NutritionFactsLabelV1ServingSize({
|
|
60
|
+
prediction: rawPrediction["serving_size"],
|
|
61
|
+
pageId: pageId,
|
|
62
|
+
});
|
|
63
|
+
this.sodium = new nutritionFactsLabelV1Sodium_1.NutritionFactsLabelV1Sodium({
|
|
64
|
+
prediction: rawPrediction["sodium"],
|
|
65
|
+
pageId: pageId,
|
|
66
|
+
});
|
|
67
|
+
this.totalCarbohydrate = new nutritionFactsLabelV1TotalCarbohydrate_1.NutritionFactsLabelV1TotalCarbohydrate({
|
|
68
|
+
prediction: rawPrediction["total_carbohydrate"],
|
|
69
|
+
pageId: pageId,
|
|
70
|
+
});
|
|
71
|
+
this.totalFat = new nutritionFactsLabelV1TotalFat_1.NutritionFactsLabelV1TotalFat({
|
|
72
|
+
prediction: rawPrediction["total_fat"],
|
|
73
|
+
pageId: pageId,
|
|
74
|
+
});
|
|
75
|
+
this.totalSugars = new nutritionFactsLabelV1TotalSugar_1.NutritionFactsLabelV1TotalSugar({
|
|
76
|
+
prediction: rawPrediction["total_sugars"],
|
|
77
|
+
pageId: pageId,
|
|
78
|
+
});
|
|
79
|
+
this.transFat = new nutritionFactsLabelV1TransFat_1.NutritionFactsLabelV1TransFat({
|
|
80
|
+
prediction: rawPrediction["trans_fat"],
|
|
81
|
+
pageId: pageId,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Default string representation.
|
|
86
|
+
*/
|
|
87
|
+
toString() {
|
|
88
|
+
let nutrientsSummary = "";
|
|
89
|
+
if (this.nutrients && this.nutrients.length > 0) {
|
|
90
|
+
const nutrientsColSizes = [13, 22, 10, 13, 6];
|
|
91
|
+
nutrientsSummary += "\n" + (0, common_1.lineSeparator)(nutrientsColSizes, "-") + "\n ";
|
|
92
|
+
nutrientsSummary += "| Daily Value ";
|
|
93
|
+
nutrientsSummary += "| Name ";
|
|
94
|
+
nutrientsSummary += "| Per 100g ";
|
|
95
|
+
nutrientsSummary += "| Per Serving ";
|
|
96
|
+
nutrientsSummary += "| Unit ";
|
|
97
|
+
nutrientsSummary += "|\n" + (0, common_1.lineSeparator)(nutrientsColSizes, "=");
|
|
98
|
+
nutrientsSummary += this.nutrients.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(nutrientsColSizes, "-")).join("");
|
|
99
|
+
}
|
|
100
|
+
const outStr = `:Serving per Box: ${this.servingPerBox}
|
|
101
|
+
:Serving Size: ${this.servingSize.toFieldList()}
|
|
102
|
+
:Calories: ${this.calories.toFieldList()}
|
|
103
|
+
:Total Fat: ${this.totalFat.toFieldList()}
|
|
104
|
+
:Saturated Fat: ${this.saturatedFat.toFieldList()}
|
|
105
|
+
:Trans Fat: ${this.transFat.toFieldList()}
|
|
106
|
+
:Cholesterol: ${this.cholesterol.toFieldList()}
|
|
107
|
+
:Total Carbohydrate: ${this.totalCarbohydrate.toFieldList()}
|
|
108
|
+
:Dietary Fiber: ${this.dietaryFiber.toFieldList()}
|
|
109
|
+
:Total Sugars: ${this.totalSugars.toFieldList()}
|
|
110
|
+
:Added Sugars: ${this.addedSugars.toFieldList()}
|
|
111
|
+
:Protein: ${this.protein.toFieldList()}
|
|
112
|
+
:sodium: ${this.sodium.toFieldList()}
|
|
113
|
+
:nutrients: ${nutrientsSummary}`.trimEnd();
|
|
114
|
+
return (0, common_1.cleanOutString)(outStr);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.NutritionFactsLabelV1Document = NutritionFactsLabelV1Document;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { StringDict } from "../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../geometry";
|
|
3
|
+
/**
|
|
4
|
+
* The amount of nutrients in the product.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NutritionFactsLabelV1Nutrient {
|
|
7
|
+
#private;
|
|
8
|
+
/** DVs are the recommended amounts of nutrients to consume or not to exceed each day. */
|
|
9
|
+
dailyValue: number | null;
|
|
10
|
+
/** The name of nutrients of the product. */
|
|
11
|
+
name: string | null;
|
|
12
|
+
/** The amount of nutrients per 100g of the product. */
|
|
13
|
+
per100G: number | null;
|
|
14
|
+
/** The amount of nutrients per serving of the product. */
|
|
15
|
+
perServing: number | null;
|
|
16
|
+
/** The unit of measurement for the amount of nutrients. */
|
|
17
|
+
unit: 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 an rST table.
|
|
34
|
+
*/
|
|
35
|
+
toTableLine(): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
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 _NutritionFactsLabelV1Nutrient_instances, _NutritionFactsLabelV1Nutrient_printableValues;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.NutritionFactsLabelV1Nutrient = void 0;
|
|
10
|
+
const common_1 = require("../../parsing/common");
|
|
11
|
+
/**
|
|
12
|
+
* The amount of nutrients in the product.
|
|
13
|
+
*/
|
|
14
|
+
class NutritionFactsLabelV1Nutrient {
|
|
15
|
+
constructor({ prediction = {} }) {
|
|
16
|
+
_NutritionFactsLabelV1Nutrient_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
|
+
if (prediction["daily_value"] !== undefined &&
|
|
25
|
+
prediction["daily_value"] !== null &&
|
|
26
|
+
!isNaN(prediction["daily_value"])) {
|
|
27
|
+
this.dailyValue = +parseFloat(prediction["daily_value"]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.dailyValue = null;
|
|
31
|
+
}
|
|
32
|
+
this.name = prediction["name"];
|
|
33
|
+
if (prediction["per_100g"] !== undefined &&
|
|
34
|
+
prediction["per_100g"] !== null &&
|
|
35
|
+
!isNaN(prediction["per_100g"])) {
|
|
36
|
+
this.per100G = +parseFloat(prediction["per_100g"]);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.per100G = null;
|
|
40
|
+
}
|
|
41
|
+
if (prediction["per_serving"] !== undefined &&
|
|
42
|
+
prediction["per_serving"] !== null &&
|
|
43
|
+
!isNaN(prediction["per_serving"])) {
|
|
44
|
+
this.perServing = +parseFloat(prediction["per_serving"]);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.perServing = null;
|
|
48
|
+
}
|
|
49
|
+
this.unit = prediction["unit"];
|
|
50
|
+
this.pageId = prediction["page_id"];
|
|
51
|
+
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
|
|
52
|
+
if (prediction["polygon"]) {
|
|
53
|
+
this.polygon = prediction.polygon;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Default string representation.
|
|
58
|
+
*/
|
|
59
|
+
toString() {
|
|
60
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Nutrient_instances, "m", _NutritionFactsLabelV1Nutrient_printableValues).call(this);
|
|
61
|
+
return ("Daily Value: " +
|
|
62
|
+
printable.dailyValue +
|
|
63
|
+
", Name: " +
|
|
64
|
+
printable.name +
|
|
65
|
+
", Per 100g: " +
|
|
66
|
+
printable.per100G +
|
|
67
|
+
", Per Serving: " +
|
|
68
|
+
printable.perServing +
|
|
69
|
+
", Unit: " +
|
|
70
|
+
printable.unit);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Output in a format suitable for inclusion in an rST table.
|
|
74
|
+
*/
|
|
75
|
+
toTableLine() {
|
|
76
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Nutrient_instances, "m", _NutritionFactsLabelV1Nutrient_printableValues).call(this);
|
|
77
|
+
return ("| " +
|
|
78
|
+
printable.dailyValue.padEnd(11) +
|
|
79
|
+
" | " +
|
|
80
|
+
printable.name.padEnd(20) +
|
|
81
|
+
" | " +
|
|
82
|
+
printable.per100G.padEnd(8) +
|
|
83
|
+
" | " +
|
|
84
|
+
printable.perServing.padEnd(11) +
|
|
85
|
+
" | " +
|
|
86
|
+
printable.unit.padEnd(4) +
|
|
87
|
+
" |");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.NutritionFactsLabelV1Nutrient = NutritionFactsLabelV1Nutrient;
|
|
91
|
+
_NutritionFactsLabelV1Nutrient_instances = new WeakSet(), _NutritionFactsLabelV1Nutrient_printableValues = function _NutritionFactsLabelV1Nutrient_printableValues() {
|
|
92
|
+
return {
|
|
93
|
+
dailyValue: this.dailyValue !== undefined ? (0, common_1.floatToString)(this.dailyValue) : "",
|
|
94
|
+
name: this.name ?
|
|
95
|
+
this.name.length <= 20 ?
|
|
96
|
+
(0, common_1.cleanSpecialChars)(this.name) :
|
|
97
|
+
(0, common_1.cleanSpecialChars)(this.name).slice(0, 17) + "..." :
|
|
98
|
+
"",
|
|
99
|
+
per100G: this.per100G !== undefined ? (0, common_1.floatToString)(this.per100G) : "",
|
|
100
|
+
perServing: this.perServing !== undefined ? (0, common_1.floatToString)(this.perServing) : "",
|
|
101
|
+
unit: this.unit ?
|
|
102
|
+
this.unit.length <= 4 ?
|
|
103
|
+
(0, common_1.cleanSpecialChars)(this.unit) :
|
|
104
|
+
(0, common_1.cleanSpecialChars)(this.unit).slice(0, 1) + "..." :
|
|
105
|
+
"",
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StringDict } from "../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../geometry";
|
|
3
|
+
/**
|
|
4
|
+
* The amount of protein in the product.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NutritionFactsLabelV1Protein {
|
|
7
|
+
#private;
|
|
8
|
+
/** DVs are the recommended amounts of protein to consume or not to exceed each day. */
|
|
9
|
+
dailyValue: number | null;
|
|
10
|
+
/** The amount of protein per 100g of the product. */
|
|
11
|
+
per100G: number | null;
|
|
12
|
+
/** The amount of protein per serving of the product. */
|
|
13
|
+
perServing: number | null;
|
|
14
|
+
/** Confidence score */
|
|
15
|
+
confidence: number;
|
|
16
|
+
/** The document page on which the information was found. */
|
|
17
|
+
pageId: number;
|
|
18
|
+
/**
|
|
19
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
20
|
+
* the field in the document.
|
|
21
|
+
*/
|
|
22
|
+
polygon: Polygon;
|
|
23
|
+
constructor({ prediction }: StringDict);
|
|
24
|
+
/**
|
|
25
|
+
* Default string representation.
|
|
26
|
+
*/
|
|
27
|
+
toString(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Output in a format suitable for inclusion in a field list.
|
|
30
|
+
*/
|
|
31
|
+
toFieldList(): string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 _NutritionFactsLabelV1Protein_instances, _NutritionFactsLabelV1Protein_printableValues;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.NutritionFactsLabelV1Protein = void 0;
|
|
10
|
+
const common_1 = require("../../parsing/common");
|
|
11
|
+
/**
|
|
12
|
+
* The amount of protein in the product.
|
|
13
|
+
*/
|
|
14
|
+
class NutritionFactsLabelV1Protein {
|
|
15
|
+
constructor({ prediction = {} }) {
|
|
16
|
+
_NutritionFactsLabelV1Protein_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
|
+
if (prediction["daily_value"] !== undefined &&
|
|
25
|
+
prediction["daily_value"] !== null &&
|
|
26
|
+
!isNaN(prediction["daily_value"])) {
|
|
27
|
+
this.dailyValue = +parseFloat(prediction["daily_value"]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.dailyValue = null;
|
|
31
|
+
}
|
|
32
|
+
if (prediction["per_100g"] !== undefined &&
|
|
33
|
+
prediction["per_100g"] !== null &&
|
|
34
|
+
!isNaN(prediction["per_100g"])) {
|
|
35
|
+
this.per100G = +parseFloat(prediction["per_100g"]);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.per100G = null;
|
|
39
|
+
}
|
|
40
|
+
if (prediction["per_serving"] !== undefined &&
|
|
41
|
+
prediction["per_serving"] !== null &&
|
|
42
|
+
!isNaN(prediction["per_serving"])) {
|
|
43
|
+
this.perServing = +parseFloat(prediction["per_serving"]);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.perServing = null;
|
|
47
|
+
}
|
|
48
|
+
this.pageId = prediction["page_id"];
|
|
49
|
+
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
|
|
50
|
+
if (prediction["polygon"]) {
|
|
51
|
+
this.polygon = prediction.polygon;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Default string representation.
|
|
56
|
+
*/
|
|
57
|
+
toString() {
|
|
58
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Protein_instances, "m", _NutritionFactsLabelV1Protein_printableValues).call(this);
|
|
59
|
+
return ("Daily Value: " +
|
|
60
|
+
printable.dailyValue +
|
|
61
|
+
", Per 100g: " +
|
|
62
|
+
printable.per100G +
|
|
63
|
+
", Per Serving: " +
|
|
64
|
+
printable.perServing);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Output in a format suitable for inclusion in a field list.
|
|
68
|
+
*/
|
|
69
|
+
toFieldList() {
|
|
70
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Protein_instances, "m", _NutritionFactsLabelV1Protein_printableValues).call(this);
|
|
71
|
+
return `
|
|
72
|
+
:Daily Value: ${printable.dailyValue}
|
|
73
|
+
:Per 100g: ${printable.per100G}
|
|
74
|
+
:Per Serving: ${printable.perServing}`.trimEnd();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.NutritionFactsLabelV1Protein = NutritionFactsLabelV1Protein;
|
|
78
|
+
_NutritionFactsLabelV1Protein_instances = new WeakSet(), _NutritionFactsLabelV1Protein_printableValues = function _NutritionFactsLabelV1Protein_printableValues() {
|
|
79
|
+
return {
|
|
80
|
+
dailyValue: this.dailyValue !== undefined ? (0, common_1.floatToString)(this.dailyValue) : "",
|
|
81
|
+
per100G: this.per100G !== undefined ? (0, common_1.floatToString)(this.per100G) : "",
|
|
82
|
+
perServing: this.perServing !== undefined ? (0, common_1.floatToString)(this.perServing) : "",
|
|
83
|
+
};
|
|
84
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StringDict } from "../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../geometry";
|
|
3
|
+
/**
|
|
4
|
+
* The amount of saturated fat in the product.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NutritionFactsLabelV1SaturatedFat {
|
|
7
|
+
#private;
|
|
8
|
+
/** DVs are the recommended amounts of saturated fat to consume or not to exceed each day. */
|
|
9
|
+
dailyValue: number | null;
|
|
10
|
+
/** The amount of saturated fat per 100g of the product. */
|
|
11
|
+
per100G: number | null;
|
|
12
|
+
/** The amount of saturated fat per serving of the product. */
|
|
13
|
+
perServing: number | null;
|
|
14
|
+
/** Confidence score */
|
|
15
|
+
confidence: number;
|
|
16
|
+
/** The document page on which the information was found. */
|
|
17
|
+
pageId: number;
|
|
18
|
+
/**
|
|
19
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
20
|
+
* the field in the document.
|
|
21
|
+
*/
|
|
22
|
+
polygon: Polygon;
|
|
23
|
+
constructor({ prediction }: StringDict);
|
|
24
|
+
/**
|
|
25
|
+
* Default string representation.
|
|
26
|
+
*/
|
|
27
|
+
toString(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Output in a format suitable for inclusion in a field list.
|
|
30
|
+
*/
|
|
31
|
+
toFieldList(): string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 _NutritionFactsLabelV1SaturatedFat_instances, _NutritionFactsLabelV1SaturatedFat_printableValues;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.NutritionFactsLabelV1SaturatedFat = void 0;
|
|
10
|
+
const common_1 = require("../../parsing/common");
|
|
11
|
+
/**
|
|
12
|
+
* The amount of saturated fat in the product.
|
|
13
|
+
*/
|
|
14
|
+
class NutritionFactsLabelV1SaturatedFat {
|
|
15
|
+
constructor({ prediction = {} }) {
|
|
16
|
+
_NutritionFactsLabelV1SaturatedFat_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
|
+
if (prediction["daily_value"] !== undefined &&
|
|
25
|
+
prediction["daily_value"] !== null &&
|
|
26
|
+
!isNaN(prediction["daily_value"])) {
|
|
27
|
+
this.dailyValue = +parseFloat(prediction["daily_value"]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.dailyValue = null;
|
|
31
|
+
}
|
|
32
|
+
if (prediction["per_100g"] !== undefined &&
|
|
33
|
+
prediction["per_100g"] !== null &&
|
|
34
|
+
!isNaN(prediction["per_100g"])) {
|
|
35
|
+
this.per100G = +parseFloat(prediction["per_100g"]);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.per100G = null;
|
|
39
|
+
}
|
|
40
|
+
if (prediction["per_serving"] !== undefined &&
|
|
41
|
+
prediction["per_serving"] !== null &&
|
|
42
|
+
!isNaN(prediction["per_serving"])) {
|
|
43
|
+
this.perServing = +parseFloat(prediction["per_serving"]);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.perServing = null;
|
|
47
|
+
}
|
|
48
|
+
this.pageId = prediction["page_id"];
|
|
49
|
+
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
|
|
50
|
+
if (prediction["polygon"]) {
|
|
51
|
+
this.polygon = prediction.polygon;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Default string representation.
|
|
56
|
+
*/
|
|
57
|
+
toString() {
|
|
58
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1SaturatedFat_instances, "m", _NutritionFactsLabelV1SaturatedFat_printableValues).call(this);
|
|
59
|
+
return ("Daily Value: " +
|
|
60
|
+
printable.dailyValue +
|
|
61
|
+
", Per 100g: " +
|
|
62
|
+
printable.per100G +
|
|
63
|
+
", Per Serving: " +
|
|
64
|
+
printable.perServing);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Output in a format suitable for inclusion in a field list.
|
|
68
|
+
*/
|
|
69
|
+
toFieldList() {
|
|
70
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1SaturatedFat_instances, "m", _NutritionFactsLabelV1SaturatedFat_printableValues).call(this);
|
|
71
|
+
return `
|
|
72
|
+
:Daily Value: ${printable.dailyValue}
|
|
73
|
+
:Per 100g: ${printable.per100G}
|
|
74
|
+
:Per Serving: ${printable.perServing}`.trimEnd();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.NutritionFactsLabelV1SaturatedFat = NutritionFactsLabelV1SaturatedFat;
|
|
78
|
+
_NutritionFactsLabelV1SaturatedFat_instances = new WeakSet(), _NutritionFactsLabelV1SaturatedFat_printableValues = function _NutritionFactsLabelV1SaturatedFat_printableValues() {
|
|
79
|
+
return {
|
|
80
|
+
dailyValue: this.dailyValue !== undefined ? (0, common_1.floatToString)(this.dailyValue) : "",
|
|
81
|
+
per100G: this.per100G !== undefined ? (0, common_1.floatToString)(this.per100G) : "",
|
|
82
|
+
perServing: this.perServing !== undefined ? (0, common_1.floatToString)(this.perServing) : "",
|
|
83
|
+
};
|
|
84
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { StringDict } from "../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../geometry";
|
|
3
|
+
/**
|
|
4
|
+
* The size of a single serving of the product.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NutritionFactsLabelV1ServingSize {
|
|
7
|
+
#private;
|
|
8
|
+
/** The amount of a single serving. */
|
|
9
|
+
amount: number | null;
|
|
10
|
+
/** The unit for the amount of a single serving. */
|
|
11
|
+
unit: string | null;
|
|
12
|
+
/** Confidence score */
|
|
13
|
+
confidence: number;
|
|
14
|
+
/** The document page on which the information was found. */
|
|
15
|
+
pageId: number;
|
|
16
|
+
/**
|
|
17
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
18
|
+
* the field in the document.
|
|
19
|
+
*/
|
|
20
|
+
polygon: Polygon;
|
|
21
|
+
constructor({ prediction }: StringDict);
|
|
22
|
+
/**
|
|
23
|
+
* Default string representation.
|
|
24
|
+
*/
|
|
25
|
+
toString(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Output in a format suitable for inclusion in a field list.
|
|
28
|
+
*/
|
|
29
|
+
toFieldList(): string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 _NutritionFactsLabelV1ServingSize_instances, _NutritionFactsLabelV1ServingSize_printableValues;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.NutritionFactsLabelV1ServingSize = void 0;
|
|
10
|
+
const common_1 = require("../../parsing/common");
|
|
11
|
+
/**
|
|
12
|
+
* The size of a single serving of the product.
|
|
13
|
+
*/
|
|
14
|
+
class NutritionFactsLabelV1ServingSize {
|
|
15
|
+
constructor({ prediction = {} }) {
|
|
16
|
+
_NutritionFactsLabelV1ServingSize_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
|
+
if (prediction["amount"] !== undefined &&
|
|
25
|
+
prediction["amount"] !== null &&
|
|
26
|
+
!isNaN(prediction["amount"])) {
|
|
27
|
+
this.amount = +parseFloat(prediction["amount"]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.amount = null;
|
|
31
|
+
}
|
|
32
|
+
this.unit = prediction["unit"];
|
|
33
|
+
this.pageId = prediction["page_id"];
|
|
34
|
+
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
|
|
35
|
+
if (prediction["polygon"]) {
|
|
36
|
+
this.polygon = prediction.polygon;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Default string representation.
|
|
41
|
+
*/
|
|
42
|
+
toString() {
|
|
43
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1ServingSize_instances, "m", _NutritionFactsLabelV1ServingSize_printableValues).call(this);
|
|
44
|
+
return ("Amount: " +
|
|
45
|
+
printable.amount +
|
|
46
|
+
", Unit: " +
|
|
47
|
+
printable.unit);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Output in a format suitable for inclusion in a field list.
|
|
51
|
+
*/
|
|
52
|
+
toFieldList() {
|
|
53
|
+
const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1ServingSize_instances, "m", _NutritionFactsLabelV1ServingSize_printableValues).call(this);
|
|
54
|
+
return `
|
|
55
|
+
:Amount: ${printable.amount}
|
|
56
|
+
:Unit: ${printable.unit}`.trimEnd();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.NutritionFactsLabelV1ServingSize = NutritionFactsLabelV1ServingSize;
|
|
60
|
+
_NutritionFactsLabelV1ServingSize_instances = new WeakSet(), _NutritionFactsLabelV1ServingSize_printableValues = function _NutritionFactsLabelV1ServingSize_printableValues() {
|
|
61
|
+
return {
|
|
62
|
+
amount: this.amount !== undefined ? (0, common_1.floatToString)(this.amount) : "",
|
|
63
|
+
unit: this.unit ?? "",
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StringDict } from "../../parsing/common";
|
|
2
|
+
import { Polygon } from "../../geometry";
|
|
3
|
+
/**
|
|
4
|
+
* The amount of sodium in the product.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NutritionFactsLabelV1Sodium {
|
|
7
|
+
#private;
|
|
8
|
+
/** DVs are the recommended amounts of sodium to consume or not to exceed each day. */
|
|
9
|
+
dailyValue: number | null;
|
|
10
|
+
/** The amount of sodium per 100g of the product. */
|
|
11
|
+
per100G: number | null;
|
|
12
|
+
/** The amount of sodium per serving of the product. */
|
|
13
|
+
perServing: number | null;
|
|
14
|
+
/** The unit of measurement for the amount of sodium. */
|
|
15
|
+
unit: string | null;
|
|
16
|
+
/** Confidence score */
|
|
17
|
+
confidence: number;
|
|
18
|
+
/** The document page on which the information was found. */
|
|
19
|
+
pageId: number;
|
|
20
|
+
/**
|
|
21
|
+
* Contains the relative vertices coordinates (points) of a polygon containing
|
|
22
|
+
* the field in the document.
|
|
23
|
+
*/
|
|
24
|
+
polygon: Polygon;
|
|
25
|
+
constructor({ prediction }: StringDict);
|
|
26
|
+
/**
|
|
27
|
+
* Default string representation.
|
|
28
|
+
*/
|
|
29
|
+
toString(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Output in a format suitable for inclusion in a field list.
|
|
32
|
+
*/
|
|
33
|
+
toFieldList(): string;
|
|
34
|
+
}
|