shzhulin3 2 years ago
parent
commit
25d938f3e6

+ 2 - 2
src/comm/segment/bmm_segment.cc

@@ -25,15 +25,15 @@ void BmmSegment::ConcreteSplit(iutf8string& phrase, uint32_t appid, vector<strin
             if (wordValid(key.stlstring(), appid) == true) {
                 vector<string>::iterator iter = bmm_list.begin();
                 bmm_list.insert(iter, key.stlstring());
-                i -= key.length() - 1;
+                i -= key.length();
                 break;
             }
         }
         if (j == phrase_sub.length() - 1) {
             vector<string>::iterator iter = bmm_list.begin();
             bmm_list.insert(iter, "" + phrase_sub[j]);
+            i--;
         }
-        i -= 1;
     }
     return;
 }

+ 3 - 0
src/comm/segment/custom_segment.cc

@@ -56,4 +56,7 @@ void CustomSegment::ConcreteSplit(iutf8string& phrase, uint32_t appid, vector<st
             tmp = "";
         }
     }
+    if(tmp != ""){
+        vec.push_back(tmp);
+    }
 }

+ 2 - 2
src/comm/segment/fmm_segment.cc

@@ -24,14 +24,14 @@ void FmmSegment::ConcreteSplit(iutf8string& phrase, uint32_t appid, vector<strin
             iutf8string key = phrase_sub.utf8substr(0, j);
             if (wordValid(key.stlstring(), appid) == true) {
                 fmm_list.push_back(key.stlstring());
-                i += key.length() - 1;
+                i += key.length();
                 break;
             }
         }
         if (j == 1) {
             fmm_list.push_back(phrase_sub[0]);
+            i++;
         }
-        i += 1;
     }
     return;
 }