2018/12/20 - Amazon Comprehend - 2 new 4 updated api methods
Changes This SDK release adds functionality to stop training Custom Document Classifier or Custom Entity Recognizer in Amazon Comprehend.
Stops an entity recognizer training job while in progress.
If the training job state is TRAINING , the job is marked for termination and put into the STOP_REQUESTED state. If the training job completes before it can be stopped, it is put into the TRAINED ; otherwise the training job is stopped and putted into the STOPPED state and the service sends back an HTTP 200 response with an empty HTTP body.
See also: AWS API Documentation
Request Syntax
client.stop_training_entity_recognizer( EntityRecognizerArn='string' )
string
[REQUIRED]
The Amazon Resource Name (ARN) that identifies the entity recognizer currently being trained.
dict
Response Syntax
{}
Response Structure
(dict) --
Stops a document classifier training job while in progress.
If the training job state is TRAINING , the job is marked for termination and put into the STOP_REQUESTED state. If the training job completes before it can be stopped, it is put into the TRAINED ; otherwise the training job is stopped and put into the STOPPED state and the service sends back an HTTP 200 response with an empty HTTP body.
See also: AWS API Documentation
Request Syntax
client.stop_training_document_classifier( DocumentClassifierArn='string' )
string
[REQUIRED]
The Amazon Resource Name (ARN) that identifies the document classifier currently being trained.
dict
Response Syntax
{}
Response Structure
(dict) --
{'DocumentClassifierProperties': {'Status': ['STOPPED', 'STOP_REQUESTED']}}
Gets the properties associated with a document classifier.
See also: AWS API Documentation
Request Syntax
client.describe_document_classifier( DocumentClassifierArn='string' )
string
[REQUIRED]
The Amazon Resource Name (ARN) that identifies the document classifier. The operation returns this identifier in its response.
dict
Response Syntax
{ 'DocumentClassifierProperties': { 'DocumentClassifierArn': 'string', 'LanguageCode': 'en'|'es'|'fr'|'de'|'it'|'pt', 'Status': 'SUBMITTED'|'TRAINING'|'DELETING'|'STOP_REQUESTED'|'STOPPED'|'IN_ERROR'|'TRAINED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'TrainingStartTime': datetime(2015, 1, 1), 'TrainingEndTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Uri': 'string' }, 'ClassifierMetadata': { 'NumberOfLabels': 123, 'NumberOfTrainedDocuments': 123, 'NumberOfTestDocuments': 123, 'EvaluationMetrics': { 'Accuracy': 123.0, 'Precision': 123.0, 'Recall': 123.0, 'F1Score': 123.0 } }, 'DataAccessRoleArn': 'string' } }
Response Structure
(dict) --
DocumentClassifierProperties (dict) --
An object that contains the properties associated with a document classifier.
DocumentClassifierArn (string) --
The Amazon Resource Name (ARN) that identifies the document classifier.
LanguageCode (string) --
The language code for the language of the documents that the classifier was trained on.
Status (string) --
The status of the document classifier. If the status is TRAINED the classifier is ready to use. If the status is FAILED you can see additional information about why the classifier wasn't trained in the Message field.
Message (string) --
Additional information about the status of the classifier.
SubmitTime (datetime) --
The time that the document classifier was submitted for training.
EndTime (datetime) --
The time that training the document classifier completed.
TrainingStartTime (datetime) --
Indicates the time when the training starts on documentation classifiers. You are billed for the time interval between this time and the value of TrainingEndTime.
TrainingEndTime (datetime) --
The time that training of the document classifier was completed. Indicates the time when the training completes on documentation classifiers. You are billed for the time interval between this time and the value of TrainingStartTime.
InputDataConfig (dict) --
The input data configuration that you supplied when you created the document classifier for training.
S3Uri (string) --
The Amazon S3 URI for the input data. The S3 bucket must be in the same region as the API endpoint that you are calling. The URI can point to a single input file or it can provide the prefix for a collection of input files.
For example, if you use the URI S3://bucketName/prefix , if the prefix is a single file, Amazon Comprehend uses that file as input. If more than one file begins with the prefix, Amazon Comprehend uses all of them as input.
ClassifierMetadata (dict) --
Information about the document classifier, including the number of documents used for training the classifier, the number of documents used for test the classifier, and an accuracy rating.
NumberOfLabels (integer) --
The number of labels in the input data.
NumberOfTrainedDocuments (integer) --
The number of documents in the input data that were used to train the classifier. Typically this is 80 to 90 percent of the input documents.
NumberOfTestDocuments (integer) --
The number of documents in the input data that were used to test the classifier. Typically this is 10 to 20 percent of the input documents.
EvaluationMetrics (dict) --
Describes the result metrics for the test data associated with an documentation classifier.
Accuracy (float) --
The fraction of the labels that were correct recognized. It is computed by dividing the number of labels in the test documents that were correctly recognized by the total number of labels in the test documents.
Precision (float) --
A measure of the usefulness of the classifier results in the test data. High precision means that the classifier returned substantially more relevant results than irrelevant ones.
Recall (float) --
A measure of how complete the classifier results are for the test data. High recall means that the classifier returned most of the relevant results.
F1Score (float) --
A measure of how accurate the classifier results are for the test data. It is derived from the Precision and Recall values. The F1Score is the harmonic average of the two scores. The highest score is 1, and the worst score is 0.
DataAccessRoleArn (string) --
The Amazon Resource Name (ARN) of the AWS Identity and Management (IAM) role that grants Amazon Comprehend read access to your input data.
{'EntityRecognizerProperties': {'Status': ['STOPPED', 'STOP_REQUESTED']}}
Provides details about an entity recognizer including status, S3 buckets containing training data, recognizer metadata, metrics, and so on.
See also: AWS API Documentation
Request Syntax
client.describe_entity_recognizer( EntityRecognizerArn='string' )
string
[REQUIRED]
The Amazon Resource Name (ARN) that identifies the entity recognizer.
dict
Response Syntax
{ 'EntityRecognizerProperties': { 'EntityRecognizerArn': 'string', 'LanguageCode': 'en'|'es'|'fr'|'de'|'it'|'pt', 'Status': 'SUBMITTED'|'TRAINING'|'DELETING'|'STOP_REQUESTED'|'STOPPED'|'IN_ERROR'|'TRAINED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'TrainingStartTime': datetime(2015, 1, 1), 'TrainingEndTime': datetime(2015, 1, 1), 'InputDataConfig': { 'EntityTypes': [ { 'Type': 'string' }, ], 'Documents': { 'S3Uri': 'string' }, 'Annotations': { 'S3Uri': 'string' }, 'EntityList': { 'S3Uri': 'string' } }, 'RecognizerMetadata': { 'NumberOfTrainedDocuments': 123, 'NumberOfTestDocuments': 123, 'EvaluationMetrics': { 'Precision': 123.0, 'Recall': 123.0, 'F1Score': 123.0 }, 'EntityTypes': [ { 'Type': 'string' }, ] }, 'DataAccessRoleArn': 'string' } }
Response Structure
(dict) --
EntityRecognizerProperties (dict) --
Describes information associated with an entity recognizer.
EntityRecognizerArn (string) --
The Amazon Resource Name (ARN) that identifies the entity recognizer.
LanguageCode (string) --
The language of the input documents. All documents must be in the same language. Only English ("en") is currently supported.
Status (string) --
Provides the status of the entity recognizer.
Message (string) --
A description of the status of the recognizer.
SubmitTime (datetime) --
The time that the recognizer was submitted for processing.
EndTime (datetime) --
The time that the recognizer creation completed.
TrainingStartTime (datetime) --
The time that training of the entity recognizer started.
TrainingEndTime (datetime) --
The time that training of the entity recognizer was completed.
InputDataConfig (dict) --
The input data properties of an entity recognizer.
EntityTypes (list) --
The entity types in the input data for an entity recognizer.
(dict) --
Information about an individual item on a list of entity types.
Type (string) --
Entity type of an item on an entity type list.
Documents (dict) --
S3 location of the documents folder for an entity recognizer
S3Uri (string) --
Specifies the Amazon S3 location where the training documents for an entity recognizer are located. The URI must be in the same region as the API endpoint that you are calling.
Annotations (dict) --
S3 location of the annotations file for an entity recognizer.
S3Uri (string) --
Specifies the Amazon S3 location where the annotations for an entity recognizer are located. The URI must be in the same region as the API endpoint that you are calling.
EntityList (dict) --
S3 location of the entity list for an entity recognizer.
S3Uri (string) --
Specifies the Amazon S3 location where the entity list is located. The URI must be in the same region as the API endpoint that you are calling.
RecognizerMetadata (dict) --
Provides information about an entity recognizer.
NumberOfTrainedDocuments (integer) --
The number of documents in the input data that were used to train the entity recognizer. Typically this is 80 to 90 percent of the input documents.
NumberOfTestDocuments (integer) --
The number of documents in the input data that were used to test the entity recognizer. Typically this is 10 to 20 percent of the input documents.
EvaluationMetrics (dict) --
Detailed information about the accuracy of an entity recognizer.
Precision (float) --
A measure of the usefulness of the recognizer results in the test data. High precision means that the recognizer returned substantially more relevant results than irrelevant ones.
Recall (float) --
A measure of how complete the recognizer results are for the test data. High recall means that the recognizer returned most of the relevant results.
F1Score (float) --
A measure of how accurate the recognizer results are for the test data. It is derived from the Precision and Recall values. The F1Score is the harmonic average of the two scores. The highest score is 1, and the worst score is 0.
EntityTypes (list) --
Entity types from the metadata of an entity recognizer.
(dict) --
Individual item from the list of entity types in the metadata of an entity recognizer.
Type (string) --
Type of entity from the list of entity types in the metadata of an entity recognizer.
DataAccessRoleArn (string) --
The Amazon Resource Name (ARN) of the AWS Identity and Management (IAM) role that grants Amazon Comprehend read access to your input data.
{'Filter': {'Status': ['STOPPED', 'STOP_REQUESTED']}}Response
{'DocumentClassifierPropertiesList': {'Status': ['STOPPED', 'STOP_REQUESTED']}}
Gets a list of the document classifiers that you have created.
See also: AWS API Documentation
Request Syntax
client.list_document_classifiers( Filter={ 'Status': 'SUBMITTED'|'TRAINING'|'DELETING'|'STOP_REQUESTED'|'STOPPED'|'IN_ERROR'|'TRAINED', 'SubmitTimeBefore': datetime(2015, 1, 1), 'SubmitTimeAfter': datetime(2015, 1, 1) }, NextToken='string', MaxResults=123 )
dict
Filters the jobs that are returned. You can filter jobs on their name, status, or the date and time that they were submitted. You can only set one filter at a time.
Status (string) --
Filters the list of classifiers based on status.
SubmitTimeBefore (datetime) --
Filters the list of classifiers based on the time that the classifier was submitted for processing. Returns only classifiers submitted before the specified time. Classifiers are returned in ascending order, oldest to newest.
SubmitTimeAfter (datetime) --
Filters the list of classifiers based on the time that the classifier was submitted for processing. Returns only classifiers submitted after the specified time. Classifiers are returned in descending order, newest to oldest.
string
Identifies the next page of results to return.
integer
The maximum number of results to return in each page. The default is 100.
dict
Response Syntax
{ 'DocumentClassifierPropertiesList': [ { 'DocumentClassifierArn': 'string', 'LanguageCode': 'en'|'es'|'fr'|'de'|'it'|'pt', 'Status': 'SUBMITTED'|'TRAINING'|'DELETING'|'STOP_REQUESTED'|'STOPPED'|'IN_ERROR'|'TRAINED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'TrainingStartTime': datetime(2015, 1, 1), 'TrainingEndTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Uri': 'string' }, 'ClassifierMetadata': { 'NumberOfLabels': 123, 'NumberOfTrainedDocuments': 123, 'NumberOfTestDocuments': 123, 'EvaluationMetrics': { 'Accuracy': 123.0, 'Precision': 123.0, 'Recall': 123.0, 'F1Score': 123.0 } }, 'DataAccessRoleArn': 'string' }, ], 'NextToken': 'string' }
Response Structure
(dict) --
DocumentClassifierPropertiesList (list) --
A list containing the properties of each job returned.
(dict) --
Provides information about a document classifier.
DocumentClassifierArn (string) --
The Amazon Resource Name (ARN) that identifies the document classifier.
LanguageCode (string) --
The language code for the language of the documents that the classifier was trained on.
Status (string) --
The status of the document classifier. If the status is TRAINED the classifier is ready to use. If the status is FAILED you can see additional information about why the classifier wasn't trained in the Message field.
Message (string) --
Additional information about the status of the classifier.
SubmitTime (datetime) --
The time that the document classifier was submitted for training.
EndTime (datetime) --
The time that training the document classifier completed.
TrainingStartTime (datetime) --
Indicates the time when the training starts on documentation classifiers. You are billed for the time interval between this time and the value of TrainingEndTime.
TrainingEndTime (datetime) --
The time that training of the document classifier was completed. Indicates the time when the training completes on documentation classifiers. You are billed for the time interval between this time and the value of TrainingStartTime.
InputDataConfig (dict) --
The input data configuration that you supplied when you created the document classifier for training.
S3Uri (string) --
The Amazon S3 URI for the input data. The S3 bucket must be in the same region as the API endpoint that you are calling. The URI can point to a single input file or it can provide the prefix for a collection of input files.
For example, if you use the URI S3://bucketName/prefix , if the prefix is a single file, Amazon Comprehend uses that file as input. If more than one file begins with the prefix, Amazon Comprehend uses all of them as input.
ClassifierMetadata (dict) --
Information about the document classifier, including the number of documents used for training the classifier, the number of documents used for test the classifier, and an accuracy rating.
NumberOfLabels (integer) --
The number of labels in the input data.
NumberOfTrainedDocuments (integer) --
The number of documents in the input data that were used to train the classifier. Typically this is 80 to 90 percent of the input documents.
NumberOfTestDocuments (integer) --
The number of documents in the input data that were used to test the classifier. Typically this is 10 to 20 percent of the input documents.
EvaluationMetrics (dict) --
Describes the result metrics for the test data associated with an documentation classifier.
Accuracy (float) --
The fraction of the labels that were correct recognized. It is computed by dividing the number of labels in the test documents that were correctly recognized by the total number of labels in the test documents.
Precision (float) --
A measure of the usefulness of the classifier results in the test data. High precision means that the classifier returned substantially more relevant results than irrelevant ones.
Recall (float) --
A measure of how complete the classifier results are for the test data. High recall means that the classifier returned most of the relevant results.
F1Score (float) --
A measure of how accurate the classifier results are for the test data. It is derived from the Precision and Recall values. The F1Score is the harmonic average of the two scores. The highest score is 1, and the worst score is 0.
DataAccessRoleArn (string) --
The Amazon Resource Name (ARN) of the AWS Identity and Management (IAM) role that grants Amazon Comprehend read access to your input data.
NextToken (string) --
Identifies the next page of results to return.
{'Filter': {'Status': ['STOPPED', 'STOP_REQUESTED']}}Response
{'EntityRecognizerPropertiesList': {'Status': ['STOPPED', 'STOP_REQUESTED']}}
Gets a list of the properties of all entity recognizers that you created, including recognizers currently in training. Allows you to filter the list of recognizers based on criteria such as status and submission time. This call returns up to 500 entity recognizers in the list, with a default number of 100 recognizers in the list.
The results of this list are not in any particular order. Please get the list and sort locally if needed.
See also: AWS API Documentation
Request Syntax
client.list_entity_recognizers( Filter={ 'Status': 'SUBMITTED'|'TRAINING'|'DELETING'|'STOP_REQUESTED'|'STOPPED'|'IN_ERROR'|'TRAINED', 'SubmitTimeBefore': datetime(2015, 1, 1), 'SubmitTimeAfter': datetime(2015, 1, 1) }, NextToken='string', MaxResults=123 )
dict
Filters the list of entities returned. You can filter on Status , SubmitTimeBefore , or SubmitTimeAfter . You can only set one filter at a time.
Status (string) --
The status of an entity recognizer.
SubmitTimeBefore (datetime) --
Filters the list of entities based on the time that the list was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in descending order, newest to oldest.
SubmitTimeAfter (datetime) --
Filters the list of entities based on the time that the list was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in ascending order, oldest to newest.
string
Identifies the next page of results to return.
integer
The maximum number of results to return on each page. The default is 100.
dict
Response Syntax
{ 'EntityRecognizerPropertiesList': [ { 'EntityRecognizerArn': 'string', 'LanguageCode': 'en'|'es'|'fr'|'de'|'it'|'pt', 'Status': 'SUBMITTED'|'TRAINING'|'DELETING'|'STOP_REQUESTED'|'STOPPED'|'IN_ERROR'|'TRAINED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'TrainingStartTime': datetime(2015, 1, 1), 'TrainingEndTime': datetime(2015, 1, 1), 'InputDataConfig': { 'EntityTypes': [ { 'Type': 'string' }, ], 'Documents': { 'S3Uri': 'string' }, 'Annotations': { 'S3Uri': 'string' }, 'EntityList': { 'S3Uri': 'string' } }, 'RecognizerMetadata': { 'NumberOfTrainedDocuments': 123, 'NumberOfTestDocuments': 123, 'EvaluationMetrics': { 'Precision': 123.0, 'Recall': 123.0, 'F1Score': 123.0 }, 'EntityTypes': [ { 'Type': 'string' }, ] }, 'DataAccessRoleArn': 'string' }, ], 'NextToken': 'string' }
Response Structure
(dict) --
EntityRecognizerPropertiesList (list) --
The list of properties of an entity recognizer.
(dict) --
Describes information about an entity recognizer.
EntityRecognizerArn (string) --
The Amazon Resource Name (ARN) that identifies the entity recognizer.
LanguageCode (string) --
The language of the input documents. All documents must be in the same language. Only English ("en") is currently supported.
Status (string) --
Provides the status of the entity recognizer.
Message (string) --
A description of the status of the recognizer.
SubmitTime (datetime) --
The time that the recognizer was submitted for processing.
EndTime (datetime) --
The time that the recognizer creation completed.
TrainingStartTime (datetime) --
The time that training of the entity recognizer started.
TrainingEndTime (datetime) --
The time that training of the entity recognizer was completed.
InputDataConfig (dict) --
The input data properties of an entity recognizer.
EntityTypes (list) --
The entity types in the input data for an entity recognizer.
(dict) --
Information about an individual item on a list of entity types.
Type (string) --
Entity type of an item on an entity type list.
Documents (dict) --
S3 location of the documents folder for an entity recognizer
S3Uri (string) --
Specifies the Amazon S3 location where the training documents for an entity recognizer are located. The URI must be in the same region as the API endpoint that you are calling.
Annotations (dict) --
S3 location of the annotations file for an entity recognizer.
S3Uri (string) --
Specifies the Amazon S3 location where the annotations for an entity recognizer are located. The URI must be in the same region as the API endpoint that you are calling.
EntityList (dict) --
S3 location of the entity list for an entity recognizer.
S3Uri (string) --
Specifies the Amazon S3 location where the entity list is located. The URI must be in the same region as the API endpoint that you are calling.
RecognizerMetadata (dict) --
Provides information about an entity recognizer.
NumberOfTrainedDocuments (integer) --
The number of documents in the input data that were used to train the entity recognizer. Typically this is 80 to 90 percent of the input documents.
NumberOfTestDocuments (integer) --
The number of documents in the input data that were used to test the entity recognizer. Typically this is 10 to 20 percent of the input documents.
EvaluationMetrics (dict) --
Detailed information about the accuracy of an entity recognizer.
Precision (float) --
A measure of the usefulness of the recognizer results in the test data. High precision means that the recognizer returned substantially more relevant results than irrelevant ones.
Recall (float) --
A measure of how complete the recognizer results are for the test data. High recall means that the recognizer returned most of the relevant results.
F1Score (float) --
A measure of how accurate the recognizer results are for the test data. It is derived from the Precision and Recall values. The F1Score is the harmonic average of the two scores. The highest score is 1, and the worst score is 0.
EntityTypes (list) --
Entity types from the metadata of an entity recognizer.
(dict) --
Individual item from the list of entity types in the metadata of an entity recognizer.
Type (string) --
Type of entity from the list of entity types in the metadata of an entity recognizer.
DataAccessRoleArn (string) --
The Amazon Resource Name (ARN) of the AWS Identity and Management (IAM) role that grants Amazon Comprehend read access to your input data.
NextToken (string) --
Identifies the next page of results to return.