我对使用spaCy很陌生。我已经看了好几个小时的文档了,我仍然不知道是否有可能做到我的问题。不管怎样。。。在
正如标题所说,有没有一种方法可以使用包含它的标记来实际获取给定的名词块。例如,给定一个句子:
"Autonomous cars shift insurance liability toward manufacturers"
当我只有"cars"
标记时,有可能得到"autonomous cars"
名词块吗?下面是一个我尝试使用的场景片段示例。在
^{pr2}$
任何帮助将不胜感激。谢谢!在
Tags:
通过检查标记是否位于某个名词块跨度中,可以轻松找到包含所标识标记的名词块:
en_core_web_sm和spacy 2.0.18的输出不正确,因为
shift
没有被标识为动词,因此可以得到:使用en_core_web_md,它是正确的:
(在文档中包含具有真实歧义的示例是有意义的,因为这是一个现实的场景(https://spacy.io/usage/linguistic-features#noun-chunks),但是如果新用户的分析过于模糊,以致于跨版本/模型的分析不稳定,则会让新用户感到困惑。)
相关问题 更多 >
编程相关推荐