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