Ama*_*mia 5 spacy jupyter-notebook
我正在尝试安装 neuralcoref 并按照此处给出的说明进行操作。
我创建了一个 jupyter notebook 并尝试运行以下代码。
# Load your usual SpaCy model (one of SpaCy English models)
import spacy
nlp = spacy.load('en')
# Add neural coref to SpaCy's pipe
import neuralcoref
neuralcoref.add_to_pipe(nlp)
# You're done. You can now use NeuralCoref as you usually manipulate a SpaCy
document annotations.
doc = nlp(u'My sister has a dog. She loves him.')
doc._.has_coref
doc._.coref_clusters
Run Code Online (Sandbox Code Playgroud)
我从 jupyter 收到一条错误消息,该内核已死。即使我尝试在 python 文件中运行,但仍然无法正常工作。
操作系统 - Windows 10 内存:16GB
注意:我确实尝试过更新 numpy,但仍然没有奏效。
任何人都可以帮助我。珍惜你的时间。谢谢
小智 5
按照这里:https : //github.com/huggingface/neuralcoref/issues/189。
如果您将 Spacy 降级到 2.1.0,您可以让它正常工作。
pip uninstall spacy
pip uninstall neuralcoref
pip install spacy==2.1.0
pip install neuralcoref --no-binary neuralcoref
Run Code Online (Sandbox Code Playgroud)
曾为他人工作,包括我自己。笔记本现在运行良好。
根本没有必要降级spacy。从源代码构建,因为neuralcoref安装pip是针对spacy==2.1.0.
证明:
建造:
git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref
pip install -r requirements.txt # correct for the desired versions of Cython and SpaCy
python setup.py install
Run Code Online (Sandbox Code Playgroud)
测试:
import spacy
import neuralcoref
nlp = spacy.load('en_core_web_md')
neuralcoref.add_to_pipe(nlp)
print(spacy.__version__)
doc = nlp(u'My sister has a dog. She loves him.')
print(doc._.has_coref)
print(doc._.coref_clusters)
2.3.2
True
[My sister: [My sister, She], a dog: [a dog, him]]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1562 次 |
| 最近记录: |