Skip to content

生产力功能

键盘快捷键、工具提示、关键词高亮和标签建议。

生产力功能

Potato 包含多项功能帮助标注者更快、更准确地工作,包括键盘快捷键、工具提示、关键词高亮和标签建议。

键盘快捷键

顺序按键绑定

对于最多 10 个选项的标注模式,可以默认按顺序分配按键绑定:

yaml
annotation_schemes:
  - annotation_type: radio
    name: sentiment
    labels: [positive, neutral, negative]
    sequential_key_binding: true

第一个选项对应"1"键,第二个对应"2",以此类推。

自定义按键绑定

需要更多控制时,为每个标签配置自定义按键绑定:

yaml
annotation_schemes:
  - annotation_type: multiselect
    labels:
      - name: "Option 1"
        key_value: "1"
      - name: "Option 2"
        key_value: "2"
      - name: "Skip"
        key_value: "s"

管理员关键词高亮

使用彩色高亮帮助标注者识别相关词汇和短语。

配置

yaml
keyword_highlights_file: data/keywords.tsv

TSV 文件格式

关键词文件应为制表符分隔,包含三列:

text
Word	Label	Schema
love	positive	sentiment
hate	negative	sentiment
excel*	positive	sentiment
disappoint*	negative	sentiment
描述
Word要高亮的关键词或短语(支持 * 通配符)
Label与此关键词关联的标注标签
Schema标注模式名称

匹配行为

  • 不区分大小写:"Love"匹配"love"、"LOVE"、"Love"
  • 词边界:"love"匹配"love"但不匹配"lovely"(除非使用通配符)
  • 通配符:使用 * 进行前缀/后缀匹配:
    • excel* 匹配"excellent"、"excels"、"excel"
    • *happy 匹配"unhappy"、"happy"

配置颜色

颜色在 ui.spans.span_colors 部分配置:

yaml
ui:
  spans:
    span_colors:
      sentiment:
        positive: "(34, 197, 94)"    # Green
        negative: "(239, 68, 68)"    # Red
        neutral: "(156, 163, 175)"   # Gray

随机化设置

出于研究目的,配置关键词高亮随机化以防止标注者仅依赖高亮:

yaml
keyword_highlights_file: data/keywords.tsv
 
keyword_highlight_settings:
  keyword_probability: 1.0       # Show 100% of keywords (0.0-1.0)
  random_word_probability: 0.05  # Highlight 5% random words as distractors
  random_word_label: "distractor"
  random_word_schema: "keyword"

主要特性:

  • 持久性:高亮词按用户+实例缓存
  • 确定性随机化:使用用户名 + 实例 ID 的哈希作为种子
  • 行为追踪:记录哪些词被高亮

工具提示

为每个响应选项添加详细说明:

纯文本工具提示

yaml
annotation_schemes:
  - annotation_type: multiselect
    name: "Question"
    labels:
      - name: "Label 1"
        tooltip: "This option means..."

HTML 工具提示

需要格式化的工具提示时,指向 HTML 文件:

yaml
annotation_schemes:
  - annotation_type: multiselect
    name: "Question"
    labels:
      - name: "Label 1"
        tooltip_file: "config/tooltips/label1_tooltip.html"

标签建议

显示建议以帮助标注者,有两种模式:

  • highlight:用颜色高亮建议的标签
  • prefill:自动预选建议的标签

配置

yaml
annotation_schemes:
  - annotation_type: multiselect
    name: "sentiment"
    description: "What sentiment does the text express?"
    labels: [positive, neutral, negative]
    label_suggestions: "highlight"  # or "prefill"
 
  - annotation_type: text
    name: "explanation"
    description: "Why do you think so?"
    multiline: true
    rows: 2
    label_suggestions: "prefill"

数据格式

在数据项中包含建议:

json
{
  "id": "1",
  "text": "Good Job!",
  "label_suggestions": {
    "sentiment": "positive",
    "explanation": "Because I think "
  }
}

自动任务分配

轻松地将标注任务分配给不同的标注者:

yaml
automatic_assignment:
  on: true
  output_filename: "task_assignment.json"
  sampling_strategy: "random"
  labels_per_instance: 10
  instance_per_annotator: 50
  test_question_per_annotator: 2

主动学习集成

生产力功能与主动学习集成,优先处理最有信息价值的实例:

yaml
active_learning:
  enabled: true
  schema_names: ["sentiment"]
  min_annotations_per_instance: 2
  min_instances_for_training: 20
  update_frequency: 10

最佳实践

  1. 为高量任务使用键盘快捷键 - 它们显著加快标注速度
  2. 为复杂或模糊的标签添加工具提示 - 减少不一致性
  3. 使用关键词高亮引起对相关文本的注意,但考虑为研究有效性进行随机化
  4. 谨慎使用预填充建议 - 过度使用可能使标注者产生偏见

延伸阅读

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