@xuda.io/drive_module 1.1.982 → 1.1.984
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 +6 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1712,7 +1712,7 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1712
1712
|
try {
|
|
1713
1713
|
doc.ocr_stat = 2;
|
|
1714
1714
|
doc.ocr_stat_date = Date.now();
|
|
1715
|
-
|
|
1715
|
+
let save_ret = await save_drive_doc(drive_type, app_id, doc, file_path);
|
|
1716
1716
|
|
|
1717
1717
|
doc = await get_drive_doc(
|
|
1718
1718
|
"file",
|
|
@@ -1726,7 +1726,7 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1726
1726
|
|
|
1727
1727
|
function detectLanguageByCountry(cfCountry) {
|
|
1728
1728
|
const countryData = countryLanguage.getCountry(cfCountry);
|
|
1729
|
-
let lang = "
|
|
1729
|
+
let lang = "eng";
|
|
1730
1730
|
// Check if the country data is available
|
|
1731
1731
|
if (
|
|
1732
1732
|
countryData &&
|
|
@@ -1734,9 +1734,9 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1734
1734
|
countryData.languages.length > 0
|
|
1735
1735
|
) {
|
|
1736
1736
|
// Return the first official language of the country
|
|
1737
|
-
|
|
1737
|
+
|
|
1738
1738
|
for (let language of countryData.languages) {
|
|
1739
|
-
lang += `+${language.
|
|
1739
|
+
lang += `+${language.iso639_2}`;
|
|
1740
1740
|
}
|
|
1741
1741
|
}
|
|
1742
1742
|
|
|
@@ -1746,7 +1746,7 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1746
1746
|
let lang = detectLanguageByCountry(doc.country);
|
|
1747
1747
|
|
|
1748
1748
|
const generalConfig = { oem: 1, psm: 3, lang };
|
|
1749
|
-
|
|
1749
|
+
|
|
1750
1750
|
switch (doc.mime.split("/")[0]) {
|
|
1751
1751
|
case "image": {
|
|
1752
1752
|
ocr = await tesseract.recognize(target_file, generalConfig);
|
|
@@ -1818,7 +1818,7 @@ const ocr_drive_file = async function (app_id, doc) {
|
|
|
1818
1818
|
} finally {
|
|
1819
1819
|
doc.ocr_stat_ts = Date.now();
|
|
1820
1820
|
|
|
1821
|
-
|
|
1821
|
+
save_ret = await save_drive_doc(drive_type, app_id, doc, file_path);
|
|
1822
1822
|
}
|
|
1823
1823
|
};
|
|
1824
1824
|
|