Skip to content

對話標註

標註對話和多項文本,支援特殊顯示選項。

Potato 支援標註多項資料,其中每個實例包含一組文本元素。常用於:

  • 對話標註:包含多個輪次的對話
  • 成對比較:比較兩個或多個文本變體
  • 多文件任務:評分或標記多個相關文本

資料格式

輸入資料

多項資料在 text 欄位中以字串列表表示:

json
{"id": "conv_001", "text": ["Tom: Isn't this awesome?!", "Sam: Yes! I like you!", "Tom: Great!", "Sam: Awesome! Let's party!"]}
{"id": "conv_002", "text": ["Tom: I am so sorry for that", "Sam: No worries", "Tom: Thanks for your understanding!"]}

列表中的每個字串代表一個項目(例如對話輪次、文件變體)。

配置

基本設定

yaml
# Data configuration
data_files:
  - data/dialogues.json
 
item_properties:
  id_key: id
  text_key: text
 
# Configure list display
list_as_text:
  text_list_prefix_type: none  # No prefix since speaker names are in text
  alternating_shading: true    # Shade every other turn for readability
 
# Annotation schemes
annotation_schemes:
  - annotation_type: radio
    name: sentiment
    description: "What is the overall sentiment of this conversation?"
    labels:
      - positive
      - neutral
      - negative

顯示選項

list_as_text 配置控制列表項的顯示方式:

yaml
list_as_text:
  text_list_prefix_type: alphabet  # Prefix type for items
  horizontal: false                # Layout direction
  alternating_shading: false       # Shade alternate turns

字首類型

選項示例適用場景
alphabetA. B. C.成對比較、選項
number1. 2. 3.順序輪次、有序列表
bullet. . .無序項目
none(無字首)文本中包含說話者名稱的對話

佈局選項

選項描述
horizontal: false垂直佈局(預設)- 項目堆疊
horizontal: true並排佈局 - 用於成對比較
alternating_shading: true為對話交替設定背景色

配置示例

對話標註

yaml
annotation_task_name: Dialogue Analysis
 
data_files:
  - data/dialogues.json
 
item_properties:
  id_key: id
  text_key: text
 
list_as_text:
  text_list_prefix_type: none
  alternating_shading: true
 
annotation_schemes:
  - annotation_type: span
    name: certainty
    description: Highlight phrases expressing certainty or uncertainty
    labels:
      - certain
      - uncertain
    sequential_key_binding: true
 
  - annotation_type: radio
    name: sentiment
    description: What sentiment does the conversation hold?
    labels:
      - positive
      - neutral
      - negative
    sequential_key_binding: true

成對文本比較

yaml
annotation_task_name: Text Comparison
 
data_files:
  - data/pairs.json
 
item_properties:
  id_key: id
  text_key: text
 
list_as_text:
  text_list_prefix_type: alphabet
  horizontal: true
 
annotation_schemes:
  - annotation_type: radio
    name: preference
    description: Which text is better?
    labels:
      - A is better
      - B is better
      - Equal

工作示例

完整的工作示例可在 project-hub/dialogue_analysis/ 中找到:

bash
python potato/flask_server.py start project-hub/dialogue_analysis/configs/dialogue-analysis.yaml -p 8000

示例資料格式:

json
{"id":"1","text":["Tom: Isn't this awesome?!", "Sam: Yes! I like you!", "Tom: great!", "Sam: Awesome! Let's party!"]}
{"id":"2","text":["Tom: I am so sorry for that", "Sam: No worries", "Tom: thanks for your understanding!"]}

提示

  1. 說話者名稱:使用 text_list_prefix_type: none 時,在文本中包含說話者名稱(例如 "Tom: Hello")

  2. 片段標註:在對話資料中使用片段標註時,標註者可以在任何顯示的輪次中高亮文本

  3. 字首選擇

    • 在文本中嵌入了說話者名稱的對話使用 none
    • 序列順序重要時使用 number
    • 成對/比較任務使用 alphabet
  4. 可讀性:為長對話啟用 alternating_shading,幫助標註者跟蹤正在閱讀的輪次

  5. 比較任務:使用 horizontal: true 配合 alphabet 字首進行並排比較

延伸閱讀

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