序列标注的方法中有多种标注方式BIO、BIOSE、IOB、BILOU、BMEWO的异同

序列标注的方法中有多种标注方式:BIO、BIOSE、IOB、BILOU、BMEWO,其中前三种最为常见。各种标注方法大同小异,下面以命名实体识别为例,看一看他们之间的区别,主要关注标注方法对最终模型效果的影响。

结论写在前面:大多数情况下,直接用BIO就可以了; 大多数情况下BIO和BIOES的结果差不太多,文末展示了各个数据集上的结果。

1. BIO

  • B stands for ‘ beginning ‘ (signifies beginning of an Named Entity, i.e. NE)

  • I stands for ‘ inside ‘ (signifies that the word is inside an NE)

  • O stands for ‘ outside ‘ (signifies that the word is just a regular word outside of an NE)

2. BIOES

  • B stands for ‘ beginning ‘ (signifies beginning of an NE)

  • I stands for ‘ inside ‘ (signifies that the word is inside an NE)

  • O stands for ‘ outside ‘ (signifies that the word is just a regular word outside of an NE)

  • E stands for ‘ end ‘ (signifies that the word is the end of an NE)

  • S stands for ‘ singleton ‘(signifies that the single word is an NE )

3.  IOB (即IOB-1)

    IOB与BIO字母对应的含义相同,其不同点是IOB中,标签B 仅用于 两个连续的同类型命名实体的边界区分,不用于命名实体的起始位置,这里举个例子:

词序列:(word)(word)(word)(word)(word)(word)

IOB标注:(I-loc)(I-loc)(B-loc)(I-loc)(o)(o)

BIO标注:(B-loc)(I-loc)(B-loc)(I-loc)(o)(o)

The IOB scheme is similar to the BIO scheme,however, here the tag B- is only used to start a segment if the previous token is of the same class but is not part of the segment.

因为IOB的整体效果不好,所以出现了IOB-2,约定了所有命名实体均以B tag开头。这样IOB-2就与BIO的标注方式等价了。

4. BILOU (等价于 BIOES)

  • B stands for ‘ beginning ‘ (signifies beginning of an NE)

  • I stands for ‘ inside ‘ (signifies that the word is inside an NE)

  • O stands for ‘ outside ‘ (signifies that the word is just a regular word outside of an NE)

  • L stands for ‘ last ‘ (signifies that the last word of an NE)

  • U stands for ‘ unit ‘(signifies that the single word is an NE )

5. BMEWO (等价于 BIOES)

  • B stands for ‘ beginning ‘ (signifies beginning of an NE)

  • M stands for ‘ middle ‘ (signifies that the word is inside an NE)

  • O stands for ‘ outside ‘ (signifies that the word is just a regular word outside of an NE)

  • E stands for ‘ end ‘ (signifies that the word is the end of an NE)

  • W stands for ‘ whole ‘(signifies that the whole word is an NE )

综上,诸多主流的序列标注方法本质上就有3种,BIO,IOB,IBOES,这里简单分析一下:

  1. IOB因为缺少B-tag作为实体标注的头部表示,丢失了部分标注信息,导致很多任务上的效果不佳

  2. BIO解决了IOB的问题,所以整体效果优于IOB

  3. BIOES额外提供了End的信息,并给出了单个词汇的S-tag,提供了更多的信息,可能效果更优,但其需要预测的标签更多(多了E和S),效果也可能受到影响。

下面来看一下各个标注方法的效果比较:

先来看一下数据集,都是比较经典的序列标注数据集,第一列是任务类型:

接下来看一下各个标注方法的效果(这些数字均为多次实验采样的结果):

结论:

  1. 可以看到IOB表现很糟糕,BIO和BIOES各有优劣,网上也有一些小伙伴反馈说:BIO和BIOES在很多任务上的表现差异不大,可能是小数点后3-4位的差别。

  2. 所有上述结果均为英文数据集上的结果,中文数据上暂无对比结果。

    基于BIOES这个标注格式,衍生出了更加复杂的标注方法, 明确了命名实体边界的边界,比如: BMEWO+(There is also BMEWO+, which put more information about surrounding word class to Outside tokens (thus “O plus”))这里给出一个图表以示区别:

BMEWO+标注方法的效果方面有待检验。感兴趣的小伙伴可关注一下Ref 2,在文章中还给出了多种标注方法的复杂度分析。

Reference

1. Optimal Hyperparameters for Deep LSTM-Networks for SequenceLabeling Tasks 

2. Coding Chunkers as Taggers: IO, BIO, BMEWO, and BMEWO+  

3. 中文命名实体识别的 github repo

推荐阅读

征稿启示| 200元稿费+5000DBC(价值20个小时GPU算力)

文本自动摘要任务的“不完全”心得总结番外篇——submodular函数优化

Node2Vec 论文+代码笔记

模型压缩实践收尾篇——模型蒸馏以及其他一些技巧实践小结

中文命名实体识别工具(NER)哪家强?

学自然语言处理,其实更应该学好英语

斯坦福大学NLP组Python深度学习自然语言处理工具Stanza试用

太赞了!Springer面向公众开放电子书籍,附65本数学、编程、机器学习、深度学习、数据挖掘、数据科学等书籍链接及打包下载

数学之美中盛赞的 Michael Collins 教授,他的NLP课程要不要收藏?

自动作诗机&藏头诗生成器:五言、七言、绝句、律诗全了

这门斯坦福大学自然语言处理经典入门课,我放到B站了

关于AINLP

AINLP 是一个有趣有AI的自然语言处理社区,专注于 AI、NLP、机器学习、深度学习、推荐算法等相关技术的分享,主题包括文本摘要、智能问答、聊天机器人、机器翻译、自动生成、知识图谱、预训练模型、推荐系统、计算广告、招聘信息、求职经验分享等,欢迎关注!加技术交流群请添加AINLPer(id:ainlper),备注工作/研究方向+加群目的。

阅读至此了,点个在看吧 :point_down: