【发布时间】:2021-01-27 03:05:34
【问题描述】:
我正在使用下面的代码通过spacy nlp.pipe 处理 40,000 个摘要,这需要 8 分钟。有没有办法进一步加快速度?我还禁用了ner。
nlp = spacy.load("en_core_web_md", disable=["ner"])
def process_abstract(df):
cleaned_text = []
document = list(nlp.pipe(df['abstract'].values))
for doc in document:
text = [token.text for token in doc
if token.is_punct==False and
token.is_stop==False and
token.like_num==False and
token.is_alpha==True
]
cleaned_text.append(' '.join(text).lower())
return cleaned_text
【问题讨论】: