[Bug] 函数有误
Opened this issue · 0 comments
Huasushis commented
感谢大佬的源码,对我非常有帮助。
第二个函数应该加上一行:list += normal_cut_sentence(text[index:])
变为
def cut_sentence_with_quotation_marks(text):
p = re.compile("“.*?”")
list = []
index = 0
length = len(text)
for i in p.finditer(text):
temp = ''
start = i.start()
end = i.end()
for j in range(index, start):
temp += text[j]
if temp != '':
temp_list = normal_cut_sentence(temp)
list += temp_list
temp = ''
for k in range(start, end):
temp += text[k]
if temp != ' ':
list.append(temp)
index = end
list += normal_cut_sentence(text[index:])
return list
来处理剩下的字符串。