process_input.py 文件源码

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

项目:Alfred 作者: JohnGiorgi 项目源码 文件源码
def load_spacy_model(disable=False):
    """
    Returns loaded spacy pipeline

    Args:
        disable: a list of pipeline components to disable from loaded spacy
        model. Can signifcantly increase speed.

    Returns:
        spacy pipeline
    """
    # if diable is not false, load spacy model with modified pipeline
    # otherwise, load the default pipeline
    if disable:
        try:
            nlp = spacy.load('en_core_web_sm', disable=disable)
        except:
            print('''[ERROR] You likely pased an invalid disable argument to
                     get_spacy_doc!''')
    else:
        nlp = spacy.load('en_core_web_sm')

    return nlp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号