jenojp / negspacy

spaCy pipeline object for negating concepts in text
MIT License
274 stars 36 forks source link

Is it possible to apply Negspacy over token? #18

Closed Raghu17s closed 4 years ago

Raghu17s commented 4 years ago

Hi,

How can I apply negations on the token? is it possible?

I tried following but it ended up in error. `for token in doc:

print(token.text, token._.negex)

The error is

AttributeError Traceback (most recent call last)

in 1 for token in doc: ----> 2 print(token.text, token._.negex) ~/anaconda3/envs/python3/lib/python3.6/site-packages/spacy/tokens/underscore.py in __getattr__(self, name) 33 def __getattr__(self, name): 34 if name not in self._extensions: ---> 35 raise AttributeError(Errors.E046.format(name=name)) 36 default, method, getter, setter = self._extensions[name] 37 if getter is not None: AttributeError: [E046] Can't retrieve unregistered extension attribute 'negex'. Did you forget to call the `set_extension` method? `
jenojp commented 4 years ago

Unfortunately, no as it is an extension for "spans" only.