mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
fix the issue of concatenating multiple VAD segments for en-bpe
This commit is contained in:
parent
06d7b8696f
commit
75be3ceccd
@ -257,12 +257,16 @@ extern "C" {
|
||||
int n_total = audio.GetQueueSize();
|
||||
float start_time = 0.0;
|
||||
std::string cur_stamp = "[";
|
||||
std::string lang = (offline_stream->asr_handle)->GetLang();
|
||||
while (audio.Fetch(buff, len, flag, start_time) > 0) {
|
||||
string msg = (offline_stream->asr_handle)->Forward(buff, len, true, hw_emb);
|
||||
std::vector<std::string> msg_vec = funasr::split(msg, '|');
|
||||
if(msg_vec.size()==0){
|
||||
continue;
|
||||
}
|
||||
if(lang == "en-bpe" and p_result->msg != ""){
|
||||
p_result->msg += " ";
|
||||
}
|
||||
p_result->msg += msg_vec[0];
|
||||
//timestamp
|
||||
if(msg_vec.size() > 1){
|
||||
@ -282,7 +286,6 @@ extern "C" {
|
||||
p_result->stamp += cur_stamp + "]";
|
||||
}
|
||||
if(offline_stream->UsePunc()){
|
||||
string lang = (offline_stream->asr_handle)->GetLang();
|
||||
string punc_res = (offline_stream->punc_handle)->AddPunc((p_result->msg).c_str(), lang);
|
||||
p_result->msg = punc_res;
|
||||
}
|
||||
@ -338,12 +341,16 @@ extern "C" {
|
||||
int n_total = audio.GetQueueSize();
|
||||
float start_time = 0.0;
|
||||
std::string cur_stamp = "[";
|
||||
std::string lang = (offline_stream->asr_handle)->GetLang();
|
||||
while (audio.Fetch(buff, len, flag, start_time) > 0) {
|
||||
string msg = (offline_stream->asr_handle)->Forward(buff, len, true, hw_emb);
|
||||
std::vector<std::string> msg_vec = funasr::split(msg, '|');
|
||||
if(msg_vec.size()==0){
|
||||
continue;
|
||||
}
|
||||
if(lang == "en-bpe" and p_result->msg != ""){
|
||||
p_result->msg += " ";
|
||||
}
|
||||
p_result->msg += msg_vec[0];
|
||||
//timestamp
|
||||
if(msg_vec.size() > 1){
|
||||
@ -364,7 +371,6 @@ extern "C" {
|
||||
p_result->stamp += cur_stamp + "]";
|
||||
}
|
||||
if(offline_stream->UsePunc()){
|
||||
string lang = (offline_stream->asr_handle)->GetLang();
|
||||
string punc_res = (offline_stream->punc_handle)->AddPunc((p_result->msg).c_str(), lang);
|
||||
p_result->msg = punc_res;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user