airflow.providers.google.cloud.operators.natural_language

This module contains Google Cloud Language operators.

Module Contents

airflow.providers.google.cloud.operators.natural_language.MetaData[source]
class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageAnalyzeEntitiesOperator(*, document: Union[dict, Document], encoding_type: Optional[enums.EncodingType] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Finds named entities in the text along with entity types, salience, mentions for each entity, and other properties.

See also

For more information on how to use this operator, take a look at the guide: Analyzing Entities

Parameters
  • document (dict or google.cloud.language_v1.types.Document) – Input document. If a dict is provided, it must be of the same form as the protobuf message Document

  • encoding_type (google.cloud.language_v1.enums.EncodingType) – The encoding type used by the API to calculate offsets.

  • retry – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Sequence[Tuple[str, str]]) – Additional metadata that is provided to the method.

  • gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.

  • impersonation_chain (Union[str, Sequence[str]]) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields = ['document', 'gcp_conn_id', 'impersonation_chain'][source]
execute(self, context)[source]
class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageAnalyzeEntitySentimentOperator(*, document: Union[dict, Document], encoding_type: Optional[enums.EncodingType] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.

See also

For more information on how to use this operator, take a look at the guide: Analyzing Entity Sentiment

Parameters
  • document (dict or google.cloud.language_v1.types.Document) – Input document. If a dict is provided, it must be of the same form as the protobuf message Document

  • encoding_type (google.cloud.language_v1.enums.EncodingType) – The encoding type used by the API to calculate offsets.

  • retry – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

  • gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.

  • impersonation_chain (Union[str, Sequence[str]]) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

Return type

google.cloud.language_v1.types.AnalyzeEntitiesResponse

template_fields = ['document', 'gcp_conn_id', 'impersonation_chain'][source]
execute(self, context)[source]
class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageAnalyzeSentimentOperator(*, document: Union[dict, Document], encoding_type: Optional[enums.EncodingType] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Analyzes the sentiment of the provided text.

See also

For more information on how to use this operator, take a look at the guide: Analyzing Sentiment

Parameters
  • document (dict or google.cloud.language_v1.types.Document) – Input document. If a dict is provided, it must be of the same form as the protobuf message Document

  • encoding_type (google.cloud.language_v1.enums.EncodingType) – The encoding type used by the API to calculate offsets.

  • retry – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – Additional metadata that is provided to the method.

  • gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.

  • impersonation_chain (Union[str, Sequence[str]]) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

Return type

google.cloud.language_v1.types.AnalyzeEntitiesResponse

template_fields = ['document', 'gcp_conn_id', 'impersonation_chain'][source]
execute(self, context)[source]
class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageClassifyTextOperator(*, document: Union[dict, Document], retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Classifies a document into categories.

See also

For more information on how to use this operator, take a look at the guide: Classifying Content

Parameters
  • document (dict or google.cloud.language_v1.types.Document) – Input document. If a dict is provided, it must be of the same form as the protobuf message Document

  • retry – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (sequence[tuple[str, str]]]) – Additional metadata that is provided to the method.

  • gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.

  • impersonation_chain (Union[str, Sequence[str]]) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields = ['document', 'gcp_conn_id', 'impersonation_chain'][source]
execute(self, context)[source]

Was this entry helpful?