@anytestforpm/ocr 1.3.5 → 1.3.7
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/ocr.js +4 -4
- package/package.json +1 -1
package/ocr.js
CHANGED
|
@@ -6,14 +6,14 @@ var md5 = require('md5');
|
|
|
6
6
|
var configData = null; //configuration file returned by API
|
|
7
7
|
|
|
8
8
|
const OCR_LANGUAGE_MAP = {
|
|
9
|
-
|
|
9
|
+
VN: "vie",
|
|
10
10
|
ID: "ind",
|
|
11
11
|
IN: "hin",
|
|
12
12
|
BR: "por",
|
|
13
13
|
EN: "eng",
|
|
14
14
|
MM: "mya+eng",
|
|
15
15
|
PK: "eng",
|
|
16
|
-
|
|
16
|
+
TH: "tha+eng",
|
|
17
17
|
PH: "eng",
|
|
18
18
|
NG: "eng"
|
|
19
19
|
}
|
|
@@ -133,10 +133,10 @@ export const recognizeOCR = async (ImageUrl) => {
|
|
|
133
133
|
//OCR辨識結果的內文
|
|
134
134
|
let result = await worker.recognize(ImageUrl);
|
|
135
135
|
let resText = String(result.data.text);
|
|
136
|
-
if (configData.region === "
|
|
136
|
+
if (configData.region === "TH") {
|
|
137
137
|
resText = resText.replace(/\s+/g,"");
|
|
138
138
|
}
|
|
139
|
-
console.log("OCR Text >>> ", resText);
|
|
139
|
+
console.log("OCR Source Text >>> ", resText);
|
|
140
140
|
|
|
141
141
|
//比對不合法的關鍵字
|
|
142
142
|
let invalidKeyWords = configData.keywords.invalid.filter((item) => resText.search(item) >= 0);
|