Guides2 min read
自动关键词高亮
配置 AI 驱动的关键词高亮功能,引导标注者关注重要术语和短语。
Potato Team·
自动关键词高亮
AI 驱动的关键词高亮功能引导标注者关注文本中的重要术语、实体或模式。本指南介绍如何配置 Potato 的内置 AI 支持来自动高亮相关关键词。
为什么使用关键词高亮?
- 聚焦注意力:引导标注者关注相关内容
- 提升速度:更快识别关键信息
- 减少错误:降低遗漏重要术语的可能性
- 利用 AI:让 LLM 识别上下文相关的关键词
基本 AI 驱动高亮
Potato 使用其 AI 支持系统来识别和高亮重要关键词。以下是基本配置:
yaml
annotation_task_name: "Keyword Highlighted Annotation"
data_files:
- path: "data/reviews.json"
format: json
item_properties:
id_key: id
text_key: text
annotation_schemes:
- annotation_type: radio
name: sentiment
description: "What is the overall sentiment?"
labels:
- Positive
- Negative
- Neutral
ai_support:
enabled: true
endpoint_type: openai
ai_config:
model: gpt-4
api_key: ${OPENAI_API_KEY}
temperature: 0.3
max_tokens: 500
features:
keyword_highlighting:
enabled: true
# Highlights are rendered as box overlays on the text使用不同的 AI 提供商
OpenAI
yaml
ai_support:
enabled: true
endpoint_type: openai
ai_config:
model: gpt-4o
api_key: ${OPENAI_API_KEY}
temperature: 0.3
max_tokens: 500
features:
keyword_highlighting:
enabled: true
Anthropic Claude
yaml
ai_support:
enabled: true
endpoint_type: anthropic
ai_config:
model: claude-3-sonnet-20240229
api_key: ${ANTHROPIC_API_KEY}
temperature: 0.3
max_tokens: 500
features:
keyword_highlighting:
enabled: true
# Highlights are rendered as box overlays on the text本地 Ollama(无 API 费用)
yaml
ai_support:
enabled: true
endpoint_type: ollama
ai_config:
model: llama2
base_url: http://localhost:11434
features:
keyword_highlighting:
enabled: true
# Highlights are rendered as box overlays on the text组合功能
AI 支持提供多种可以协同工作的功能:
yaml
ai_support:
enabled: true
endpoint_type: openai
ai_config:
model: gpt-4
api_key: ${OPENAI_API_KEY}
temperature: 0.3
max_tokens: 500
features:
# Highlight important keywords
keyword_highlighting:
enabled: true
# Highlights are rendered as box overlays on the text
# Show contextual hints
hints:
enabled: true
# Suggest labels for consideration
label_suggestions:
enabled: true
show_confidence: true完整配置示例
以下是一个带有 AI 高亮的实体感知标注完整配置:
yaml
annotation_task_name: "Entity-Aware Annotation"
data_files:
- path: "data/documents.json"
format: json
item_properties:
id_key: id
text_key: text
annotation_schemes:
- annotation_type: span
name: entities
labels:
- name: PERSON
color: "#FECACA"
- name: ORG
color: "#BBF7D0"
- name: LOCATION
color: "#BFDBFE"
ai_support:
enabled: true
endpoint_type: openai
ai_config:
model: gpt-4
api_key: ${OPENAI_API_KEY}
temperature: 0.3
max_tokens: 500
features:
keyword_highlighting:
enabled: true
# Highlights are rendered as box overlays on the text
hints:
enabled: true
label_suggestions:
enabled: true
show_confidence: true
cache_config:
disk_cache:
enabled: true
path: "ai_cache/cache.json"
prefetch:
warm_up_page_count: 50
on_next: 3
on_prev: 2
output_annotation_dir: "output/"
output_annotation_format: json
allow_all_users: true缓存优化性能
启用缓存以减少 API 调用并提高响应速度:
yaml
ai_support:
enabled: true
endpoint_type: openai
ai_config:
model: gpt-4
api_key: ${OPENAI_API_KEY}
features:
keyword_highlighting:
enabled: true
cache_config:
disk_cache:
enabled: true
path: "ai_cache/cache.json"
# Pre-generate highlights on startup and prefetch upcoming
prefetch:
warm_up_page_count: 100
on_next: 5
on_prev: 2技巧
- 匹配任务颜色:使用与标注方案互补的高亮颜色
- 启用缓存:避免对相同内容重复 API 调用
- 考虑本地模型:使用 Ollama 进行大量标注而无需 API 费用
- 组合功能:关键词高亮与提示和标签建议配合使用效果最佳
完整文档请参阅 /docs/features/ai-support。