def cut_Text(content, nomial=False):
"""
:param content: string
:param nomial: if nomial is True,only noun-like words will remain
:return:a text which format is 'a b c d'
"""
if nomial:
text = ''
words = pseg.cut(content)
for word in words:
if contain(['n'], word.flag):
text = text + ' ' + word.word
return text.strip()
else:
text = ''
words = jieba.cut(content)
for word in words:
text = text + ' ' + word
return text.strip()
评论列表
文章目录