diff --git a/demos/TTSCppFrontend/front_demo/front_demo.cpp b/demos/TTSCppFrontend/front_demo/front_demo.cpp index 62b1945f7..0ac414a02 100644 --- a/demos/TTSCppFrontend/front_demo/front_demo.cpp +++ b/demos/TTSCppFrontend/front_demo/front_demo.cpp @@ -41,7 +41,7 @@ int main(int argc, char** argv) { // 繁体转简体 std::wstring sentence_simp; - front_inst->Trand2Simp(ws_sentence, sentence_simp); + front_inst->Trand2Simp(ws_sentence, &sentence_simp); ws_sentence = sentence_simp; std::string s_sentence; diff --git a/demos/TTSCppFrontend/src/front/front_interface.cpp b/demos/TTSCppFrontend/src/front/front_interface.cpp index 4c21851f6..4f05f4b05 100644 --- a/demos/TTSCppFrontend/src/front/front_interface.cpp +++ b/demos/TTSCppFrontend/src/front/front_interface.cpp @@ -178,17 +178,17 @@ int FrontEngineInterface::ReadConfFile() { } int FrontEngineInterface::Trand2Simp(const std::wstring &sentence, - std::wstring &sentence_simp) { + std::wstring *sentence_simp) { // sentence_simp = sentence; for (int i = 0; i < sentence.length(); i++) { std::wstring temp(1, sentence[i]); std::string sigle_word = ppspeech::wstring2utf8string(temp); // 单个字是否在繁转简的字典里 if (trand_simp_map.find(sigle_word) == trand_simp_map.end()) { - sentence_simp += temp; + sentence_simp->append(temp); } else { - sentence_simp += - (ppspeech::utf8string2wstring(trand_simp_map[sigle_word])); + sentence_simp->append( + (ppspeech::utf8string2wstring(trand_simp_map[sigle_word]))); } } diff --git a/demos/TTSCppFrontend/src/front/front_interface.h b/demos/TTSCppFrontend/src/front/front_interface.h index f766ac0eb..3628debaa 100644 --- a/demos/TTSCppFrontend/src/front/front_interface.h +++ b/demos/TTSCppFrontend/src/front/front_interface.h @@ -43,7 +43,7 @@ class FrontEngineInterface : public TextNormalizer { int ReadConfFile(); // 简体转繁体 - int Trand2Simp(const std::wstring &sentence, std::wstring &sentence_simp); + int Trand2Simp(const std::wstring &sentence, std::wstring *sentence_simp); // 生成字典 int GenDict(const std::string &file,