@xuda.io/drive_module 1.1.952 → 1.1.953
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/index.js +4 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -26,7 +26,7 @@ const crypto = require("node:crypto");
|
|
|
26
26
|
const unzipper = require("unzipper");
|
|
27
27
|
const fs = require("fs");
|
|
28
28
|
const tesseract = require("node-tesseract-ocr");
|
|
29
|
-
|
|
29
|
+
const franc = require("franc");
|
|
30
30
|
////////////////////////////////////////////
|
|
31
31
|
|
|
32
32
|
[
|
|
@@ -1723,15 +1723,11 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1723
1723
|
);
|
|
1724
1724
|
|
|
1725
1725
|
var ocr = "";
|
|
1726
|
+
const generalConfig = { lang: "eng", oem: 1, psm: 3 };
|
|
1726
1727
|
|
|
1727
1728
|
switch (doc.mime.split("/")[0]) {
|
|
1728
1729
|
case "image": {
|
|
1729
|
-
ocr = await tesseract.recognize(target_file,
|
|
1730
|
-
// lang: "eng",
|
|
1731
|
-
lang: "eng+heb",
|
|
1732
|
-
oem: 1,
|
|
1733
|
-
psm: 3,
|
|
1734
|
-
});
|
|
1730
|
+
ocr = await tesseract.recognize(target_file, generalConfig);
|
|
1735
1731
|
|
|
1736
1732
|
break;
|
|
1737
1733
|
}
|
|
@@ -1743,11 +1739,7 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1743
1739
|
|
|
1744
1740
|
const images = await convertPDF(target_file);
|
|
1745
1741
|
for await (const imageData of images) {
|
|
1746
|
-
ocr += await tesseract.recognize(imageData.path,
|
|
1747
|
-
// lang: "eng",
|
|
1748
|
-
oem: 1,
|
|
1749
|
-
psm: 3,
|
|
1750
|
-
});
|
|
1742
|
+
ocr += await tesseract.recognize(imageData.path, generalConfig);
|
|
1751
1743
|
}
|
|
1752
1744
|
break;
|
|
1753
1745
|
}
|