Spaces:
Runtime error
Runtime error
def split_string(tokens): | |
result = [] | |
done = 1 | |
while(len(tokens) > 10 and done): | |
done = 0 | |
for i in range(10, len(tokens), 1): | |
if i > 30 : | |
if tokens[i] in [".", "。", "!", "!", "?", "?", ",", ",", "……"]: | |
result.append(tokens[:i+1]) | |
tokens = tokens[i+1:] | |
done = 1 | |
break | |
else : | |
if tokens[i] in [".", "。", "!", "!", "?","?"] : | |
result.append(tokens[:i+1]) | |
tokens = tokens[i+1:] | |
done = 1 | |
break | |
if len(tokens) > 0 : | |
result.append(tokens) | |
return result |