为什么使用“ doc = nlp()”?为什么我们将其转换为nlp [关闭]

问题描述 投票:-2回答:1
nlp = spacy.load('en_core_web_sm') s2 = 'Revenue from the advertising and subscription business for the first quarter of 2019' doc = nlp(s2)
python machine-learning text nlp spacy
1个回答
0
投票
spacy.load()返回类型为Language的对象,存储在var nlp中。如果然后键入nlp(),则可以有效地运行此__call__对象的Language方法,然后该方法将文本(字符串)转换为Doc对象。

一旦将Doc作为变量doc,您可以调用doc.ents之类的东西。

© www.soinside.com 2019 - 2024. All rights reserved.