@xuda.io/drive_module 1.1.954 → 1.1.956

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.
Files changed (2) hide show
  1. package/index.js +5 -3
  2. 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
- ocr = await tesseract.recognize(target_file, generalConfig);
1737
+ const tesseractLang = detectedLang || "eng";
1738
+ ocr = await tesseract.recognize(target_file, tesseractLang);
1738
1739
 
1739
1740
  break;
1740
1741
  }
@@ -1747,13 +1748,14 @@ 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
- target_file,
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, generalConfig);
1757
+ const tesseractLang = detectedLang || "eng";
1758
+ ocr += await tesseract.recognize(imageData.path, tesseractLang);
1757
1759
  }
1758
1760
  break;
1759
1761
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.954",
3
+ "version": "1.1.956",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {