Use DeleteDocumentClassifier
with an AWS SDK or CLI
The following code examples show how to use DeleteDocumentClassifier
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- CLI
-
- AWS CLI
-
To delete a custom document classifier
The following delete-document-classifier
example deletes a custom document classifier model.
aws comprehend delete-document-classifier \
--document-classifier-arn arn:aws:comprehend:us-west-2:111122223333:document-classifier/example-classifier-1
This command produces no output.
For more information, see Managing Amazon Comprehend endpoints in the Amazon Comprehend Developer Guide.
- Python
-
- SDK for Python (Boto3)
-
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 delete(self):
"""
Deletes the classifier.
"""
try:
self.comprehend_client.delete_document_classifier(
DocumentClassifierArn=self.classifier_arn
)
logger.info("Deleted classifier %s.", self.classifier_arn)
self.classifier_arn = None
except ClientError:
logger.exception("Couldn't deleted classifier %s.", self.classifier_arn)
raise
For a complete list of AWS SDK developer guides and code examples, see
Using Amazon Comprehend with an AWS SDK.
This topic also includes information about getting started and details about previous SDK versions.