File size: 741 Bytes
535a983 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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 |