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.GoogleBaseHookGoogle 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,則超時應用於每次單獨的嘗試。