#coding=utf-8import jiebaimport jieba.posseg as psegstring='祖籍浙江省温州市,1975年2月28日出生于浙江温州,歌手。1987年考上浙江温州清县小百花越剧团,在团里唱小生。'words = pseg.cut(string)#进行分词result="" #记录最终结果的变量for w in words: result+= str(w.word)+"/"+str(w.flag) #加词性标注print(result)