#分词
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
posted on 2018-12-12 17:31  Google-boy  阅读(221)  评论(0)    收藏  举报