doc = nlp('Jane has a dog. She loves him.')
doc._.has_coref, doc._.coref_clusters
(True, [Jane: [Jane, She], a dog: [a dog, him]])
However it does not work for a token nor for a span:
for t in doc:
print(t._.has_coref)
AttributeError Traceback (most recent call last)
in
1 for t in doc:
----> 2 print(t._.has_coref)
~\Anaconda3\Lib\site-packages\spacy\tokens\underscore.py in __getattr__(self, name)
28 def __getattr__(self, name):
29 if name not in self._extensions:
---> 30 raise AttributeError(Errors.E046.format(name=name))
31 default, method, getter, setter = self._extensions[name]
32 if getter is not None:
AttributeError: [E046] Can't retrieve unregistered extension attribute 'has_coref'. Did you forget to call the `set_extension` method?
This works fine:
(True, [Jane: [Jane, She], a dog: [a dog, him]])
However it does not work for a token nor for a span:
AttributeError Traceback (most recent call last)