Amazon Comprehend

2019/04/03 - Amazon Comprehend - 3 new 2 updated api methods

Changes  With this release AWS Comprehend adds tagging support for document-classifiers and entity-recognizers.

UntagResource (new) Link ¶

Removes a specific tag associated with an Amazon Comprehend resource.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    ResourceArn='string',
    TagKeys=[
        'string',
    ]
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The Amazon Resource Name (ARN) of the given Amazon Comprehend resource from which you want to remove the tags.

type TagKeys

list

param TagKeys

[REQUIRED]

The initial part of a key-value pair that forms a tag being removed from a given resource. For instance, “Department” might be used as the key portion of the pair, with multiple values such as “sales,” “legal,” and “administration.”

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

ListTagsForResource (new) Link ¶

Lists all tags associated with a given Amazon Comprehend resource. Up to the maximum number of tags allowed per resource will be displayed.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    ResourceArn='string'
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The Amazon Resource Name (ARN) of the given Amazon Comprehend resource you are querying.

rtype

dict

returns

Response Syntax

{
    'ResourceArn': 'string',
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • ResourceArn (string) --

      The Amazon Resource Name (ARN) of the given Amazon Comprehend resource you are querying.

    • Tags (list) --

      Tags associated with the Amazon Comprehend resource being queried. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

      • (dict) --

        A key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

        • Key (string) --

          The initial part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the key portion of the pair, with multiple possible values such as “sales,” “legal,” and “administration.”

        • Value (string) --

          The second part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the initial (key) portion of the pair, with a value of “sales” to indicate the sales department.

TagResource (new) Link ¶

Associates a specific tag with an Amazon Comprehend resource. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    ResourceArn='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The Amazon Resource Name (ARN) of the given Amazon Comprehend resource to which you want to associate the tags.

type Tags

list

param Tags

[REQUIRED]

Tags being associated with a specific Amazon Comprehend resource.

  • (dict) --

    A key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

    • Key (string) -- [REQUIRED]

      The initial part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the key portion of the pair, with multiple possible values such as “sales,” “legal,” and “administration.”

    • Value (string) --

      The second part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the initial (key) portion of the pair, with a value of “sales” to indicate the sales department.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

CreateDocumentClassifier (updated) Link ¶
Changes (request)
{'Tags': [{'Key': 'string', 'Value': 'string'}]}

Creates a new document classifier that you can use to categorize documents. To create a classifier you provide a set of training documents that labeled with the categories that you want to use. After the classifier is trained you can use it to categorize a set of labeled documents into the categories. For more information, see how-document-classification .

See also: AWS API Documentation

Request Syntax

client.create_document_classifier(
    DocumentClassifierName='string',
    DataAccessRoleArn='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    InputDataConfig={
        'S3Uri': 'string'
    },
    ClientRequestToken='string',
    LanguageCode='en'|'es'|'fr'|'de'|'it'|'pt',
    VolumeKmsKeyId='string'
)
type DocumentClassifierName

string

param DocumentClassifierName

[REQUIRED]

The name of the document classifier.

type DataAccessRoleArn

string

param DataAccessRoleArn

[REQUIRED]

The Amazon Resource Name (ARN) of the AWS Identity and Management (IAM) role that grants Amazon Comprehend read access to your input data.

type Tags

list

param Tags

Tags to be associated with the document classifier being created. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

  • (dict) --

    A key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

    • Key (string) -- [REQUIRED]

      The initial part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the key portion of the pair, with multiple possible values such as “sales,” “legal,” and “administration.”

    • Value (string) --

      The second part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the initial (key) portion of the pair, with a value of “sales” to indicate the sales department.

type InputDataConfig

dict

param InputDataConfig

[REQUIRED]

Specifies the format and location of the input data for the job.

  • S3Uri (string) -- [REQUIRED]

    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.

type ClientRequestToken

string

param ClientRequestToken

A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.

This field is autopopulated if not provided.

type LanguageCode

string

param LanguageCode

[REQUIRED]

The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.

type VolumeKmsKeyId

string

param VolumeKmsKeyId

ID for the AWS Key Management Service (KMS) key that Amazon Comprehend uses to encrypt data on the storage volume attached to the ML compute instance(s) that process the analysis job. The VolumeKmsKeyId can be either of the following formats:

  • KMS Key ID: "1234abcd-12ab-34cd-56ef-1234567890ab"

  • Amazon Resource Name (ARN) of a KMS Key: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"

rtype

dict

returns

Response Syntax

{
    'DocumentClassifierArn': 'string'
}

Response Structure

  • (dict) --

    • DocumentClassifierArn (string) --

      The Amazon Resource Name (ARN) that identifies the document classifier.

CreateEntityRecognizer (updated) Link ¶
Changes (request)
{'Tags': [{'Key': 'string', 'Value': 'string'}]}

Creates an entity recognizer using submitted files. After your CreateEntityRecognizer request is submitted, you can check job status using the API.

See also: AWS API Documentation

Request Syntax

client.create_entity_recognizer(
    RecognizerName='string',
    DataAccessRoleArn='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    InputDataConfig={
        'EntityTypes': [
            {
                'Type': 'string'
            },
        ],
        'Documents': {
            'S3Uri': 'string'
        },
        'Annotations': {
            'S3Uri': 'string'
        },
        'EntityList': {
            'S3Uri': 'string'
        }
    },
    ClientRequestToken='string',
    LanguageCode='en'|'es'|'fr'|'de'|'it'|'pt',
    VolumeKmsKeyId='string'
)
type RecognizerName

string

param RecognizerName

[REQUIRED]

The name given to the newly created recognizer. Recognizer names can be a maximum of 256 characters. Alphanumeric characters, hyphens (-) and underscores (_) are allowed. The name must be unique in the account/region.

type DataAccessRoleArn

string

param DataAccessRoleArn

[REQUIRED]

The Amazon Resource Name (ARN) of the AWS Identity and Management (IAM) role that grants Amazon Comprehend read access to your input data.

type Tags

list

param Tags

Tags to be associated with the entity recognizer being created. A tag is a key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

  • (dict) --

    A key-value pair that adds as a metadata to a resource used by Amazon Comprehend. For example, a tag with the key-value pair ‘Department’:’Sales’ might be added to a resource to indicate its use by a particular department.

    • Key (string) -- [REQUIRED]

      The initial part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the key portion of the pair, with multiple possible values such as “sales,” “legal,” and “administration.”

    • Value (string) --

      The second part of a key-value pair that forms a tag associated with a given resource. For instance, if you want to show which resources are used by which departments, you might use “Department” as the initial (key) portion of the pair, with a value of “sales” to indicate the sales department.

type InputDataConfig

dict

param InputDataConfig

[REQUIRED]

Specifies the format and location of the input data. The S3 bucket containing the input data must be located in the same region as the entity recognizer being created.

  • EntityTypes (list) -- [REQUIRED]

    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) -- [REQUIRED]

        Entity type of an item on an entity type list.

  • Documents (dict) -- [REQUIRED]

    S3 location of the documents folder for an entity recognizer

    • S3Uri (string) -- [REQUIRED]

      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) -- [REQUIRED]

      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) -- [REQUIRED]

      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.

type ClientRequestToken

string

param ClientRequestToken

A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.

This field is autopopulated if not provided.

type LanguageCode

string

param LanguageCode

[REQUIRED]

The language of the input documents. All documents must be in the same language. Only English ("en") is currently supported.

type VolumeKmsKeyId

string

param VolumeKmsKeyId

ID for the AWS Key Management Service (KMS) key that Amazon Comprehend uses to encrypt data on the storage volume attached to the ML compute instance(s) that process the analysis job. The VolumeKmsKeyId can be either of the following formats:

  • KMS Key ID: "1234abcd-12ab-34cd-56ef-1234567890ab"

  • Amazon Resource Name (ARN) of a KMS Key: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"

rtype

dict

returns

Response Syntax

{
    'EntityRecognizerArn': 'string'
}

Response Structure

  • (dict) --

    • EntityRecognizerArn (string) --

      The Amazon Resource Name (ARN) that identifies the entity recognizer.