比如 “D-typed variables, Python; really?!! god's 'its Gr00vy "
转化为list['D-typed', 'variables' , ',','Python' , ';' , 'really' , '?' ,'!', '!', "god's" ,"'" , 'its' , 'Gr' , '0' ,'0' , 'vy']
其中标点要和英文分开,但如果标点前后一位都是英文单词,那么他们则算一个整体(比如god's 和 D-typed),如果有数字夹在字母中间就要拆开(Gr00vy ----Gr 0 0 vy)
写了个简单的前向反向遍历,没有算法可言。。。感觉可以考虑用字典来split
因为作为连字符号的只有'和-两个,那么直接用正则表达式
re.split(r'[\s\?.\,!]+',str)