EUVIMEDSkopri EUVIMED
Open access · CC BY 4.0

Hybrid natural language processing tool for semantic annotation of medical texts in Spanish

Leonardo Campillos-Llanos, Ana Valverde-Mateos, Adrián Capllonch-Carrión

BMC Bioinformatics · 2025

DOI: 10.1186/s12859-024-05949-6 ↗

At a glance

Journal article in BMC Bioinformatics, 2025. Written by Leonardo Campillos-Llanos and 2 co-authors. Institution: ILLA - CSIC (Spanish National Research Council), C/Albasanz 26-28, 28037, Madrid, Spain. leonardo.campillos@csic.es. Major MEDLINE topics: Natural Language Processing, Semantics. Cited 11 times so far (Crossref); 126 references. The full text is freely available (open access, CC BY 4.0). Funded by: Agencia Estatal de Investigación, Consejo Superior de Investigaciones Cientificas.

AstrattSubjectsDettalji biblijografiċiCiteRelated studies

Abstract (original language)

Background

Natural language processing (NLP) enables the extraction of information embedded within unstructured texts, such as clinical case reports and trial eligibility criteria. By identifying relevant medical concepts, NLP facilitates the generation of structured and actionable data, supporting complex tasks like cohort identification and the analysis of clinical records. To accomplish those tasks, we introduce a deep learning-based and lexicon-based named entity recognition (NER) tool for texts in Spanish. It performs medical NER and normalization, medication information extraction and detection of temporal entities, negation and speculation, and temporality or experiencer attributes (Age, Contraindicated, Negated, Speculated, Hypothetical, Future, Family_member, Patient and Other). We built the tool with a dedicated lexicon and rules adapted from NegEx and HeidelTime. Using these resources, we annotated a corpus of 1200 texts, with high inter-annotator agreement (average F1 = 0.841% ± 0.045 for entities, and average F1 = 0.881% ± 0.032 for attributes). We used this corpus to train Transformer-based models (RoBERTa-based models, mBERT and mDeBERTa). We integrated them with the dictionary-based system in a hybrid tool, and distribute the models via the Hugging Face hub. For an internal validation, we used a held-out test set and conducted an error analysis. For an external validation, eight medical professionals evaluated the system by revising the annotation of 200 new texts not used in development.

Results

In the internal validation, the models yielded F1 values up to 0.915. In the external validation with 100 clinical trials, the tool achieved an average F1 score of 0.858 (± 0.032); and in 100 anonymized clinical cases, it achieved an average F1 score of 0.910 (± 0.019).

Conclusions

The tool is available at https://claramed.csic.es/medspaner . We also release the code ( https://github.com/lcampillos/medspaner ) and the annotated corpus to train the models.

Subjects

MeSH terms (MEDLINE)

Natural Language ProcessingSemanticsHumansElectronic Health RecordsDeep LearningData MiningLanguageSpain

Author keywords

Clinical trialsDeep learning in healthcareMedical natural language processingMedical text mining toolNamed entity recognitionSpanish medical NLP

Authors and institutions

  • ILLA - CSIC (Spanish National Research Council), C/Albasanz 26-28, 28037, Madrid, Spain. leonardo.campillos@csic.es.
  • Medical Terminology Unit, Spanish Royal Academy of Medicine, C/Arrieta 12, 28013, Madrid, Spain.
  • Centro de Salud Retiro, Hospital Universitario Gregorio Marañon, C/Lope de Rueda, 43, 28009, Madrid, Spain.

Funding

  • Agencia Estatal de Investigación
  • Consejo Superior de Investigaciones Cientificas

Cite

APA

Campillos-Llanos, L., Valverde-Mateos, A., & Capllonch-Carrión, A. (2025). Hybrid natural language processing tool for semantic annotation of medical texts in Spanish. BMC Bioinformatics. https://doi.org/10.1186/s12859-024-05949-6

Vancouver

Campillos-Llanos L, Valverde-Mateos A, Capllonch-Carrión A. Hybrid natural language processing tool for semantic annotation of medical texts in Spanish. BMC Bioinformatics. 2025. doi:10.1186/s12859-024-05949-6

BibTeX
@article{CampillosLlanos2025,
  author = {Campillos-Llanos, Leonardo and Valverde-Mateos, Ana and Capllonch-Carrión, Adrián},
  title = {Hybrid natural language processing tool for semantic annotation of medical texts in Spanish},
  journal = {BMC Bioinformatics},
  year = {2025},
  doi = {10.1186/s12859-024-05949-6}
}
Start for free →