An NLP tool that performs negation resolution on a sentence level. It takes as input a sentence and a target-keyword. It returns True
for affirmed keywords, False
for negated and None
for keywords not found. The tool makes use of Stanford's CoreNLP constituency trees.
-
git clone https://github.com/gkotsis/negation-detection
-
Download and extract CoreNLP.
-
Install stanford_corenlp_pywrapper
-
Install through
requirements.txt
:cd negation-detection pip install -r requirements.txt
-
Edit
settings.json
. Make sure you keep the leading slashes in the directory names.
##Example
import negation_detection
sentence = "ZZZZ reported no recent periods of low mood, discussed how in the past she made many suicide attempts"
negation.predict(sentence, 'suicide')
George Gkotsis, Sumithra Velupillai, Anika Oellrich, Harry Dean, Maria Liakata and Rina Dutta. Don't Let Notes Be Misunderstood: A Negation Detection Method for Assessing Risk of Suicide in Mental Health Records, Workshop on Computational Linguistics and Clinical Psychology, NAACL 2016.