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
评论列表
文章目录