Skip to content
數位人文

用 Potato 做數位人文研究

用一款免費、可自託管的工具逐行校對 Transkribus 或 eScriptorium 的 HTR 結果,標註 IIIF 手稿,並在 TEI 版本中標記實體。

Potato 能逐行校對手寫文本識別(HTR)結果,標註來自 IIIF 清單的手稿影像,在 TEI 版本中標記人名和地名,再把修正後的成果寫回為 PAGE XML、IIIF 標註、W3C Web Annotation 或 TEI。Potato 免費開源,執行在你自己的伺服器上。

大多數人文標註都從一輪自動處理或一個現有版本開始:來自 Transkribus 或 eScriptorium 的 HTR 輸出、圖書館的 IIIF 清單,或一份 TEI 檔案。剩下的工作要靠人完成,常常由學生、志願者或項目團隊分擔。Potato 負責這一步:每個匯入器根據原始檔生成可執行的項目,原始檔自帶的標註作為預標註載入,由人確認或修正,每個匯出器再以相同格式寫回修正後的成果。

Potato 中的數位人文任務

每一行是由一對匯入器和匯出器支援的工作流,詳見數位人文格式頁面。

任務Potato 的做法格式
校對 HTR 或 OCR 輸出每個文本行一個條目,從頁面影像中裁出,在 text_edit 方案中修正,介面顯示與機器識別結果的逐詞差異來自 Transkribus、eScriptorium 或 OCR-D 的 PAGE XML
校正頁面版面每頁一個條目,每個區域和文本行都是按區域類型標註的多邊形PAGE XML(--page-xml-mode regions)
標註手稿影像每個 IIIF canvas 一個條目,已有標註顯示為可編輯的形狀IIIF Presentation 3 和 2.x 清單
在版本中標記實體<persName>、<placeName>、<orgName>、<date> 和 <rs> 變成可編輯的片段TEI P5
在檢視器之間遷移標註文本引文和影像區域以 W3C Web Annotation 形式儲存Annotorious、Mirador、Hypothesis
私下執行眾包工作流Zooniverse 工作流轉換為 Potato 方案,其分類結果可以作為已儲存的工作匯入Zooniverse 項目匯出

校對來自 Transkribus 或 eScriptorium 的 HTR 輸出

匯入時讀取 Transkribus 或 eScriptorium 的 PAGE XML 匯出,在 XML 旁邊或 --image-dir 中找到每頁的影像,然後生成一個項目。標註者每次看到從頁面上裁出的一行,識別出的文本已就位,可直接修正。

bash
potato import -f page_xml -i transkribus-export/ -o htr-project
python potato/flask_server.py start htr-project/config.yaml -p 8000
python -m potato.export -c htr-project/config.yaml -f page_xml -o corrected/

page_xml 匯出直接修改項目中每個 PAGE XML 檔案的副本,檔案的其餘部分保持不變,因此修正後的檔案可以送回 HTR 工具,作為訓練用的真值資料。如果識別器為某一行儲存了置信度,條目會把它儲存為 htr_confidence。

與 Transkribus、eScriptorium、Zooniverse 和 Recogito 的分工

Potato 不識別手寫文字,也不訓練 HTR 模型。這兩件事 Transkribus 和 eScriptorium 都能做,Potato 負責校對它們的輸出。Zooniverse 面向公眾志願者項目,上線前要經過稽核;Potato 適合私下運行同樣的工作流,處理未公開的材料,由實驗室團隊或付費轉錄者完成。Recogito Studio 面向 TEI、IIIF 影像和 PDF 的協作標註。Potato 額外提供的是把條目分配給具體的人、在項目需要第二意見時為每個條目分配多名標註者,以及對標註者答案計算一致性指標。

由於 Potato 執行在你自己的伺服器上,檔案影像和未發表的轉錄文本都留在你能控制的基礎設施中。所有指令碼、樣式表和字型都由安裝目錄提供,詳見氣隙與離線部署。

常見問題

Potato 能逐行校對 Transkribus 或 eScriptorium 的輸出嗎?

能。potato import -f page_xml 按閱讀順序為每個 TextLine 生成一個條目,標註者在顯示逐詞差異的 text_edit 方案中,對照行影像修正識別出的文本。page_xml 匯出把修正寫回原始檔的副本。2013-07-15 和 2019-07-15 兩個版本的 PAGE schema 都能讀取。

能讓幾名志願者轉錄同一批頁面,並看到他們的分歧在哪裡嗎?

能。num_annotators_per_item 決定每一行或每一頁由多少人檢視,每個人的答案分別儲存。Potato 2.13.1 不為校正後的轉錄計算一致性指標,JSONL 匯出給出每個人對每一行的文本,可供比較。對於標註的人名和地名,裁定與分歧處理說明了如何審查標註者有分歧的條目,並記錄最終版本。

能從 IIIF 清單載入影像,而不是上傳檔案嗎?

能。potato import -f iiif 接受清單檔案或 http(s) URL,每個 canvas 成為一個條目,影像取自該 canvas 的影像或其 Image 服務。iiif_annotations 匯出寫出標註頁面,以及一份引用這些頁面的清單副本,Mirador 和 Universal Viewer 都能開啟。

Potato 和在 Zooniverse 上執行項目有什麼不同?

Zooniverse 託管公開項目,併為這些項目招募志願者。Potato 執行在你自己的伺服器上,因此適合不能公開的材料或封閉的標註團隊。potato import 能讀取 Zooniverse 項目的工作流、subject 和分類匯出,已有工作流可以遷移過來,不過問卷和轉錄任務不會被匯入。

延伸閱讀

從這裡開始

示例設計

每個設計都是可以下載並直接執行的 Potato 配置。

DocLayNet Document Layout AnalysisDocument layout analysis with bounding box annotations. Annotators draw bounding boxes around layout elements (text blocks, tables, figures, headers, footers, lists) in document page images.DocBank Document Layout DetectionDocument layout analysis benchmark (Li et al., COLING 2020). Detect and classify document elements including titles, abstracts, paragraphs, figures, tables, and captions.DWIE Document-Level Entity Annotation and LinkingDocument-level entity mention annotation with knowledge-base linking based on DWIE (Zaporojets, Deleu, Develder, and Demeester, Information Processing & Management 2021). Annotators mark every entity mention in a full news article, assign an entity type, and link mentions to Wikipedia/Wikidata entries, leaving NIL entities unlinked. Complements the mention-level AIDA CoNLL-YAGO task (text/entity-linking/aida-conll-entity-disambiguation): AIDA presents one pre-marked mention at a time for disambiguation, whereas DWIE is entity-centric and document-level — annotators find all mentions themselves and keep links consistent across each entity's coreferent mentions.WikiArt Artwork ClassificationArt classification by style, genre, and artist (Saleh & Elgammal, 2015). Classify paintings into artistic movements, genres, and predict artist attribution.TimeLine: Cross-Document Event OrderingIdentify event mentions and temporal expressions in news text and classify temporal relations between events, based on SemEval-2015 Task 4 (Minard et al.). Annotators build timelines by ordering events related to a target entity across documents.

其他領域

全部應用場景