本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
要將亞馬遜 A2I 整合到 Amazon Textract 文檔分析工作流程中,請配置HumanLoopConfig中的AnalyzeDocumentoperation.
InHumanLoopConfig中,您可以指定人工檢工作流程 (流程定義)FlowDefinitionArn,並給你的人類循環HumanLoopName。
- Analyze the Document (AWS SDK for Python (Boto3))
-
下面的示例使用 SDK for Python (Boto3) 調用analyze_document在 us-west-2. 替換紅色, 斜體文本與您的資源。如需詳細資訊,請參閱「」分析文檔中的AWS適用於 Python (Boto) 的開發套件。
client.analyze_document(Document={'S3Object': {"Bucket": "DOC-EXAMPLE-BUCKET", "Name": "document-name.png"}},
HumanLoopConfig={"FlowDefinitionArn":"arn:aws:sagemaker:us-west-2:111122223333:flow-definition/flow-definition-name",
"HumanLoopName":"human-loop-name",
"DataAttributes":{"ContentClassifiers":["FreeOfPersonallyIdentifiableInformation"|"FreeOfAdultContent",]}},
FeatureTypes=["FORMS"])
- Analyze the Document (AWS CLI)
-
下列範例使用AWS要調用的 CLIanalyze_document。這些範例與AWSCLI 版本 2. 第一個是簡寫語法,第二個是 JSON 語法。如需詳細資訊,請參閱「」分析文檔中的AWS CLI命令參考。
aws textract analyze-document \
--document '{"S3Object":{"Bucket":"bucket_name","Name":"file_name"}}' \
--human-loop-config HumanLoopName="test",FlowDefinitionArn="arn:aws:sagemaker:eu-west-1:xyz:flow-definition/hl_name",DataAttributes='{ContentClassifiers=["FreeOfPersonallyIdentifiableInformation","FreeOfAdultContent"]}'\
--feature-types '["FORMS"]'
aws textract analyze-document \
--document '{"S3Object":{"Bucket":"bucket_name","Name":"file_name"}}' \
--human-loop-config \
'{"HumanLoopName":"test","FlowDefinitionArn":"arn:aws:sagemaker:eu-west-1:xyz:flow-definition/hl_name","DataAttributes": {"ContentClassifiers":["FreeOfPersonallyIdentifiableInformation","FreeOfAdultContent"]}}' \
--feature-types '["FORMS"]'
避免在 —human-loop config 參數中使用白色空格,因為這可能會導致代碼的處理問題。
對此請求的響應包含人類循環活動產出,它指示是否創建了人類循環,如果是,為什麼。如果創建了人類循環,則此對象還包含HumanLoopArn。
如需使用AnalyzeDocument操作,請參閲使用 Amazon Textract 分析文檔文本。