jenojp / negspacy

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

Tagging 'possible' terms #45

Open MoeBensu opened 2 years ago

MoeBensu commented 2 years ago

Is your feature request related to a problem? Please describe. An additional functionality of tagging terms as 'possible': It's a feature in one of the original negex implementations as well as in pyConTextNLP. Also, some important negation corpora include such annotation (i.e. speculated/possible terms).

Describe the solution you'd like An example could like this:

doc = nlp("breast cancer may be ruled out")
for e in doc.ents:
    print(e.text, e._.negex)

Output:

breast cancer possible
  1. Obviously, this would require adjusting the return value of e._.negex to be type of i.e. string instead of bool.
  2. This implementation could help when considering the logic behind this feature. In case, anyone wanna run this negex with possible tagging enabled, check this issue here.
  3. The "possible" pre and post triggers ([PREP] and [POSP]) can be also added easily from the the same implementation's negex_triggers.txt file.

Describe alternatives you've considered None other than using this mentioned negex code separately (combined with spacy, without negspacy).

Additional context I can refer to the README as well as negex.py files in here. I imagine, step 2. is the only one that would require more work and having good understanding of negspacy.