mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
Fix two bugs for blank voice (empty speech): (#1403)
First, raw text would always be present whatever param return_raw_text specified. Second, empty text from punc model would cause error during sentence assembly if sentence_timestamp specified true.
This commit is contained in:
parent
b9cfd9953a
commit
f272eb4ef7
@ -392,6 +392,7 @@ class AutoModel:
|
||||
# step.3 compute punc model
|
||||
if self.punc_model is not None:
|
||||
if not len(result["text"]):
|
||||
if return_raw_text:
|
||||
result['raw_text'] = ''
|
||||
else:
|
||||
self.punc_kwargs.update(cfg)
|
||||
@ -434,6 +435,9 @@ class AutoModel:
|
||||
distribute_spk(sentence_list, sv_output)
|
||||
result['sentence_info'] = sentence_list
|
||||
elif kwargs.get("sentence_timestamp", False):
|
||||
if not len(result['text']):
|
||||
sentence_list = []
|
||||
else:
|
||||
sentence_list = timestamp_sentence(punc_res[0]['punc_array'],
|
||||
result['timestamp'],
|
||||
raw_text,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user