指代消解开源工具

01 简介

指代消解是自然语言处理的一大任务之一,它是信息抽取不可或缺的组成部分。在信息抽取中,由于用户关心的事件和实体间语义关系往往散布于文本的不同位置,其中涉及到的实体通常可以有多种不同的表达方式,例如某个语义关系中的实体可能是以代词形式出现的,为了更准确且没有遗漏地从文本中抽取相关信息,必须要对文章中的指代现象进行消解。指代消解不但在信息抽取中起着重要的作用,而且在机器翻译、文本摘要和问答系统等应用中也极为关键。

02 数据集

KBP2015/2016 文本指代分析英文数据集
ACE2005(跨文本指代消解)
ECB 主要用于事件的指代消解任务
OntoNotes-5.0(零指代消解,含中文和英文部分)

03 主流模型

OntoNotes-5.0数据集上的benchmark:
https://www.paperswithcode.com/sota/coreference-resolution-on-ontonotes
从上面的链接中,大概介绍以下模型:

https://github.com/shayneobrien/coreference-resolution.git
这个也是使用"End-to-end Neural Coreference Resolution" by Lee et al., 2017.  模型复现的

下面这个是同个作者更好的模型实现的

https://github.com/kentonl/e2e-coref.git
使用的模型是:Higher-order Coreference Resolution with Coarse-to-fine Inference,同样还是不支持中文

下面这个又是上面这个优化版本

https://github.com/mandarjoshi90/coref.git
在e2e_core的基础上使用spanBERT-base模型

04 开源工具

  • huggingface coref
    官方地址:
    https://github.com/huggingface/neuralcoref
    安装教程:
pip uninstall neuralcoref
git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref
pip install -r requirements.txt
pip install -e .
pip uninstall spacy # 这里的版本是2.1.x
pip install spacy   # 安装完毕之后是2.3.2


pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.g
使用教程
import spacy
import en_core_web_sm
nlp = spacy.load('en_core_web_sm')
import neuralcoref      ## ignore RuntimeWarning(s)
neuralcoref.add_to_pipe(nlp)
doc = nlp(u'My sister has a dog. She loves him.')
doc._.has_coref         ## True
doc._.coref_clusters 
doc._.coref_resolved  ## 'My sister has a dog. My sister loves a dog.'
  • standfordcorenlp
    官网地址:
    https://github.com/stanfordnlp/CoreNLP/issues/617
    安装教程:
移植stanford-corenlp-4.0.0到Linux服务器上
将以下文件放到这个文件夹中,text_file和xxx.sh。text_file是需要分析的文本
bash xxx.sh即可完成对应文本信息的分析。
运行demo,其中还需要 StanfordCoreNLP-chinese.properties
# !/bin/bash
function read_dir() {
    for afile in `ls ./text_file`
    do
        java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLP -props StanfordCoreNLP-chinese.properties -file 'text_file/'$afile -outputFormat text
    done
}
read_dir
  • fastnlp
    地址:
    https://github.com/fastnlp/fastNLP/tree/master/reproduction/coreference_resolution
    astnlp提供了英文的训练代码,基于end2end的神经网络指代消解。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值