本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
PDF 註釋檔案
對於 PDF 註釋,您可以使用 SageMaker AI Ground Truth 在擴增資訊清單檔案中建立已標記的資料集。Ground Truth 是一種資料標籤服務,可協助您 (或您雇用的人力資源) 建置機器學習模型的訓練資料集。Amazon Comprehend 接受擴增資訊清單檔案作為自訂模型的訓練資料。您可以使用 Amazon Comprehend 主控台或 CreateEntityRecognizer API 動作,在建立自訂實體識別器時提供這些檔案。
您可以使用 Ground Truth 內建任務類型命名實體辨識,建立標籤任務,讓工作者在文字中識別實體。若要進一步了解,請參閱《Amazon SageMaker AI 開發人員指南》中的具名實體辨識。若要進一步了解 Amazon SageMaker Ground Truth,請參閱使用 Amazon SageMaker AI Ground Truth 標籤資料。
注意
您可以使用 Ground Truth 定義重疊的標籤 (與多個標籤相關聯的文字)。不過,Amazon Comprehend 實體辨識不支援重疊的標籤。
增強型資訊清單檔案採用 JSON 行格式。在這些檔案中,每一行都是完整的 JSON 物件,其中包含訓練文件及其相關聯的標籤。下列範例是擴增資訊清單檔案,可訓練實體識別器偵測文字中提及之個人的專業:
{"source":"Diego Ramirez is an engineer in the high tech industry.","NamedEntityRecognitionDemo":{"annotations":{"entities":[{"endOffset":13,"startOffset":0,"label":"ENGINEER"}],"labels":[{"label":"ENGINEER"}]}},"NamedEntityRecognitionDemo-metadata":{"entities":[{"confidence":0.92}],"job-name":"labeling-job/namedentityrecognitiondemo","type":"groundtruth/text-span","creation-date":"2020-05-14T21:45:27.175903","human-annotated":"yes"}} {"source":"J Doe is a judge on the Washington Supreme Court.","NamedEntityRecognitionDemo":{"annotations":{"entities":[{"endOffset":5,"startOffset":0,"label":"JUDGE"}],"labels":[{"label":"JUDGE"}]}},"NamedEntityRecognitionDemo-metadata":{"entities":[{"confidence":0.72}],"job-name":"labeling-job/namedentityrecognitiondemo","type":"groundtruth/text-span","creation-date":"2020-05-14T21:45:27.174910","human-annotated":"yes"}} {"source":"Our latest new employee, Mateo Jackson, has been a manager in the industry for 4 years.","NamedEntityRecognitionDemo":{"annotations":{"entities":[{"endOffset":38,"startOffset":26,"label":"MANAGER"}],"labels":[{"label":"MANAGER"}]}},"NamedEntityRecognitionDemo-metadata":{"entities":[{"confidence":0.91}],"job-name":"labeling-job/namedentityrecognitiondemo","type":"groundtruth/text-span","creation-date":"2020-05-14T21:45:27.174035","human-annotated":"yes"}}
此 JSON 行檔案中的每一行都是完整的 JSON 物件,其中的屬性包含文件文字、註釋和其他來自 Ground Truth 的中繼資料。下列範例是擴增資訊清單檔案中的單一 JSON 物件,但其格式具有可讀性:
{ "source": "Diego Ramirez is an engineer in the high tech industry.", "NamedEntityRecognitionDemo": { "annotations": { "entities": [ { "endOffset": 13, "startOffset": 0, "label": "ENGINEER" } ], "labels": [ { "label": "ENGINEER" } ] } }, "NamedEntityRecognitionDemo-metadata": { "entities": [ { "confidence": 0.92 } ], "job-name": "labeling-job/namedentityrecognitiondemo", "type": "groundtruth/text-span", "creation-date": "2020-05-14T21:45:27.175903", "human-annotated": "yes" } }
在此範例中, source
屬性提供訓練文件的文字, NamedEntityRecognitionDemo
屬性則提供文字中實體的註釋。NamedEntityRecognitionDemo
屬性的名稱是任意的,當您在 Ground Truth 中定義標籤工作時,您會提供您選擇的名稱。
在此範例中, NamedEntityRecognitionDemo
屬性是標籤屬性名稱,這是提供 Ground Truth 工作者指派給訓練資料的標籤的屬性。當您提供訓練資料給 Amazon Comprehend 時,您必須指定一或多個標籤屬性名稱。您指定的屬性名稱數量取決於擴增資訊清單檔案是單一標籤工作的輸出還是鏈結標籤工作。
如果您的檔案是單一標籤工作的輸出,請指定在 Ground Truth 中建立任務時所使用的單一標籤屬性名稱。
如果您的檔案是鏈結標記任務的輸出,請指定鏈結中一或多個任務的標籤屬性名稱。每個標籤屬性名稱都會提供個別任務的註釋。您可以為鏈結標籤任務產生的擴增資訊清單檔案指定最多 5 個屬性。
在擴增資訊清單中,標籤屬性名稱通常遵循 source
金鑰。如果檔案是鏈結任務的輸出,則會有多個標籤屬性名稱。當您將訓練資料提供給 Amazon Comprehend 時,請僅提供包含與您模型相關註釋的屬性。請勿指定結尾為 "-metadata" 的屬性。
如需鏈結標記任務的詳細資訊,以及其產生的輸出範例,請參閱《Amazon SageMaker AI 開發人員指南》中的鏈結標記任務。