@anytestforpm/ocr 1.3.6 → 1.3.8

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/ocr.js +8 -2
  2. package/package.json +1 -1
package/ocr.js CHANGED
@@ -136,7 +136,7 @@ export const recognizeOCR = async (ImageUrl) => {
136
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);
@@ -147,7 +147,13 @@ export const recognizeOCR = async (ImageUrl) => {
147
147
  }
148
148
 
149
149
  //比對合法的關鍵字
150
- let validKeyWords = configData.keywords.valid.filter((item) => resText.search(item) >= 0);
150
+ let validKeyWords = configData.keywords.valid.filter((item) => {
151
+ if (configData.region === "TH") {
152
+ return resText.search(item.replace(/\s+/g,"")) >= 0
153
+ } else {
154
+ return resText.search(item) >= 0
155
+ }
156
+ });
151
157
  console.log("search valid keywords result >>> ", validKeyWords);
152
158
  if (validKeyWords.length >= configData.config.verify_in_counts) {
153
159
  resolve(setResponseData(RESULT_TYPE.KEYWORDS_SUCCESS));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anytestforpm/ocr",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "description": "",
5
5
  "main": "ocr.js",
6
6
  "scripts": {