背景
模型需要用到指代消解功能,查询到比较好用的是spaCy+neuralcoref。代码简单,但是出现了很多兼容性问题,neuralcoref相当于一个插件,在spaCy框架下实现指代消解,安装很多版本都不能顺利运行,各种error。最终找到一个匹配的版本。
问题
- Segmentation fault (core dumped)
- 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 toLanguage.factories['tok2vec']
or remove it from the model meta and add it vianlp.add_pipe
instead.” - 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.