Update inference_webui.py

第459行 “cut1”函数的split_index[-1]=None导致最后八句不会被切分,改为“split_index[-1]=None”修复错误。
第508行 "cut5"函数的变量"punds"的取值重复,去掉一个";"增加一个":"
This commit is contained in:
jmaple12 2024-03-14 17:52:05 +08:00 committed by GitHub
parent c287430ecc
commit 0250161e08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -456,7 +456,8 @@ def cut1(inp):
inp = inp.strip("\n")
inps = split(inp)
split_idx = list(range(0, len(inps), 4))
split_idx[-1] = None
# split_idx[-1] = None
split_idx.append(None)
if len(split_idx) > 1:
opts = []
for idx in range(len(split_idx) - 1):
@ -505,7 +506,8 @@ def cut5(inp):
# if not re.search(r'[^\w\s]', inp[-1]):
# inp += '。'
inp = inp.strip("\n")
punds = r'[,.;?!、,。?!;:…]'
# punds = r'[,.;?!、,。?!;:…]'
punds = r'[,.;?!、,。?!;::…]'
items = re.split(f'({punds})', inp)
mergeitems = ["".join(group) for group in zip(items[::2], items[1::2])]
# 在句子不存在符号或句尾无符号的时候保证文本完整