mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
bugfix v1.1.11
This commit is contained in:
parent
5fc1d918aa
commit
2330e58f5f
@ -126,10 +126,10 @@ def abbr_dispose(words: List[Any], time_stamp: List[List] = None) -> List[Any]:
|
|||||||
end = time_stamp[ts_nums[num]][1]
|
end = time_stamp[ts_nums[num]][1]
|
||||||
ts_lists.append([begin, end])
|
ts_lists.append([begin, end])
|
||||||
else:
|
else:
|
||||||
|
word_lists.append(words[num])
|
||||||
# length of time_stamp may not equal to length of words because of the (somehow improper) threshold set in timestamp_tools.py line 46, e.g., length of time_stamp can be zero but length of words is not.
|
# length of time_stamp may not equal to length of words because of the (somehow improper) threshold set in timestamp_tools.py line 46, e.g., length of time_stamp can be zero but length of words is not.
|
||||||
# Moreover, move "word_lists.append(words[num])" into if clause, to keep length of word_lists and length of ts_lists equal.
|
# Moreover, move "word_lists.append(words[num])" into if clause, to keep length of word_lists and length of ts_lists equal.
|
||||||
if time_stamp is not None and ts_nums[num] < len(time_stamp) and words[num] != " ":
|
if time_stamp is not None and ts_nums[num] < len(time_stamp) and words[num] != " ":
|
||||||
word_lists.append(words[num])
|
|
||||||
begin = time_stamp[ts_nums[num]][0]
|
begin = time_stamp[ts_nums[num]][0]
|
||||||
end = time_stamp[ts_nums[num]][1]
|
end = time_stamp[ts_nums[num]][1]
|
||||||
ts_lists.append([begin, end])
|
ts_lists.append([begin, end])
|
||||||
@ -302,6 +302,7 @@ def sentence_postprocess_sentencepiece(words):
|
|||||||
sentence = "".join(word_lists)
|
sentence = "".join(word_lists)
|
||||||
return sentence, real_word_lists
|
return sentence, real_word_lists
|
||||||
|
|
||||||
|
|
||||||
emo_dict = {
|
emo_dict = {
|
||||||
"<|HAPPY|>": "😊",
|
"<|HAPPY|>": "😊",
|
||||||
"<|SAD|>": "😔",
|
"<|SAD|>": "😔",
|
||||||
@ -365,7 +366,15 @@ emoji_dict = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emo_set = {"😊", "😔", "😡", "😰", "🤢", "😮"}
|
emo_set = {"😊", "😔", "😡", "😰", "🤢", "😮"}
|
||||||
event_set = {"🎼", "👏", "😀", "😭", "🤧", "😷",}
|
event_set = {
|
||||||
|
"🎼",
|
||||||
|
"👏",
|
||||||
|
"😀",
|
||||||
|
"😭",
|
||||||
|
"🤧",
|
||||||
|
"😷",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def format_str_v2(s):
|
def format_str_v2(s):
|
||||||
sptk_dict = {}
|
sptk_dict = {}
|
||||||
@ -386,9 +395,11 @@ def format_str_v2(s):
|
|||||||
s = s.replace(emoji + " ", emoji)
|
s = s.replace(emoji + " ", emoji)
|
||||||
return s.strip()
|
return s.strip()
|
||||||
|
|
||||||
|
|
||||||
def rich_transcription_postprocess(s):
|
def rich_transcription_postprocess(s):
|
||||||
def get_emo(s):
|
def get_emo(s):
|
||||||
return s[-1] if s[-1] in emo_set else None
|
return s[-1] if s[-1] in emo_set else None
|
||||||
|
|
||||||
def get_event(s):
|
def get_event(s):
|
||||||
return s[0] if s[0] in event_set else None
|
return s[0] if s[0] in event_set else None
|
||||||
|
|
||||||
@ -410,4 +421,3 @@ def rich_transcription_postprocess(s):
|
|||||||
new_s += s_list[i].strip().lstrip()
|
new_s += s_list[i].strip().lstrip()
|
||||||
new_s = new_s.replace("The.", " ")
|
new_s = new_s.replace("The.", " ")
|
||||||
return new_s.strip()
|
return new_s.strip()
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.1.10
|
1.1.11
|
||||||
Loading…
Reference in New Issue
Block a user