airflow.providers.google.cloud.operators.natural_language

This module contains Google Cloud Language operators.

Module Contents

Classes

CloudNaturalLanguageAnalyzeEntitiesOperator

Finds named entities in the text along with various properties.

CloudNaturalLanguageAnalyzeEntitySentimentOperator

Similar to AnalyzeEntities, also analyzes sentiment associated with each entity and its mentions.

CloudNaturalLanguageAnalyzeSentimentOperator

Analyzes the sentiment of the provided text.

CloudNaturalLanguageClassifyTextOperator

Classifies a document into categories.

Attributes

MetaData

airflow.providers.google.cloud.operators.natural_language.MetaData[source]
class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageAnalyzeEntitiesOperator(*, document, encoding_type=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Finds named entities in the text along with various properties.

Examples properties: entity types, salience, mentions for each entity, and others.

See also

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

Parameters
  • document (dict | 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.types.EncodingType | None) – The encoding type used by the API to calculate offsets.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float | None) – 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 (MetaData) – Additional metadata that is provided to the method.

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

  • impersonation_chain (str | Sequence[str] | None) – 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: Sequence[str] = ('document', 'gcp_conn_id', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageAnalyzeEntitySentimentOperator(*, document, encoding_type=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Similar to AnalyzeEntities, also 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 | 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.types.EncodingType | None) – The encoding type used by the API to calculate offsets.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float | None) – 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 (MetaData) – Additional metadata that is provided to the method.

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

  • impersonation_chain (str | Sequence[str] | None) – 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: Sequence[str] = ('document', 'gcp_conn_id', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageAnalyzeSentimentOperator(*, document, encoding_type=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

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 | 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.types.EncodingType | None) – The encoding type used by the API to calculate offsets.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float | None) – 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 (MetaData) – Additional metadata that is provided to the method.

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

  • impersonation_chain (str | Sequence[str] | None) – 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: Sequence[str] = ('document', 'gcp_conn_id', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.natural_language.CloudNaturalLanguageClassifyTextOperator(*, document, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

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 | 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 (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float | None) – 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 (MetaData) – Additional metadata that is provided to the method.

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

  • impersonation_chain (str | Sequence[str] | None) – 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: Sequence[str] = ('document', 'gcp_conn_id', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?