zjs_project 10 miesięcy temu
rodzic
commit
a3f51c50ed

+ 9 - 8
src/pages/webgl_rxdz_recognizer_houseList/webgl_rxdz_recognizer_houseList.vue

@@ -287,8 +287,7 @@
                 // let pinyin = res.single;
                 // console.warn("****pinyin***", pinyin)
                 // text = pinyin;
-                //全匹配轮一遍
-                text = this.convertChineseToArabic(text);
+                text = this.convertChineseToArabic(text);  //中文数字转为阿拉伯数字
                 let houseIndex = this.backwardNumber(text);//获取文字里面的数字 倒数第三个 类似这样的
                 if(houseIndex){
                     houseIndex = this.houseList.length - houseIndex;
@@ -302,12 +301,14 @@
                     return false;
                 }else{
                     houseIndex = this.extractNumber(text);//获取文字里面的数字 第三个 类似这样的
-                }                
-                //全匹配轮一遍
-                houseIndex = this.houseList.findIndex(space => {
-                    return space.mateStr.includes(text);
-                })
-                if (houseIndex==null || houseIndex < 0) {
+                }
+                if (houseIndex==null || houseIndex < 0) {//没找到,则进行全匹配
+                    //全匹配轮一遍
+                    houseIndex = this.houseList.findIndex(space => {
+                        return space.mateStr.includes(text);
+                    })
+                }
+                if (houseIndex==null || houseIndex < 0) {//没匹配到,进行最长公共子集匹配
                     let list = this.houseList.map((space, index) => {
                         let comStr = this.findSubStr(text, space.mateStr);
                         return {