NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

PharmacoNER Tagger: a deep learning-based tool for automatically finding chemicals and drugs in Spanish medical texts

Jordi Armengol-Estapé, Felipe Soares, Montserrat Marimon, Martin KrallingerGenomics 2019

Abstract

Automatically detecting mentions of pharmaceutical drugs and chemical substances is key for the subsequent extraction of relations of chemicals with other biomedical entities such as genes, proteins, diseases, adverse reactions or symptoms. The identification of drug mentions is also a prior step for complex event types such as drug dosage recognition, duration of medical treatments or drug repurposing. Formally, this task is known as named entity recognition (NER), meaning automatically identifying mentions of predefined entities of interest in running text. In the domain of medical texts, for chemical entity recognition (CER), techniques based on hand-crafted rules and graph-based models can provide adequate performance. In the recent years, the field of natural language processing has mainly pivoted to deep learning and state-of-the-art results for most tasks involving natural language are usually obtained with artificial neural networks. Competitive resources for drug name recognition in English medical texts are already available and heavily used, while for other languages such as Spanish these tools, although clearly needed were missing. In this work, we adapt an existing neural NER system, NeuroNER, to the particular domain of Spanish clinical case texts, and extend the neural network to be able to take into account additional features apart from the plain text. NeuroNER can be considered a competitive baseline system for Spanish drug and CER promoted by the Spanish national plan for the advancement of language technologies (Plan TL). PharmacoNER Tagger can be accessed at https://github.com/PlanTL-SANIDAD/PharmacoNER.

Introduction

The identification of pharmaceutical drugs and chemical substances is a foundational task in biomedical text mining. Known as Named Entity Recognition (NER), this process is essential for downstream tasks such as extracting relations between chemicals and genes, diseases, or adverse reactions. While English-language clinical research benefits from a wealth of open-source NER tools, other major languages like Spanish have historically lacked robust, specialized resources for Chemical Entity Recognition (CER).

Spanish clinical notes present unique challenges. Chemical nomenclature often involves complex punctuation, long strings, and specific morphological patterns (prefixes and suffixes). Furthermore, the frequent use of acronyms and abbreviations in medical records can lead to high false-positive rates in general-purpose NER systems. To address this gap, we present the PharmacoNER Tagger, a deep learning-based tool optimized for Spanish medical texts.

Methodology: Extending NeuroNER

The PharmacoNER Tagger is built upon the NeuroNER architecture, a state-of-the-art framework for NER. We extended this base model to better handle the nuances of the Spanish medical domain by incorporating additional "hand-crafted" features alongside neural embeddings.

The architecture consists of three primary layers:

  1. Character-enhanced token embedding layer: A Bidirectional Long Short-Term Memory (Bi-LSTM) network processes individual characters to capture morphological nuances, which are then combined with word-level embeddings.
  2. Label prediction layer: A second Bi-LSTM processes the sequence of embeddings to predict entity labels.
  3. Label sequence optimization layer: A Conditional Random Field (CRF) layer ensures that the predicted label sequences are globally optimal and follow valid tagging schemes (e.g., BIO tagging).

Our primary innovation involves the integration of external knowledge sources into the neural network to provide context that raw text alone might miss:

  • Part-of-Speech (POS) Features: Syntactic context is provided via one-hot encoded POS tags.
  • Gazetteer Features: A boolean mapping to a comprehensive dictionary of drug names and active ingredients maintained by the Spanish government.
  • Affix Features: Regular expressions are used to identify common chemical suffixes (e.g., -caine) and prefixes.
The extended PharmacoNER architecture incorporating character-level embeddings and hand-crafted features (POS, gazetteers, and affixes).

Data and Experimental Setup

The model was trained and evaluated using the SPACCC dataset, which contains 1,000 manually annotated Spanish clinical cases. The dataset includes categories such as Normalizables (standard chemical entities), Proteins, and Unclear mentions.

A critical component of the training process was the selection of word embeddings. We compared eight different pre-trained sets, ranging from general-domain Spanish corpora to domain-specific data. Our findings indicated that embeddings trained on a combination of SciELO (scientific literature) and health-related Wikipedia outperformed larger, general-purpose datasets, highlighting the importance of domain alignment in pre-training.

Results and Key Insights

The final model configuration, utilizing FastText SciELO + Health Wikipedia embeddings combined with POS and Gazetteer features, achieved high performance on the SPACCC test set:

  • F1 Score: 89.06
  • Precision: 91.35%
  • Recall: 86.89%

The high precision score is particularly noteworthy, as it indicates a low rate of false positives—a common issue in clinical text mining. The minimal performance gap between the validation and test sets suggests that the model generalizes well to unseen clinical data.

Two major insights emerged from this work. First, domain-specific embeddings are vital; the context a model learns during pre-training must match the target domain to be effective. Second, neural networks benefit from "old school" features. While deep learning is often touted as a way to avoid manual feature engineering, explicitly feeding the model dictionaries (gazetteers) and morphological rules provides a significant performance boost in technical domains.

Conclusion

The PharmacoNER Tagger demonstrates that deep learning models can be significantly enhanced by incorporating traditional features, especially in technical domains where data may be sparse. While the pre-processing components are tailored for Spanish, the underlying architecture remains language-agnostic, providing a template for developing similar tools in other under-resourced languages. Future work will focus on refining the tool for the PharmacoNER BioNLP shared task and extending its capabilities to recognize more complex events, such as drug-drug interactions and treatment durations.

Summary updated

BibTeX
@inproceedings{armengolestape2019pharmaconer,
  author = {Jordi Armengol-Estapé and Felipe Soares and Montserrat Marimon and Martin Krallinger},
  title = {{PharmacoNER Tagger: a deep learning-based tool for automatically finding chemicals and drugs in Spanish medical texts}},
  booktitle = {Genomics},
  year = {2019},
  doi = {10.5808/gi.2019.17.2.e15},
}
Figure