python - NLP 共指解析
问题描述
我是 NLP 领域的新手,正在浏览这个博客: https ://blog.goodaudience.com/learn-natural-language-processing-from-scratch-7893314725ff
伦敦是英格兰和英国的首都和最大城市。伦敦位于英格兰东南部的泰晤士河畔,位于通向北海的 50 英里(80 公里)河口的顶端,两千年来一直是主要定居点。它是由罗马人建立的。
我有使用 spacy 进行 NER 和 POS 标记的经验。我想知道我将如何将伦敦与它联系起来,例如:
伦敦是首都......
这是一个主要的解决方案。
它是由罗马人建立的......
我已经尝试过依赖解析器,但无法产生相同的结果。 https://explosion.ai/demos/displacy
我愿意使用任何其他库,请提出正确的方法来实现它
解决方案
您要解决的问题称为Coreference resolution。
依赖解析器通常不是解决它的正确工具。
Spacy 有一个名为neurocoref的专用模块。也看看这个页面关于Spacy 的共指解析
一个例子:
import spacy
import neuralcoref
nlp = spacy.load('en_core_web_sm')
neuralcoref.add_to_pipe(nlp)
doc = nlp('London is the capital of and largest city in England and the United Kingdom. It was founded by the Romans.')
print(doc._.coref_clusters)
#output: [London: [London, It]]
希望这可以帮助
推荐阅读
- javascript - 未捕获的类型错误:在倒计时时无法设置属性“innerText”为空,JAVASCRIPT
- nginx - NGINX Reverseproxy 问题:在 ReverseProxy 后面发布 Web 应用
- pine-script - 仅针对特定时间范围绘制 EMa
- c# - 一个单元格中的多个条件格式 ClosedXML
- python - 由于错误无法在 MAC OS 上安装 rpy2:backports.zoneinfo 的构建轮失败
- primeng - 有没有更好的方法从我无法访问底层 HTML 输入的控件中删除 LastPass 图标?
- vb.net - 添加打印文档后的随机字母/数字
- entity-framework-6 - 部分服务无法构建dbcontext
- pojo - POJO 对象中的空值
- javascript - Javascript/Typescript 滚动到 DIV 的底部