diff --git a/demos/TTSCppFrontend/front_demo/front_demo.cpp b/demos/TTSCppFrontend/front_demo/front_demo.cpp index 44028d2bb..a0bbd5913 100644 --- a/demos/TTSCppFrontend/front_demo/front_demo.cpp +++ b/demos/TTSCppFrontend/front_demo/front_demo.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv) { // 根据标点进行分句 LOG(INFO) << "Start to segment sentences by punctuation"; - front_inst->SplitByPunc(ws_sentence, sentence_part); + front_inst->SplitByPunc(ws_sentence, &sentence_part); LOG(INFO) << "Segment sentences through punctuation successfully"; // 分句后获取音素id diff --git a/demos/TTSCppFrontend/src/front/text_normalize.cpp b/demos/TTSCppFrontend/src/front/text_normalize.cpp index 27fd90dce..0d8e33e33 100644 --- a/demos/TTSCppFrontend/src/front/text_normalize.cpp +++ b/demos/TTSCppFrontend/src/front/text_normalize.cpp @@ -51,19 +51,19 @@ int TextNormalizer::Replace(std::wstring *sentence, // 根据标点符号切分句子 int TextNormalizer::SplitByPunc(const std::wstring &sentence, - std::vector &sentence_part) { + std::vector *sentence_part) { std::wstring temp = sentence; std::wregex reg(L"[:,;。?!,;?!]"); std::wsmatch match; while (std::regex_search(temp, match, reg)) { - sentence_part.push_back( + sentence_part->push_back( temp.substr(0, match.position(0) + match.length(0))); Replace(&temp, 0, match.position(0) + match.length(0), L""); } // 如果最后没有标点符号 if (temp != L"") { - sentence_part.push_back(temp); + sentence_part->push_back(temp); } return 0; } diff --git a/demos/TTSCppFrontend/src/front/text_normalize.h b/demos/TTSCppFrontend/src/front/text_normalize.h index cd7b6c434..d80d39559 100644 --- a/demos/TTSCppFrontend/src/front/text_normalize.h +++ b/demos/TTSCppFrontend/src/front/text_normalize.h @@ -36,7 +36,7 @@ class TextNormalizer { const int &len, const std::wstring &repstr); int SplitByPunc(const std::wstring &sentence, - std::vector &sentence_part); + std::vector *sentence_part); std::string CreateTextValue(const std::string &num, bool use_zero = true); std::string SingleDigit2Text(const std::string &num_str,