分析文档 - Amazon Textract

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

分析文档

要将 Amazon A2I 融入到 Amazon Textract 文档分析工作流程中,您可以配置HumanLoopConfig中的AnalyzeDocumentoperation.

InHumanLoopConfig,您可以在中指定您的人工审核工作流(流定义)ARNFlowDefinitionArn,然后给你的人类循环一个名字HumanLoopName.

Analyze the Document (AWS SDK for Python (Boto3))

以下示例使用 SDK for Python (Boto3) 调用analyze_document在 us-west-2 中。替换红色,斜体用你的资源发短信。有关更多信息,请参阅 。分析 _文档中的AWS适用于 Python 的开发工具包 (Boto) API 参考.

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"]'
注意

避免在 —人循环配置参数中使用白色空格,因为这可能会导致代码的处理问题。

对此请求的回复包括HumanLoop 激活输出,它表明是否创建了人类循环,如果是的话,为什么。如果创建了人类循环,则此对象还包含HumanLoopArn.

有关和示例的更多信息,请参阅AnalyzeDocument操作,请参阅使用 Amazon Textract 分析文档文本.