Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: in case ignore too short text #430

Merged
merged 2 commits into from
Feb 7, 2024
Merged

Conversation

im-ling
Copy link
Contributor

@im-ling im-ling commented Feb 7, 2024

描述:

有时,字太少时,合成会被忽略掉
如图,输出结果中,
"近日"和"对此" 会被忽略(在输出结果中就没有对应的音频)
image

其他

get_tts_wav函数入参:

ref_wav_path = 上传结果
prompt_text = 上传结果
prompt_language = "Chinese"
text = "近日,茶饮品牌茶颜悦色工商变更,企业类型变更并引入新股东,市场猜测是为赴港上市做准备。对此,茶颜悦色方面对此回应称,暂时没有明确的上市计划。对于茶颜悦色的这系列变更,一家关注消费行业的投资机构分析师表示,股权变更可能是在为上市做准备,但并不代表最后能上市,是上市的必要不充分条件。但是股权变更也可能是其他情况,比如架构重组,开展新业务,引入新股东。(红星新闻)。"
text_language = "Chinese"
how_to_cut = "按标点符号切"

merge_short_text_in_array 函数测试

def merge_short_text_in_array(texts, threshold):
    if (len(texts)) < 2:
        return texts
    result = []
    text = ""
    for ele in texts:
        text += ele
        if len(text) >= threshold:
            result.append(text)
            text = ""
    if (len(text) > 0):
        if len(result) == 0:
            result.append(text)
        else:
            result[len(result) - 1] += text
    return result

texts = []
text = ""
for i in range(1, 10):
    text = text + str(i)
    texts.append(text)

print("---------------------------")
print(texts)
print(merge_short_text_in_array(texts, 6))

# edge case1
texts.append("123")
print("---------------------------")
print(texts)
print(merge_short_text_in_array(texts, 6))

# edge case2
print("---------------------------")
texts = ["1","2"]
print(texts)
print(merge_short_text_in_array(texts, 6))

@RVC-Boss RVC-Boss merged commit 57dde51 into RVC-Boss:main Feb 7, 2024
XXXXRT666 pushed a commit to XXXXRT666/GPT-SoVITS that referenced this pull request Oct 17, 2024
feat: in case ignore too short text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants