cut.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:Chinese_text_classifier 作者: swordLong 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号