Что бы я хотел сделать
Я хотел бы запустить образец кода для spaCy neuralcoref в Google Colaboratory.
Код для выполнения
Я пытаюсь выполните приведенный ниже код, который аналогичен официальному примеру на странице spaCy в Google Colaboratory.
import spacy
import neuralcoref
nlp = spacy.load('en')
neuralcoref.add_to_pipe(nlp)
doc1 = nlp('My sister has a dog. She loves him.')
print(doc1._.coref_clusters)
doc2 = nlp('Angela lives in Boston. She is quite happy in that city.')
for ent in doc2.ents:
print(ent._.coref_cluster)
Проблема
В основном есть две ошибки.
Один из них возникает в части команды для установки neuralcoref
и spacy
.
!pip install neuralcoref
!pip install spacy==2.0.17
!python -m spacy download en
Сообщение об ошибке
Successfully built spacy dill regex wrapt cytoolz
ERROR: thinc 6.12.1 has requirement msgpack<0.6.0,>=0.5.6, but you'll have msgpack 1.0.0 which is incompatible.
ERROR: tensorflow 2.2.0 has requirement wrapt>=1.11.1, but you'll have wrapt 1.10.11 which is incompatible.
ERROR: neuralcoref 4.0 has requirement spacy>=2.1.0, but you'll have spacy 2.0.17 which is incompatible.
ERROR: multiprocess 0.70.10 has requirement dill>=0.3.2, but you'll have dill 0.2.9 which is incompatible.
ERROR: fastai 1.0.61 has requirement spacy>=2.0.18; python_version < "3.8", but you'll have spacy 2.0.17 which is incompatible.
ERROR: en-core-web-sm 2.2.5 has requirement spacy>=2.2.2, but you'll have spacy 2.0.17 which is incompatible.
Проблема со звуком, связанная с ValueError, отображается в части ниже.
Как исправить эти ошибки и запустить образец кода?
nlp = spacy.load('en')
neuralcoref.add_to_pipe(nlp)
Сообщение об ошибке
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-10a65c2e8e6b> in <module>()
2 import neuralcoref
3
----> 4 nlp = spacy.load('en')
5 neuralcoref.add_to_pipe(nlp)
10 frames
tokenizer.pyx in spacy.tokenizer.Tokenizer.from_disk()
tokenizer.pyx in spacy.tokenizer.Tokenizer.from_bytes()
/usr/local/lib/python3.6/dist-packages/msgpack_numpy.py in unpackb(packed, **kwargs)
182 object_hook = kwargs.get('object_hook')
183 kwargs['object_hook'] = functools.partial(decode, chain=object_hook)
--> 184 return _unpackb(packed, **kwargs)
185
186 load = unpack
msgpack/_unpacker.pyx in msgpack._cmsgpack.unpackb()
ValueError: int is not allowed for map key
Среда
Google Chrome
Ma c OS Catalina версии 10.15.5