| | |
| | | |
| | | try{ |
| | | m_session = std::make_unique<Ort::Session>(env_, punc_model.c_str(), session_options); |
| | | LOG(INFO) << "Successfully load model from " << punc_model; |
| | | } |
| | | catch (std::exception const &e) { |
| | | LOG(ERROR) << "Error when load punc onnx model: " << e.what(); |
| | |
| | | vector<string> WordWithPunc; |
| | | for (int i = 0; i < InputStr.size(); i++) |
| | | { |
| | | if (i > 0 && !(InputStr[i][0] & 0x80) && (i + 1) <InputStr.size() && !(InputStr[i+1][0] & 0x80))// �м��Ӣ�ģ� |
| | | // if (i > 0 && !(InputStr[i][0] & 0x80) && (i + 1) <InputStr.size() && !(InputStr[i+1][0] & 0x80))// �м��Ӣ�ģ� |
| | | if (i > 0 && !(InputStr[i-1][0] & 0x80) && !(InputStr[i][0] & 0x80)) |
| | | { |
| | | InputStr[i] = InputStr[i]+ " "; |
| | | InputStr[i] = " " + InputStr[i]; |
| | | } |
| | | WordWithPunc.push_back(InputStr[i]); |
| | | |
| | |
| | | return punction; |
| | | } |
| | | |
| | | } // namespace funasr |
| | | } // namespace funasr |