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. 謹慎使用實體類型 - 過多可能會減慢標註速度而不提高資料品質

延伸閱讀

有關實現細節,請參閱源文件