airflow.contrib.operators.gcp_natural_language_operator

Module Contents

class airflow.contrib.operators.gcp_natural_language_operator.CloudLanguageAnalyzeEntitiesOperator(document, encoding_type=None, retry=None, timeout=None, metadata=None, gcp_conn_id='google_cloud_default', *args, **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.types.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 (seq[tuple[str, str]]]) – Additional metadata that is provided to the method.

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

template_fields = ['document', 'gcp_conn_id'][source]
execute(self, context)[source]
class airflow.contrib.operators.gcp_natural_language_operator.CloudLanguageAnalyzeEntitySentimentOperator(document, encoding_type=None, retry=None, timeout=None, metadata=None, gcp_conn_id='google_cloud_default', *args, **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.types.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 (seq[tuple[str, str]]]) – Additional metadata that is provided to the method.

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

Return type

google.cloud.language_v1.types.AnalyzeEntitiesResponse

template_fields = ['document', 'gcp_conn_id'][source]
execute(self, context)[source]
class airflow.contrib.operators.gcp_natural_language_operator.CloudLanguageAnalyzeSentimentOperator(document, encoding_type=None, retry=None, timeout=None, metadata=None, gcp_conn_id='google_cloud_default', *args, **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.types.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 Platform.

Return type

google.cloud.language_v1.types.AnalyzeEntitiesResponse

template_fields = ['document', 'gcp_conn_id'][source]
execute(self, context)[source]
class airflow.contrib.operators.gcp_natural_language_operator.CloudLanguageClassifyTextOperator(document, retry=None, timeout=None, metadata=None, gcp_conn_id='google_cloud_default', *args, **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 Platform.

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

Was this entry helpful?