文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
DescribeDocumentClassificationJob
搭配 a AWS SDK 或 CLI 使用
下列程式碼範例示範如何使用 DescribeDocumentClassificationJob
。
動作範例是大型程式的程式碼摘錄,必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作:
- CLI
-
- AWS CLI
-
描述文件分類任務
下列
describe-document-classification-job
範例會取得非同步文件分類任務的屬性。aws comprehend describe-document-classification-job \ --job-id
123456abcdeb0e11022f22a11EXAMPLE
輸出:
{ "DocumentClassificationJobProperties": { "JobId": "123456abcdeb0e11022f22a11EXAMPLE", "JobArn": "arn:aws:comprehend:us-west-2:111122223333:document-classification-job/123456abcdeb0e11022f22a11EXAMPLE", "JobName": "exampleclassificationjob", "JobStatus": "COMPLETED", "SubmitTime": "2023-06-14T17:09:51.788000+00:00", "EndTime": "2023-06-14T17:15:58.582000+00:00", "DocumentClassifierArn": "arn:aws:comprehend:us-west-2:111122223333:document-classifier/mymodel/version/1", "InputDataConfig": { "S3Uri": "s3://DOC-EXAMPLE-BUCKET/jobdata/", "InputFormat": "ONE_DOC_PER_LINE" }, "OutputDataConfig": { "S3Uri": "s3://DOC-EXAMPLE-DESTINATION-BUCKET/testfolder/111122223333-CLN-123456abcdeb0e11022f22a11EXAMPLE/output/output.tar.gz" }, "DataAccessRoleArn": "arn:aws:iam::111122223333:role/service-role/AmazonComprehendServiceRole-servicerole" } }
如需詳細資訊,請參閱 Amazon Comprehend 開發人員指南中的自訂分類。
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DescribeDocumentClassificationJob
。
-
- Python
-
- Python 的 SDK (Boto3)
-
注意
還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 class ComprehendClassifier: """Encapsulates an Amazon Comprehend custom classifier.""" def __init__(self, comprehend_client): """ :param comprehend_client: A Boto3 Comprehend client. """ self.comprehend_client = comprehend_client self.classifier_arn = None def describe_job(self, job_id): """ Gets metadata about a classification job. :param job_id: The ID of the job to look up. :return: Metadata about the job. """ try: response = self.comprehend_client.describe_document_classification_job( JobId=job_id ) job = response["DocumentClassificationJobProperties"] logger.info("Got classification job %s.", job["JobName"]) except ClientError: logger.exception("Couldn't get classification job %s.", job_id) raise else: return job
-
如需 API 詳細資訊,請參閱 DescribeDocumentClassificationJob AWS SDK for Python (Boto3) Word 參考中的 API。
-
DeleteDocumentClassifier
DescribeDocumentClassifier