airflow.providers.google.cloud.hooks.speech_to_text¶
此模块包含一个 Google Cloud Speech Hook。
类¶
Google Cloud Speech API 的 Hook。 |
模块内容¶
- class airflow.providers.google.cloud.hooks.speech_to_text.CloudSpeechToTextHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[源码]¶
基类:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
Google Cloud Speech API 的 Hook。
- 参数:
gcp_conn_id (str) – 获取连接信息时使用的连接 ID。
impersonation_chain (str | collections.abc.Sequence[str] | None) – 用于使用短期凭据模拟的可选服务帐号,或者获取列表中最后一个帐号(将在请求中被模拟)的 access_token 所需的帐号链表。如果设置为字符串,该帐号必须授予发起帐号 Service Account Token Creator IAM 角色。如果设置为序列,列表中的身份必须授予紧接在其前的身份 Service Account Token Creator IAM 角色,其中列表中的第一个帐号将此角色授予发起帐号。
- get_conn()[源码]¶
检索 Cloud Speech 的连接。
- 返回:
Google Cloud Speech 客户端对象。
- 返回类型:
google.cloud.speech_v1.SpeechClient
- recognize_speech(config, audio, retry=DEFAULT, timeout=None)[源码]¶
识别音频输入。
- 参数:
config (dict | google.cloud.speech_v1.types.RecognitionConfig) – 提供给识别器的信息,指定如何处理请求。https://googleapis.github.io/google-cloud-python/latest/speech/gapic/v1/types.html#google.cloud.speech_v1.types.RecognitionConfig
audio (dict | google.cloud.speech_v1.types.RecognitionAudio) – 待识别的音频数据https://googleapis.github.io/google-cloud-python/latest/speech/gapic/v1/types.html#google.cloud.speech_v1.types.RecognitionAudio
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – (可选)用于重试请求的重试对象。如果指定 None,则不重试请求。
timeout (float | None) – (可选)等待请求完成的秒数。请注意,如果指定了 retry,则超时应用于每次单独的尝试。