@xuda.io/drive_module 1.1.953 → 1.1.954

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 +14 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1727,6 +1727,13 @@ const ocr_drive_file = async function (app_id, doc) {
1727
1727
 
1728
1728
  switch (doc.mime.split("/")[0]) {
1729
1729
  case "image": {
1730
+ const initialText = await tesseract.recognize(
1731
+ target_file,
1732
+ generalConfig
1733
+ );
1734
+
1735
+ // Detect the language from the extracted text
1736
+ const detectedLang = franc(initialText);
1730
1737
  ocr = await tesseract.recognize(target_file, generalConfig);
1731
1738
 
1732
1739
  break;
@@ -1739,6 +1746,13 @@ const ocr_drive_file = async function (app_id, doc) {
1739
1746
 
1740
1747
  const images = await convertPDF(target_file);
1741
1748
  for await (const imageData of images) {
1749
+ const initialText = await tesseract.recognize(
1750
+ target_file,
1751
+ generalConfig
1752
+ );
1753
+
1754
+ // Detect the language from the extracted text
1755
+ const detectedLang = franc(initialText);
1742
1756
  ocr += await tesseract.recognize(imageData.path, generalConfig);
1743
1757
  }
1744
1758
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.953",
3
+ "version": "1.1.954",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {