代码如下:

import jieba
import jieba.analyse
import jieba.posseg

def dosegment_all(sentence):
    sentence_seged = jieba.posseg.cut(sentence.strip())
    outstr = ''
    for x in sentence_seged:
        outstr+="{}/{},".format(x.word,x.flag)
    return outstr