@xuda.io/drive_module 1.1.954 → 1.1.955
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 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1734,7 +1734,8 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1734
1734
|
|
|
1735
1735
|
// Detect the language from the extracted text
|
|
1736
1736
|
const detectedLang = franc(initialText);
|
|
1737
|
-
|
|
1737
|
+
const tesseractLang = detectedLang || "eng";
|
|
1738
|
+
ocr = await tesseract.recognize(target_file, tesseractLang);
|
|
1738
1739
|
|
|
1739
1740
|
break;
|
|
1740
1741
|
}
|
|
@@ -1747,13 +1748,13 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1747
1748
|
const images = await convertPDF(target_file);
|
|
1748
1749
|
for await (const imageData of images) {
|
|
1749
1750
|
const initialText = await tesseract.recognize(
|
|
1750
|
-
|
|
1751
|
+
imageData.path,
|
|
1751
1752
|
generalConfig
|
|
1752
1753
|
);
|
|
1753
1754
|
|
|
1754
1755
|
// Detect the language from the extracted text
|
|
1755
1756
|
const detectedLang = franc(initialText);
|
|
1756
|
-
ocr += await tesseract.recognize(imageData.path,
|
|
1757
|
+
ocr += await tesseract.recognize(imageData.path, tesseractLang);
|
|
1757
1758
|
}
|
|
1758
1759
|
break;
|
|
1759
1760
|
}
|