共指消解/指代消解 spacy+neuralcoref 排坑

在使用spaCy+neuralcoref进行指代消解时遇到兼容性问题,包括Segmentation fault、KeyError和ValueError。通过确定python、spacy、neuralcoref和en_core_web_sm的特定版本(如python 3.8.16、spacy 2.1.0、neuralcoref 4.0和en_core_web_sm 2.1.0)解决了问题。可以使用`python -m spacy validate`检查模型版本,并从指定源码地址下载安装。
摘要由CSDN通过智能技术生成

背景

模型需要用到指代消解功能,查询到比较好用的是spaCy+neuralcoref。代码简单,但是出现了很多兼容性问题,neuralcoref相当于一个插件,在spaCy框架下实现指代消解,安装很多版本都不能顺利运行,各种error。最终找到一个匹配的版本。

问题

  1. Segmentation fault (core dumped)
  2. KeyError: “[E002] Can’t find factory for ‘tok2vec’. This usually happens when spaCy calls nlp.create_pipe with a component name that’s not built in - for example, when constructing the pipeline from a model’s meta.json. If you’re using a custom component, you can write to Language.factories['tok2vec'] or remove it from the model meta and add it via nlp.add_pipe instead.”
  3. ValueError: spacy.strings.StringStore size changed, may indicate binary incompatibility. Expected 80 from C header, got 64 from PyObject

解决

版本

python 3.8.16
spacy 2.1.0
neuralcoref 4.0
en_core_web_sm 2.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值