Skip to content

ComprehendClient#

Index > Comprehend > ComprehendClient

Auto-generated documentation for Comprehend type annotations stubs module mypy-boto3-comprehend.

ComprehendClient#

Type annotations and code completion for boto3.client("comprehend"). boto3 documentation

# ComprehendClient usage example

from boto3.session import Session
from mypy_boto3_comprehend.client import ComprehendClient

def get_comprehend_client() -> ComprehendClient:
    return Session().client("comprehend")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("comprehend").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("comprehend")

try:
    do_something(client)
except (
    client.exceptions.BatchSizeLimitExceededException,
    client.exceptions.ClientError,
    client.exceptions.ConcurrentModificationException,
    client.exceptions.InternalServerException,
    client.exceptions.InvalidFilterException,
    client.exceptions.InvalidRequestException,
    client.exceptions.JobNotFoundException,
    client.exceptions.KmsKeyValidationException,
    client.exceptions.ResourceInUseException,
    client.exceptions.ResourceLimitExceededException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ResourceUnavailableException,
    client.exceptions.TextSizeLimitExceededException,
    client.exceptions.TooManyRequestsException,
    client.exceptions.TooManyTagKeysException,
    client.exceptions.TooManyTagsException,
    client.exceptions.UnsupportedLanguageException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_comprehend.client import Exceptions

def handle_error(exc: Exceptions.BatchSizeLimitExceededException) -> None:
    ...

Methods#

batch_detect_dominant_language#

Determines the dominant language of the input text for a batch of documents.

Type annotations and code completion for boto3.client("comprehend").batch_detect_dominant_language method. boto3 documentation

# batch_detect_dominant_language method definition

def batch_detect_dominant_language(
    self,
    *,
    TextList: Sequence[str],
) -> BatchDetectDominantLanguageResponseTypeDef:  # (1)
    ...
  1. See BatchDetectDominantLanguageResponseTypeDef
# batch_detect_dominant_language method usage example with argument unpacking

kwargs: BatchDetectDominantLanguageRequestRequestTypeDef = {  # (1)
    "TextList": ...,
}

parent.batch_detect_dominant_language(**kwargs)
  1. See BatchDetectDominantLanguageRequestRequestTypeDef

batch_detect_entities#

Inspects the text of a batch of documents for named entities and returns information about them.

Type annotations and code completion for boto3.client("comprehend").batch_detect_entities method. boto3 documentation

# batch_detect_entities method definition

def batch_detect_entities(
    self,
    *,
    TextList: Sequence[str],
    LanguageCode: LanguageCodeType,  # (1)
) -> BatchDetectEntitiesResponseTypeDef:  # (2)
    ...
  1. See LanguageCodeType
  2. See BatchDetectEntitiesResponseTypeDef
# batch_detect_entities method usage example with argument unpacking

kwargs: BatchDetectEntitiesRequestRequestTypeDef = {  # (1)
    "TextList": ...,
    "LanguageCode": ...,
}

parent.batch_detect_entities(**kwargs)
  1. See BatchDetectEntitiesRequestRequestTypeDef

batch_detect_key_phrases#

Detects the key noun phrases found in a batch of documents.

Type annotations and code completion for boto3.client("comprehend").batch_detect_key_phrases method. boto3 documentation

# batch_detect_key_phrases method definition

def batch_detect_key_phrases(
    self,
    *,
    TextList: Sequence[str],
    LanguageCode: LanguageCodeType,  # (1)
) -> BatchDetectKeyPhrasesResponseTypeDef:  # (2)
    ...
  1. See LanguageCodeType
  2. See BatchDetectKeyPhrasesResponseTypeDef
# batch_detect_key_phrases method usage example with argument unpacking

kwargs: BatchDetectKeyPhrasesRequestRequestTypeDef = {  # (1)
    "TextList": ...,
    "LanguageCode": ...,
}

parent.batch_detect_key_phrases(**kwargs)
  1. See BatchDetectKeyPhrasesRequestRequestTypeDef

batch_detect_sentiment#

Inspects a batch of documents and returns an inference of the prevailing sentiment, POSITIVE, NEUTRAL, MIXED, or NEGATIVE, in each one.

Type annotations and code completion for boto3.client("comprehend").batch_detect_sentiment method. boto3 documentation

# batch_detect_sentiment method definition

def batch_detect_sentiment(
    self,
    *,
    TextList: Sequence[str],
    LanguageCode: LanguageCodeType,  # (1)
) -> BatchDetectSentimentResponseTypeDef:  # (2)
    ...
  1. See LanguageCodeType
  2. See BatchDetectSentimentResponseTypeDef
# batch_detect_sentiment method usage example with argument unpacking

kwargs: BatchDetectSentimentRequestRequestTypeDef = {  # (1)
    "TextList": ...,
    "LanguageCode": ...,
}

parent.batch_detect_sentiment(**kwargs)
  1. See BatchDetectSentimentRequestRequestTypeDef

batch_detect_syntax#

Inspects the text of a batch of documents for the syntax and part of speech of the words in the document and returns information about them.

Type annotations and code completion for boto3.client("comprehend").batch_detect_syntax method. boto3 documentation

# batch_detect_syntax method definition

def batch_detect_syntax(
    self,
    *,
    TextList: Sequence[str],
    LanguageCode: SyntaxLanguageCodeType,  # (1)
) -> BatchDetectSyntaxResponseTypeDef:  # (2)
    ...
  1. See SyntaxLanguageCodeType
  2. See BatchDetectSyntaxResponseTypeDef
# batch_detect_syntax method usage example with argument unpacking

kwargs: BatchDetectSyntaxRequestRequestTypeDef = {  # (1)
    "TextList": ...,
    "LanguageCode": ...,
}

parent.batch_detect_syntax(**kwargs)
  1. See BatchDetectSyntaxRequestRequestTypeDef

batch_detect_targeted_sentiment#

Inspects a batch of documents and returns a sentiment analysis for each entity identified in the documents.

Type annotations and code completion for boto3.client("comprehend").batch_detect_targeted_sentiment method. boto3 documentation

# batch_detect_targeted_sentiment method definition

def batch_detect_targeted_sentiment(
    self,
    *,
    TextList: Sequence[str],
    LanguageCode: LanguageCodeType,  # (1)
) -> BatchDetectTargetedSentimentResponseTypeDef:  # (2)
    ...
  1. See LanguageCodeType
  2. See BatchDetectTargetedSentimentResponseTypeDef
# batch_detect_targeted_sentiment method usage example with argument unpacking

kwargs: BatchDetectTargetedSentimentRequestRequestTypeDef = {  # (1)
    "TextList": ...,
    "LanguageCode": ...,
}

parent.batch_detect_targeted_sentiment(**kwargs)
  1. See BatchDetectTargetedSentimentRequestRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("comprehend").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

classify_document#

Creates a classification request to analyze a single document in real-time.

Type annotations and code completion for boto3.client("comprehend").classify_document method. boto3 documentation

# classify_document method definition

def classify_document(
    self,
    *,
    EndpointArn: str,
    Text: str = ...,
    Bytes: Union[str, bytes, IO[Any], StreamingBody] = ...,
    DocumentReaderConfig: DocumentReaderConfigTypeDef = ...,  # (1)
) -> ClassifyDocumentResponseTypeDef:  # (2)
    ...
  1. See DocumentReaderConfigTypeDef
  2. See ClassifyDocumentResponseTypeDef
# classify_document method usage example with argument unpacking

kwargs: ClassifyDocumentRequestRequestTypeDef = {  # (1)
    "EndpointArn": ...,
}

parent.classify_document(**kwargs)
  1. See ClassifyDocumentRequestRequestTypeDef

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("comprehend").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

contains_pii_entities#

Analyzes input text for the presence of personally identifiable information (PII) and returns the labels of identified PII entity types such as name, address, bank account number, or phone number.

Type annotations and code completion for boto3.client("comprehend").contains_pii_entities method. boto3 documentation

# contains_pii_entities method definition

def contains_pii_entities(
    self,
    *,
    Text: str,
    LanguageCode: LanguageCodeType,  # (1)
) -> ContainsPiiEntitiesResponseTypeDef:  # (2)
    ...
  1. See LanguageCodeType
  2. See ContainsPiiEntitiesResponseTypeDef
# contains_pii_entities method usage example with argument unpacking

kwargs: ContainsPiiEntitiesRequestRequestTypeDef = {  # (1)
    "Text": ...,
    "LanguageCode": ...,
}

parent.contains_pii_entities(**kwargs)
  1. See ContainsPiiEntitiesRequestRequestTypeDef

create_dataset#

Creates a dataset to upload training or test data for a model associated with a flywheel.

Type annotations and code completion for boto3.client("comprehend").create_dataset method. boto3 documentation

# create_dataset method definition

def create_dataset(
    self,
    *,
    FlywheelArn: str,
    DatasetName: str,
    InputDataConfig: DatasetInputDataConfigTypeDef,  # (1)
    DatasetType: DatasetTypeType = ...,  # (2)
    Description: str = ...,
    ClientRequestToken: str = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (3)
) -> CreateDatasetResponseTypeDef:  # (4)
    ...
  1. See DatasetInputDataConfigTypeDef
  2. See DatasetTypeType
  3. See TagTypeDef
  4. See CreateDatasetResponseTypeDef
# create_dataset method usage example with argument unpacking

kwargs: CreateDatasetRequestRequestTypeDef = {  # (1)
    "FlywheelArn": ...,
    "DatasetName": ...,
    "InputDataConfig": ...,
}

parent.create_dataset(**kwargs)
  1. See CreateDatasetRequestRequestTypeDef

create_document_classifier#

Creates a new document classifier that you can use to categorize documents.

Type annotations and code completion for boto3.client("comprehend").create_document_classifier method. boto3 documentation

# create_document_classifier method definition

def create_document_classifier(
    self,
    *,
    DocumentClassifierName: str,
    DataAccessRoleArn: str,
    InputDataConfig: DocumentClassifierInputDataConfigTypeDef,  # (1)
    LanguageCode: LanguageCodeType,  # (2)
    VersionName: str = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (3)
    OutputDataConfig: DocumentClassifierOutputDataConfigTypeDef = ...,  # (4)
    ClientRequestToken: str = ...,
    VolumeKmsKeyId: str = ...,
    VpcConfig: VpcConfigTypeDef = ...,  # (5)
    Mode: DocumentClassifierModeType = ...,  # (6)
    ModelKmsKeyId: str = ...,
    ModelPolicy: str = ...,
) -> CreateDocumentClassifierResponseTypeDef:  # (7)
    ...
  1. See DocumentClassifierInputDataConfigTypeDef
  2. See LanguageCodeType
  3. See TagTypeDef
  4. See DocumentClassifierOutputDataConfigTypeDef
  5. See VpcConfigTypeDef
  6. See DocumentClassifierModeType
  7. See CreateDocumentClassifierResponseTypeDef
# create_document_classifier method usage example with argument unpacking

kwargs: CreateDocumentClassifierRequestRequestTypeDef = {  # (1)
    "DocumentClassifierName": ...,
    "DataAccessRoleArn": ...,
    "InputDataConfig": ...,
    "LanguageCode": ...,
}

parent.create_document_classifier(**kwargs)
  1. See CreateDocumentClassifierRequestRequestTypeDef

create_endpoint#

Creates a model-specific endpoint for synchronous inference for a previously trained custom model For information about endpoints, see Managing endpoints.

Type annotations and code completion for boto3.client("comprehend").create_endpoint method. boto3 documentation

# create_endpoint method definition

def create_endpoint(
    self,
    *,
    EndpointName: str,
    DesiredInferenceUnits: int,
    ModelArn: str = ...,
    ClientRequestToken: str = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (1)
    DataAccessRoleArn: str = ...,
    FlywheelArn: str = ...,
) -> CreateEndpointResponseTypeDef:  # (2)
    ...
  1. See TagTypeDef
  2. See CreateEndpointResponseTypeDef
# create_endpoint method usage example with argument unpacking

kwargs: CreateEndpointRequestRequestTypeDef = {  # (1)
    "EndpointName": ...,
    "DesiredInferenceUnits": ...,
}

parent.create_endpoint(**kwargs)
  1. See CreateEndpointRequestRequestTypeDef

create_entity_recognizer#

Creates an entity recognizer using submitted files.

Type annotations and code completion for boto3.client("comprehend").create_entity_recognizer method. boto3 documentation

# create_entity_recognizer method definition

def create_entity_recognizer(
    self,
    *,
    RecognizerName: str,
    DataAccessRoleArn: str,
    InputDataConfig: EntityRecognizerInputDataConfigTypeDef,  # (1)
    LanguageCode: LanguageCodeType,  # (2)
    VersionName: str = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (3)
    ClientRequestToken: str = ...,
    VolumeKmsKeyId: str = ...,
    VpcConfig: VpcConfigTypeDef = ...,  # (4)
    ModelKmsKeyId: str = ...,
    ModelPolicy: str = ...,
) -> CreateEntityRecognizerResponseTypeDef:  # (5)
    ...
  1. See EntityRecognizerInputDataConfigTypeDef
  2. See LanguageCodeType
  3. See TagTypeDef
  4. See VpcConfigTypeDef
  5. See CreateEntityRecognizerResponseTypeDef
# create_entity_recognizer method usage example with argument unpacking

kwargs: CreateEntityRecognizerRequestRequestTypeDef = {  # (1)
    "RecognizerName": ...,
    "DataAccessRoleArn": ...,
    "InputDataConfig": ...,
    "LanguageCode": ...,
}

parent.create_entity_recognizer(**kwargs)
  1. See CreateEntityRecognizerRequestRequestTypeDef

create_flywheel#

A flywheel is an Amazon Web Services resource that orchestrates the ongoing training of a model for custom classification or custom entity recognition.

Type annotations and code completion for boto3.client("comprehend").create_flywheel method.