mindee 4.24.0 → 4.24.1
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 +5 -0
- package/README.md +0 -5
- package/package.json +1 -1
- package/src/parsing/common/document.js +4 -1
- package/src/parsing/common/page.js +17 -7
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -166,15 +166,10 @@ Complete details on the working of the library are available in the following gu
|
|
|
166
166
|
* [Node.js Resume OCR](https://developers.mindee.com/docs/nodejs-resume-ocr)
|
|
167
167
|
* [Node.js Financial Document OCR](https://developers.mindee.com/docs/nodejs-financial-document-ocr)
|
|
168
168
|
* [Node.js Passport OCR](https://developers.mindee.com/docs/nodejs-passport-ocr)
|
|
169
|
-
* [Node.js Proof of Address OCR](https://developers.mindee.com/docs/nodejs-proof-of-address-ocr)
|
|
170
|
-
* [Node.js EU License Plate OCR](https://developers.mindee.com/docs/nodejs-eu-license-plate-ocr)
|
|
171
|
-
* [Node.js EU Driver License OCR](https://developers.mindee.com/docs/nodejs-eu-driver-license-ocr)
|
|
172
169
|
* [Node.js FR Bank Account Detail OCR](https://developers.mindee.com/docs/nodejs-fr-bank-account-details-ocr)
|
|
173
170
|
* [Node.js FR Health Card OCR](https://developers.mindee.com/docs/nodejs-fr-health-card-ocr)
|
|
174
171
|
* [Node.js FR ID Card OCR](https://developers.mindee.com/docs/nodejs-fr-carte-nationale-didentite-ocr)
|
|
175
172
|
* [Node.js US Bank Check OCR](https://developers.mindee.com/docs/nodejs-us-bank-check-ocr)
|
|
176
|
-
* [Node.js US W9 OCR](https://developers.mindee.com/docs/nodejs-us-w9-ocr)
|
|
177
|
-
* [Node.js US Driver License OCR](https://developers.mindee.com/docs/nodejs-us-driver-license-ocr)
|
|
178
173
|
* [Node.js Barcode Reader API](https://developers.mindee.com/docs/nodejs-barcode-reader-ocr)
|
|
179
174
|
* [Node.js Cropper API](https://developers.mindee.com/docs/nodejs-cropper-ocr)
|
|
180
175
|
* [Node.js Invoice Splitter API](https://developers.mindee.com/docs/nodejs-invoice-splitter-ocr)
|
package/package.json
CHANGED
|
@@ -52,7 +52,10 @@ ${this.inference?.toString()}`;
|
|
|
52
52
|
injectFullTextOcr(rawPrediction) {
|
|
53
53
|
if (rawPrediction["inference"]["pages"].length < 1 ||
|
|
54
54
|
rawPrediction["inference"]["pages"][0]["extras"].length < 1 ||
|
|
55
|
-
!("full_text_ocr" in rawPrediction["inference"]["pages"][0]["extras"])
|
|
55
|
+
!("full_text_ocr" in rawPrediction["inference"]["pages"][0]["extras"]) ||
|
|
56
|
+
!rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"] ||
|
|
57
|
+
!("content" in rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"]) ||
|
|
58
|
+
!rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"]["content"]) {
|
|
56
59
|
return;
|
|
57
60
|
}
|
|
58
61
|
const fullTextOcr = rawPrediction["inference"]["pages"].filter((e) => "extras" in e).map((e) => e["extras"]["full_text_ocr"]["content"]).join("\n");
|
|
@@ -29,13 +29,15 @@ class Page {
|
|
|
29
29
|
Object.keys(rawPrediction["extras"].length > 0)) {
|
|
30
30
|
const extras = {};
|
|
31
31
|
Object.entries(rawPrediction["extras"]).forEach(([extraKey, extraValue]) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
if (extraValue) {
|
|
33
|
+
switch (extraKey) {
|
|
34
|
+
case "cropper":
|
|
35
|
+
extras["cropper"] = new extras_1.CropperExtra(extraValue);
|
|
36
|
+
break;
|
|
37
|
+
case "full_text_ocr":
|
|
38
|
+
extras["fullTextOcr"] = new extras_1.FullTextOcrExtra(extraValue);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
this.extras = new extras_2.Extras(extras);
|
|
@@ -58,6 +60,14 @@ ${this.prediction.toString()}
|
|
|
58
60
|
if (!("extras" in rawPrediction) || !("full_text_ocr" in rawPrediction["extras"])) {
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
63
|
+
if (!rawPrediction["extras"]
|
|
64
|
+
|| rawPrediction["extras"] === null ||
|
|
65
|
+
!rawPrediction["extras"]["full_text_ocr"] ||
|
|
66
|
+
rawPrediction["extras"]["full_text_ocr"] === null ||
|
|
67
|
+
!rawPrediction["extras"]["full_text_ocr"]["content"] ||
|
|
68
|
+
rawPrediction["extras"]["full_text_ocr"]["content"] === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
61
71
|
const fullTextOcr = rawPrediction["extras"]["full_text_ocr"]["content"];
|
|
62
72
|
const artificialTextObj = {
|
|
63
73
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|