Add bounds check for postprocess_utils.py abbr_dispose() (#2209)

"/Users/{USER}/.pyenv/versions/funasr_usage/lib/python3.12/site-packages/funasr/utils/postprocess_utils.py", line 127, in abbr_dispose
    end = time_stamp[ts_nums[num]][1]
          ~~~~~~~~~~^^^^^^^^^^^^^^
IndexError: list index out of range
This commit is contained in:
Steve Li
2024-11-15 11:03:31 +08:00
committed by GitHub
parent ef1d7b3f12
commit 8cd0d4aab7
+1 -1
View File
@@ -122,7 +122,7 @@ def abbr_dispose(words: List[Any], time_stamp: List[List] = None) -> List[Any]:
abbr_word += words[num].upper()
num += 1
word_lists.append(abbr_word)
if time_stamp is not None:
if time_stamp is not None and ts_nums[num] < len(time_stamp):
end = time_stamp[ts_nums[num]][1]
ts_lists.append([begin, end])
else: