__init__.py 文件源码

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

项目:my_bit_v1 作者: iSawyer 项目源码 文件源码
def cut(sentence, HMM=True):
    """
    Global `cut` function that supports parallel processing.

    Note that this only works using dt, custom POSTokenizer
    instances are not supported.
    """
    global dt
    if jieba.pool is None:
        for w in dt.cut(sentence, HMM=HMM):
            yield w
    else:
        parts = strdecode(sentence).splitlines(True)
        if HMM:
            result = jieba.pool.map(_lcut_internal, parts)
        else:
            result = jieba.pool.map(_lcut_internal_no_hmm, parts)
        for r in result:
            for w in r:
                yield w
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号