我只想从字符串或列中提取组织结构。
我使用的是以下代码:
def ent(doc):
for x in (nlp(doc)).ents:
if x.label_ != "ORG": continue
else:
return (x.text)
d= ("Brock Group (American Industrial Partners) acquires Aegion's Energy Services Businesses")
ent(d)
但是,这个代码只提取一个组织而不是全部;在这种情况下,只给出:
'Brock Group'
1条答案
按热度按时间lzfw57am1#
您的代码只提取第一个组织名称,因为它在满足条件时返回。