@xuda.io/drive_module 1.1.976 → 1.1.977
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 +2 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1747,16 +1747,7 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1747
1747
|
const generalConfig = { oem: 1, psm: 3, lang };
|
|
1748
1748
|
switch (doc.mime.split("/")[0]) {
|
|
1749
1749
|
case "image": {
|
|
1750
|
-
|
|
1751
|
-
target_file,
|
|
1752
|
-
generalConfig
|
|
1753
|
-
);
|
|
1754
|
-
|
|
1755
|
-
// Detect the language from the extracted text
|
|
1756
|
-
const detectedLang = franc(initialText);
|
|
1757
|
-
debugger;
|
|
1758
|
-
const tesseractLang = detectedLang || "eng";
|
|
1759
|
-
ocr = await tesseract.recognize(target_file, tesseractLang);
|
|
1750
|
+
ocr = await tesseract.recognize(target_file, generalConfig);
|
|
1760
1751
|
|
|
1761
1752
|
break;
|
|
1762
1753
|
}
|
|
@@ -1768,15 +1759,7 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1768
1759
|
|
|
1769
1760
|
const images = await convertPDF(target_file);
|
|
1770
1761
|
for await (const imageData of images) {
|
|
1771
|
-
|
|
1772
|
-
imageData.path,
|
|
1773
|
-
generalConfig
|
|
1774
|
-
);
|
|
1775
|
-
|
|
1776
|
-
// Detect the language from the extracted text
|
|
1777
|
-
const detectedLang = franc(initialText);
|
|
1778
|
-
const tesseractLang = detectedLang || "eng";
|
|
1779
|
-
ocr += await tesseract.recognize(imageData.path, tesseractLang);
|
|
1762
|
+
ocr += await tesseract.recognize(imageData.path, generalConfig);
|
|
1780
1763
|
}
|
|
1781
1764
|
break;
|
|
1782
1765
|
}
|