Abstract
This paper presents an open-source toolkit for negation detection. It identifies negation cues and their corresponding scope in either raw or parsed text using maximum-margin classification. The system design draws on best practice from the existing literature on negation detection, aiming for a simple and portable system that still achieves competitive performance. Pretrained models and experimental results are provided for English.
Introduction
Understanding negation is a fundamental challenge in Natural Language Processing (NLP), essential for tasks such as sentiment analysis, information extraction, and clinical coding. Distinguishing between "the patient has a fever" and "the patient has no fever" is critical for system utility. While high-performing systems were developed during the *SEM 2012 shared task, many remain "research-ware"—complex, difficult to install, or proprietary.
This work introduces a Python-based, open-source toolkit that identifies negation "cues" (e.g., not, un-) and their "scopes" (the negated parts of a sentence). By employing maximum-margin learning (SVMs and CRFs), the authors provide a portable, high-performance tool that bridges the gap between research prototypes and accessible software.
Methodology
The system decomposes negation detection into two primary stages:
- Cue Identification: This stage identifies words triggering negation. A binary Support Vector Machine (SVM) classifier is used. To maintain efficiency, a filtering approach is applied, only considering words from a known lexicon or those with specific affixes (e.g., dis-, im-, or -less).
- Scope Resolution: Once a cue is identified, the system determines the affected words. This is modeled as a sequence labeling task using a maximum-margin CRF. This approach combines structural modeling with robust margin-based optimization.
The system utilizes "best-practice" features: lexical (word forms, lemmas, POS tags) and syntactic features derived from dependency parses. Dependency-based features are preferred over complex constituency trees for their simplicity and effectiveness in scope resolution.
Experimental Setup
The system was evaluated on the Conan Doyle corpus, the benchmark for the *SEM 2012 shared task. This dataset contains Sherlock Holmes stories annotated for negation. Standard splits for training, development, and held-out evaluation were used to ensure direct comparability with state-of-the-art systems.
Results and Discussion
The system demonstrates that a machine-learning approach, avoiding heavy manual heuristics, can achieve competitive results. A key finding is the stability of the maximum-margin approach; performance remains robust when moving from development to unseen held-out data.
Performance Metrics
The system's performance was evaluated using Precision (P), Recall (R), and F1-score across both stages of the pipeline.
As shown in Table 1, the system achieved an F1-score of 91.82% for cue detection on held-out data, which would have ranked 3rd in the original *SEM 2012 shared task.
For scope resolution, Table 2 details the performance across different configurations. When provided with gold-standard cues, the system achieved a scope-level F1 of 77.26% on held-out data. In a full end-to-end scenario (automatic cue and scope detection), the system reached an F1 of 71.33%, ranking 4th overall in the 2012 competition and outperforming many more complex, highly-engineered systems.
Conclusion and Future Work
The toolkit provides a lean, effective solution for negation detection. Current limitations include handling discontinuous scopes and multi-word cues (e.g., "by no means"), which often require specialized post-processing. Future work will focus on domain adaptation, particularly for biomedical text (e.g., BioScope corpus), and extending the system to speculation detection.
The source code is available at: https://github.com/marenger/negtool
Summary updated