From 8f7f6812f94e95bd61ca68b774ae2aa8af22e28f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:32:51 -0700 Subject: [PATCH] feat: add `translation_config` in `RecognitionConfig` message (#7204) Enables specifying target language to perform automatic translation to. PiperOrigin-RevId: 621862394 Source-Link: https://github.com/googleapis/googleapis/commit/9deb78bb23e38621a9e3e14986b4469d4f68c11c Source-Link: https://github.com/googleapis/googleapis-gen/commit/f109618460c3c2ad1c19f0ff6f59c451c2fc830e Copy-Tag: eyJwIjoiU3BlZWNoLy5Pd2xCb3QueWFtbCIsImgiOiJmMTA5NjE4NDYwYzNjMmFkMWMxOWYwZmY2ZjU5YzQ1MWMyZmM4MzBlIn0= --- Speech/metadata/V2/CloudSpeech.php | Bin 21402 -> 21529 bytes Speech/src/V2/RecognitionConfig.php | 48 ++++++++++++++++++++ Speech/src/V2/TranslationConfig.php | 68 ++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 Speech/src/V2/TranslationConfig.php diff --git a/Speech/metadata/V2/CloudSpeech.php b/Speech/metadata/V2/CloudSpeech.php index 7af4b35e35172497a9dbe3a079c0c83086c409a8..add940642742a59155111c7973161e4d96d77b96 100644 GIT binary patch delta 139 zcmbQWoN?v~#tn~|S)b2m.google.cloud.speech.v2.TranscriptNormalization transcript_normalization = 11 [(.google.api.field_behavior) = OPTIONAL]; */ private $transcript_normalization = null; + /** + * Optional. Optional configuration used to automatically run translation on + * the given audio to the desired language for supported models. + * + * Generated from protobuf field .google.cloud.speech.v2.TranslationConfig translation_config = 15 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $translation_config = null; protected $decoding_config; /** @@ -108,6 +115,9 @@ class RecognitionConfig extends \Google\Protobuf\Internal\Message * the transcript with phrases of your choosing. For StreamingRecognize, this * normalization only applies to stable partial transcripts (stability > 0.8) * and final transcripts. + * @type \Google\Cloud\Speech\V2\TranslationConfig $translation_config + * Optional. Optional configuration used to automatically run translation on + * the given audio to the desired language for supported models. * } */ public function __construct($data = NULL) { @@ -379,6 +389,44 @@ public function setTranscriptNormalization($var) return $this; } + /** + * Optional. Optional configuration used to automatically run translation on + * the given audio to the desired language for supported models. + * + * Generated from protobuf field .google.cloud.speech.v2.TranslationConfig translation_config = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Speech\V2\TranslationConfig|null + */ + public function getTranslationConfig() + { + return $this->translation_config; + } + + public function hasTranslationConfig() + { + return isset($this->translation_config); + } + + public function clearTranslationConfig() + { + unset($this->translation_config); + } + + /** + * Optional. Optional configuration used to automatically run translation on + * the given audio to the desired language for supported models. + * + * Generated from protobuf field .google.cloud.speech.v2.TranslationConfig translation_config = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Speech\V2\TranslationConfig $var + * @return $this + */ + public function setTranslationConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Speech\V2\TranslationConfig::class); + $this->translation_config = $var; + + return $this; + } + /** * @return string */ diff --git a/Speech/src/V2/TranslationConfig.php b/Speech/src/V2/TranslationConfig.php new file mode 100644 index 000000000000..9c67811421d7 --- /dev/null +++ b/Speech/src/V2/TranslationConfig.php @@ -0,0 +1,68 @@ +google.cloud.speech.v2.TranslationConfig + */ +class TranslationConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The language code to translate to. + * + * Generated from protobuf field string target_language = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $target_language = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $target_language + * Required. The language code to translate to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Speech\V2\CloudSpeech::initOnce(); + parent::__construct($data); + } + + /** + * Required. The language code to translate to. + * + * Generated from protobuf field string target_language = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetLanguage() + { + return $this->target_language; + } + + /** + * Required. The language code to translate to. + * + * Generated from protobuf field string target_language = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetLanguage($var) + { + GPBUtil::checkString($var, True); + $this->target_language = $var; + + return $this; + } + +} +