nlp = spacy.load('en_core_web_sm')
s2 = 'Revenue from the advertising and subscription business for the first quarter of 2019'
doc = nlp(s2)
spacy.load()
返回类型为Language
的对象,存储在var nlp
中。如果然后键入nlp()
,则可以有效地运行此__call__
对象的Language
方法,然后该方法将文本(字符串)转换为Doc
对象。一旦将Doc
作为变量doc
,您可以调用doc.ents
之类的东西。