This commit is contained in:
shzhulin3 2021-06-17 16:48:55 +08:00
parent 7943c89b58
commit 25d938f3e6
3 changed files with 7 additions and 4 deletions

View File

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

View File

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

View File

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