Campillos-Llanos Leonardo, Valverde-Mateos Ana, Capllonch-Carrión Adrián
ILLA - CSIC (Spanish National Research Council), C/Albasanz 26-28, 28037, Madrid, Spain.
Medical Terminology Unit, Spanish Royal Academy of Medicine, C/Arrieta 12, 28013, Madrid, Spain.
BMC Bioinformatics. 2025 Jan 8;26(1):7. doi: 10.1186/s12859-024-05949-6.
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.
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).
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.
自然语言处理(NLP)能够从非结构化文本(如临床病例报告和试验纳入标准)中提取嵌入的信息。通过识别相关医学概念,NLP有助于生成结构化且可操作的数据,支持诸如队列识别和临床记录分析等复杂任务。为完成这些任务,我们为西班牙语文本引入了一种基于深度学习和词典的命名实体识别(NER)工具。它可进行医学命名实体识别与标准化、药物信息提取、时间实体检测、否定和推测以及时间性或体验者属性(年龄、禁忌、否定、推测、假设、未来、家庭成员、患者及其他)的识别。我们使用从NegEx和HeidelTime改编而来的专用词典和规则构建了该工具。利用这些资源,我们标注了一个包含1200篇文本的语料库,标注者间一致性较高(实体的平均F1值为0.841% ± 0.045,属性的平均F1值为0.881% ± 0.032)。我们使用这个语料库来训练基于Transformer的模型(基于RoBERTa的模型、mBERT和mDeBERTa)。我们将它们与基于词典的系统集成到一个混合工具中,并通过Hugging Face中心分发这些模型。为进行内部验证,我们使用了一个留出的测试集并进行了错误分析。为进行外部验证,八名医学专业人员通过修订开发中未使用的200篇新文本的标注来评估该系统。
在内部验证中,模型的F1值高达0.915。在对100项临床试验进行的外部验证中,该工具的平均F1分数为0.858(± 0.032);在100个匿名临床病例中,其平均F1分数为0.910(± 0.019)。
该工具可在https://claramed.csic.es/medspaner获取。我们还发布了代码(https://github.com/lcampillos/medspaner)和用于训练模型的标注语料库。