層級多選
在 Potato 中搭建可展開的樹形分類選擇器,用於層級分類、主題打標和多層級類目標註任務。
層級多選標註方案提供一個可展開的樹形介面,從巢狀的分類體系中選擇類目。它適合標籤本身按層級組織的任務,比如主題分類、商品歸類,以及各類多層級打標。
Hierarchical multiselect in Potato
概覽
層級多選方案呈現為一棵可摺疊的樹:
- 父節點展開後顯示子類目
- 葉節點可以單獨選中
- 可選的聯動選擇,把選中狀態沿樹向上或向下傳遞
- 搜尋功能讓標註者在大型分類體系中快速找到類目
快速開始
yaml
annotation_schemes:
- annotation_type: hierarchical_multiselect
name: topic_tags
description: Select all applicable topic categories.
taxonomy:
Science:
Physics:
- Quantum Mechanics
- Thermodynamics
Biology:
- Genetics
- Ecology
Technology:
- Software
- Hardware配置項
| 欄位 | 類型 | 預設值 | 說明 |
|---|---|---|---|
annotation_type | string | 必填 | 必須為 "hierarchical_multiselect" |
name | string | 必填 | 本方案的唯一識別符號 |
description | string | 必填 | 展示給標註者的說明文字 |
taxonomy | object | 必填 | 定義類目層級的巢狀物件 |
auto_select_children | boolean | false | 選中父節點時自動選中它的全部子節點 |
auto_select_parent | boolean | false | 全部子節點被選中時自動選中父節點 |
show_search | boolean | false | 是否顯示搜尋框來過濾分類樹 |
max_selections | integer/null | null | 最多可選的類目數量(null 表示不限) |
expand_depth | integer | 1 | 預設展開的樹層級數 |
label_requirement.required | boolean | false | 提交前是否至少要選一項 |
示例
主題分類
yaml
annotation_schemes:
- annotation_type: hierarchical_multiselect
name: topic_classification
description: Select all topics that apply to this document.
show_search: true
max_selections: 5
taxonomy:
Politics:
Domestic:
- Elections
- Legislation
- Policy
International:
- Diplomacy
- Trade
- Conflict
Sports:
- Football
- Basketball
- Tennis
Entertainment:
Film:
- Reviews
- Industry News
Music:
- Reviews
- Concerts帶聯動選擇的商品歸類
yaml
annotation_schemes:
- annotation_type: hierarchical_multiselect
name: product_category
description: Categorize this product listing.
auto_select_children: true
auto_select_parent: true
taxonomy:
Electronics:
Computers:
- Laptops
- Desktops
- Tablets
Audio:
- Headphones
- Speakers
Clothing:
Men:
- Shirts
- Pants
Women:
- Dresses
- Tops醫學編碼
yaml
annotation_schemes:
- annotation_type: hierarchical_multiselect
name: diagnosis_codes
description: Select all applicable diagnosis categories.
show_search: true
taxonomy:
Cardiovascular:
Hypertension:
- Primary
- Secondary
Arrhythmia:
- Atrial Fibrillation
- Ventricular Tachycardia
Respiratory:
Obstructive:
- Asthma
- COPD
Infectious:
- Pneumonia
- Bronchitis輸出格式
json
{
"topic_tags": {
"labels": ["Science > Physics > Quantum Mechanics", "Technology > Software"]
}
}選中的類目以從根到葉的完整路徑字串儲存。
實踐建議
- 分類體系別做得太大 —— 巢狀不要超過 4 層,太深的樹很難瀏覽
- 大型分類體系要開搜尋 —— 類目超過 30 個時,
show_search: true對可用性的提升很明顯 - 聯動選擇要謹慎用 —— 父類目確實涵蓋所有子類目時它很方便,否則容易讓人困惑
- 設定合適的展開深度 —— 展開的層數要夠標註者看清結構,又不至於資訊過載
- 需要時限制選擇數量 —— 用
max_selections避免標註者打標過多
延伸閱讀
有關實現詳情,請參閱源文件。