自定义函数集合

#分词
rls = ['?','!','“','”',':','…','(',')', '—','《','》','、','‘','’','"','\n','.', ';','#','【','】','\'',':','(','」','∠','+',',', '!','|', ] def cut_words(x): x = str(x).strip() for c in rls: x = x.replace(c,' ') x = ' '.join(x.split()) s = ' '.join(jieba.cut(x,cut_all=True)) s = ' '.join(s.split()) return s

#分字
def cut_chars(x): x = str(x).replace(' ','') y = [i for i in x] y = ' '.join(y) return y

猜你喜欢

转载自www.cnblogs.com/ylHe/p/10109630.html
今日推荐