Skip to content

共指链

将指代同一实体的文本片段分组,用于共指消解任务。

共指链

共指标注允许标注者将指代同一实体的文本片段分组。这对实体消解、代词消解和语篇分析至关重要。

概述

共指链是指代同一现实世界实体的一组提及(文本片段)。例如:

"居里夫人是一位物理学家。获得了诺贝尔奖。这位科学家永远改变了她的领域。"

"居里夫人"、"她"、"这位科学家"和"她的"都指代同一个人,形成一条共指链。

快速入门

共指标注需要两个方案组件:

  1. 用于创建提及的片段方案
  2. 用于将提及分组到链中的共指方案
yaml
annotation_schemes:
  - annotation_type: span
    name: mentions
    description: Highlight all entity mentions
    labels:
      - name: MENTION
        tooltip: "Any reference to an entity"
    sequential_key_binding: true
 
  - annotation_type: coreference
    name: coref_chains
    description: Group mentions that refer to the same entity
    span_schema: mentions
    allow_singletons: true

配置选项

字段类型默认值描述
annotation_typestring必填必须为 "coreference"
namestring必填此方案的唯一标识符
descriptionstring必填显示给标注者的说明
span_schemastring必填提供提及的片段方案名称
entity_typeslist[]实体类型类别列表
allow_singletonsbooleantrue允许仅包含一个提及的链
visual_display.highlight_modestring"background"视觉样式:"background""bracket""underline"

示例

带实体类型

按实体类型对链进行分类:

yaml
annotation_schemes:
  - annotation_type: span
    name: ner
    description: Mark named entities
    labels:
      - name: ENTITY
        tooltip: "Any named entity mention"
 
  - annotation_type: coreference
    name: coref
    description: Create coreference chains
    span_schema: ner
    entity_types:
      - name: PERSON
        color: "#6E56CF"
      - name: ORGANIZATION
        color: "#22C55E"
      - name: LOCATION
        color: "#3B82F6"
      - name: OTHER
        color: "#F59E0B"

不允许单例

对于每个提及必须至少与另一个提及链接的任务:

yaml
annotation_schemes:
  - annotation_type: span
    name: mentions
    description: Highlight co-referring mentions
    labels:
      - name: MENTION
 
  - annotation_type: coreference
    name: strict_coref
    description: All mentions must be part of a chain with at least 2 mentions
    span_schema: mentions
    allow_singletons: false

自定义视觉显示

yaml
annotation_schemes:
  - annotation_type: coreference
    name: coref
    description: Link coreference chains
    span_schema: mentions
    visual_display:
      highlight_mode: "underline"  # Options: background, bracket, underline

用户界面

创建链

  1. 创建提及:使用片段标注工具高亮所有实体提及
  2. 选择提及:点击您想要链接在一起的高亮片段
  3. 创建链:点击"新建链"将选中的提及分组

管理链

  • 添加到链:选择额外的提及并点击"添加到链"
  • 合并链:选择多条链并点击"合并链"来组合它们
  • 移除提及:选择一个提及并点击"移除提及"将其从链中移除

颜色编码

每条链自动分配一种独特的颜色。同一链中的提及共享相同的颜色,便于直观地识别链的成员关系。

输出格式

共指标注作为片段链接保存:

json
{
  "span_links": [
    {
      "schema": "coref_chains",
      "link_type": "coreference",
      "span_ids": ["mentions_0_5_MENTION", "mentions_34_37_MENTION", "mentions_72_85_MENTION"],
      "entity_type": "PERSON"
    },
    {
      "schema": "coref_chains",
      "link_type": "coreference",
      "span_ids": ["mentions_15_23_MENTION", "mentions_95_97_MENTION"],
      "entity_type": "ORGANIZATION"
    }
  ]
}

推荐工作流程

  1. 第一遍 - 通读文本并高亮所有实体提及
  2. 第二遍 - 将提及分组到共指链中
  3. 审查 - 检查所有提及是否正确分配,是否遗漏任何链

最佳实践

  1. 定义清晰的提及边界 - 建立什么算作提及的指导方针
  2. 处理嵌套提及 - 决定如何处理"微软的CEO"等情况
  3. 考虑泛指 - 确定是否应包含泛指引用
  4. 培训标注者 - 共指是复杂的;提供示例和练习轮次
  5. 谨慎使用实体类型 - 过多可能会减慢标注速度而不提高数据质量

延伸阅读

有关实现细节,请参阅源文档