命名实体识别 (NER)
来自 [AI for Beginners Curriculum](https://github.com/microsoft/ai-for-beginners) 的实验任务。
课程内容
命名实体识别 (NER)
来自 AI for Beginners Curriculum 的实验任务。
任务
在本实验中,你需要训练一个用于医学术语的命名实体识别模型。
数据集
为了训练 NER 模型,我们需要一个标注良好的包含医学实体的数据集。BC5CDR 数据集 包含了从 1500 多篇论文中提取的疾病和化学物质实体。你可以在其网站注册后下载该数据集。
BC5CDR 数据集的格式如下:
6794356|t|Tricuspid valve regurgitation and lithium carbonate toxicity in a newborn infant.
6794356|a|A newborn with massive tricuspid regurgitation, atrial flutter, congestive heart failure, and a high serum lithium level is described. This is the first patient to initially manifest tricuspid regurgitation and atrial flutter, and the 11th described patient with cardiac disease among infants exposed to lithium compounds in the first trimester of pregnancy. Sixty-three percent of these infants had tricuspid valve involvement. Lithium carbonate may be a factor in the increasing incidence of congenital heart disease when taken during early pregnancy. It also causes neurologic depression, cyanosis, and cardiac arrhythmia when consumed prior to delivery.
6794356 0 29 Tricuspid valve regurgitation Disease D014262
6794356 34 51 lithium carbonate Chemical D016651
6794356 52 60 toxicity Disease D064420
...
在这个数据集中,第一行和第二行分别是论文标题和摘要,接下来是各个实体的信息,包括它们在标题+摘要块中的起始和结束位置。除了实体类型外,你还可以获得该实体在某些医学本体中的本体 ID。
你需要编写一些 Python 代码,将这些数据转换为 BIO 编码格式。
网络
第一次尝试 NER 时,可以使用 LSTM 网络,就像你在课程中看到的示例一样。然而,在 NLP 任务中,Transformer 架构,特别是 ,通常能取得更好的效果。预训练的 BERT 模型能够理解语言的基本结构,并且可以通过相对较小的数据集和计算成本针对特定任务进行微调。