【发布时间】:2020-03-02 20:10:59
【问题描述】:
我正在使用 spacy 的 displacy 可视化工具来查看句子中单词之间的依赖关系。它看起来像这样:
text = 'European authorities fined Google a record $5.1 billion on Wednesday for abusing its power in the mobile phone market and ordered the company to alter its practices
print(displacy.render(nlp(text), jupyter=True, style='ent'))
print(displacy.render(nlp(text), style='dep', jupyter = True, options = {'distance': 120}))
有没有办法通过索引字符串中的单词来提取箭头所建立的连接?例如,在下图中,查看“欧洲当局对 Google 处以罚款”中的关联。无论如何要制作以下数据框(单词列中的每个单词,以及该单词在连接列中连接的每个单词)?:
word | connection
---------------------------
European |
Authorities| European
fined | Authorities, Google, record, ..., ...
Google |
【问题讨论】: