diff --git a/ci/run_conditional_tests.sh b/ci/run_conditional_tests.sh index a83f7726b4e..80fecc56aa1 100755 --- a/ci/run_conditional_tests.sh +++ b/ci/run_conditional_tests.sh @@ -62,6 +62,8 @@ if [[ "${changed}" -eq 0 ]]; then echo "no change detected in ci" else echo "change detected in ci, we should test everything" + echo "result of git diff ${GIT_DIFF_ARG} ci:" + git diff ${GIT_DIFF_ARG} ci GIT_DIFF_ARG="" fi diff --git a/packages/google-cloud-speech/protos/google/cloud/speech/v1/cloud_speech.proto b/packages/google-cloud-speech/protos/google/cloud/speech/v1/cloud_speech.proto index 94cfd612624..7a74e6a3230 100644 --- a/packages/google-cloud-speech/protos/google/cloud/speech/v1/cloud_speech.proto +++ b/packages/google-cloud-speech/protos/google/cloud/speech/v1/cloud_speech.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -260,6 +260,12 @@ message RecognitionConfig { // wideband is supported. `sample_rate_hertz` must be 16000. SPEEX_WITH_HEADER_BYTE = 7; + // MP3 audio. MP3 encoding is a Beta feature and only available in + // v1p1beta1. Support all standard MP3 bitrates (which range from 32-320 + // kbps). When using this encoding, `sample_rate_hertz` has to match the + // sample rate of the file being used. + MP3 = 8; + // Opus encoded audio frames in WebM container // ([OggOpus](https://wiki.xiph.org/OggOpus)). `sample_rate_hertz` must be // one of 8000, 12000, 16000, 24000, or 48000. @@ -343,6 +349,13 @@ message RecognitionConfig { // When speech adaptation is set it supersedes the `speech_contexts` field. SpeechAdaptation adaptation = 20; + // Optional. Use transcription normalization to automatically replace parts of + // the transcript with phrases of your choosing. For StreamingRecognize, this + // normalization only applies to stable partial transcripts (stability > 0.8) + // and final transcripts. + TranscriptNormalization transcript_normalization = 24 + [(google.api.field_behavior) = OPTIONAL]; + // Array of [SpeechContext][google.cloud.speech.v1.SpeechContext]. // A means to provide context to assist the speech recognition. For more // information, see @@ -463,8 +476,8 @@ message RecognitionConfig { // Config to enable speaker diarization. message SpeakerDiarizationConfig { // If 'true', enables speaker detection for each recognized word in - // the top alternative of the recognition result using a speaker_tag provided - // in the WordInfo. + // the top alternative of the recognition result using a speaker_label + // provided in the WordInfo. bool enable_speaker_diarization = 1; // Minimum number of speakers in the conversation. This range gives you more @@ -956,9 +969,19 @@ message WordInfo { // Output only. A distinct integer value is assigned for every speaker within // the audio. This field specifies which one of those speakers was detected to // have spoken this word. Value ranges from '1' to diarization_speaker_count. - // speaker_tag is set if enable_speaker_diarization = 'true' and only in the + // speaker_tag is set if enable_speaker_diarization = 'true' and only for the // top alternative. - int32 speaker_tag = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Note: Use speaker_label instead. + int32 speaker_tag = 5 + [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A label value assigned for every unique speaker within the + // audio. This field specifies which speaker was detected to have spoken this + // word. For some models, like medical_conversation this can be actual speaker + // role, for example "patient" or "provider", but generally this would be a + // number identifying a speaker. This field is only set if + // enable_speaker_diarization = 'true' and only for the top alternative. + string speaker_label = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Information on speech adaptation use in results diff --git a/packages/google-cloud-speech/protos/google/cloud/speech/v1/resource.proto b/packages/google-cloud-speech/protos/google/cloud/speech/v1/resource.proto index fcfd4640a2a..d37c11baa88 100644 --- a/packages/google-cloud-speech/protos/google/cloud/speech/v1/resource.proto +++ b/packages/google-cloud-speech/protos/google/cloud/speech/v1/resource.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -147,3 +147,27 @@ message SpeechAdaptation { // See specifications: https://www.w3.org/TR/speech-grammar ABNFGrammar abnf_grammar = 4; } + +// Transcription normalization configuration. Use transcription normalization +// to automatically replace parts of the transcript with phrases of your +// choosing. For StreamingRecognize, this normalization only applies to stable +// partial transcripts (stability > 0.8) and final transcripts. +message TranscriptNormalization { + // A single replacement configuration. + message Entry { + // What to replace. Max length is 100 characters. + string search = 1; + + // What to replace with. Max length is 100 characters. + string replace = 2; + + // Whether the search is case sensitive. + bool case_sensitive = 3; + } + + // A list of replacement entries. We will perform replacement with one entry + // at a time. For example, the second entry in ["cat" => "dog", "mountain cat" + // => "mountain dog"] will never be applied because we will always process the + // first entry before it. At most 100 entries. + repeated Entry entries = 1; +} diff --git a/packages/google-cloud-speech/protos/google/cloud/speech/v2/cloud_speech.proto b/packages/google-cloud-speech/protos/google/cloud/speech/v2/cloud_speech.proto index c2074e5b715..d23d36d8017 100644 --- a/packages/google-cloud-speech/protos/google/cloud/speech/v2/cloud_speech.proto +++ b/packages/google-cloud-speech/protos/google/cloud/speech/v2/cloud_speech.proto @@ -585,8 +585,12 @@ message Recognizer { // characters or less. string display_name = 3; - // Optional. Which model to use for recognition requests. Select the model - // best suited to your domain to get best results. + // Optional. This field is now deprecated. Prefer the + // [`model`][google.cloud.speech.v2.RecognitionConfig.model] field in the + // [`RecognitionConfig`][google.cloud.speech.v2.RecognitionConfig] message. + // + // Which model to use for recognition requests. Select the model best suited + // to your domain to get best results. // // Guidance for choosing which model to use can be found in the [Transcription // Models @@ -596,7 +600,12 @@ message Recognizer { // Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages). string model = 4 [deprecated = true, (google.api.field_behavior) = OPTIONAL]; - // Optional. The language of the supplied audio as a + // Optional. This field is now deprecated. Prefer the + // [`language_codes`][google.cloud.speech.v2.RecognitionConfig.language_codes] + // field in the + // [`RecognitionConfig`][google.cloud.speech.v2.RecognitionConfig] message. + // + // The language of the supplied audio as a // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. // // Supported languages for each model are listed in the [Table of Supported @@ -693,6 +702,8 @@ message Recognizer { // * OGG_OPUS: Opus audio frames in an Ogg container. // // * WEBM_OPUS: Opus audio frames in a WebM container. +// +// * M4A: M4A audio format. message AutoDetectDecodingConfig {} // Explicitly specified decoding parameters. @@ -827,6 +838,30 @@ message RecognitionFeatures { int32 max_alternatives = 16; } +// Transcription normalization configuration. Use transcription normalization +// to automatically replace parts of the transcript with phrases of your +// choosing. For StreamingRecognize, this normalization only applies to stable +// partial transcripts (stability > 0.8) and final transcripts. +message TranscriptNormalization { + // A single replacement configuration. + message Entry { + // What to replace. Max length is 100 characters. + string search = 1; + + // What to replace with. Max length is 100 characters. + string replace = 2; + + // Whether the search is case sensitive. + bool case_sensitive = 3; + } + + // A list of replacement entries. We will perform replacement with one entry + // at a time. For example, the second entry in ["cat" => "dog", "mountain cat" + // => "mountain dog"] will never be applied because we will always process the + // first entry before it. At most 100 entries. + repeated Entry entries = 1; +} + // Provides "hints" to the speech recognizer to favor specific words and phrases // in the results. PhraseSets can be specified as an inline resource, or a // reference to an existing PhraseSet resource. @@ -898,6 +933,13 @@ message RecognitionConfig { // Speech adaptation context that weights recognizer predictions for specific // words and phrases. SpeechAdaptation adaptation = 6; + + // Optional. Use transcription normalization to automatically replace parts of + // the transcript with phrases of your choosing. For StreamingRecognize, this + // normalization only applies to stable partial transcripts (stability > 0.8) + // and final transcripts. + TranscriptNormalization transcript_normalization = 11 + [(google.api.field_behavior) = OPTIONAL]; } // Request message for the @@ -1275,21 +1317,45 @@ message BatchRecognizeResults { RecognitionResponseMetadata metadata = 2; } -// Final results for a single file. -message BatchRecognizeFileResult { +// Final results written to Cloud Storage. +message CloudStorageResult { // The Cloud Storage URI to which recognition results were written. string uri = 1; +} + +// Final results returned inline in the recognition response. +message InlineResult { + // The transcript for the audio file. + BatchRecognizeResults transcript = 1; +} +// Final results for a single file. +message BatchRecognizeFileResult { // Error if one was encountered. google.rpc.Status error = 2; RecognitionResponseMetadata metadata = 3; - // The transcript for the audio file. This is populated only when - // [InlineOutputConfig][google.cloud.speech.v2.InlineOutputConfig] is set in - // the - // [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig]. - BatchRecognizeResults transcript = 4; + oneof result { + // Recognition results written to Cloud Storage. This is + // populated only when + // [GcsOutputConfig][google.cloud.speech.v2.GcsOutputConfig] is set in + // the + // [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig]. + CloudStorageResult cloud_storage_result = 5; + + // Recognition results. This is populated only when + // [InlineOutputConfig][google.cloud.speech.v2.InlineOutputConfig] is set in + // the + // [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig]. + InlineResult inline_result = 6; + } + + // Deprecated. Use `cloud_storage_result.native_format_uri` instead. + string uri = 1 [deprecated = true]; + + // Deprecated. Use `inline_result.transcript` instead. + BatchRecognizeResults transcript = 4 [deprecated = true]; } // Metadata about transcription for a single file (for example, progress diff --git a/packages/google-cloud-speech/protos/protos.d.ts b/packages/google-cloud-speech/protos/protos.d.ts index 7bc7a89d572..b5e458a56cf 100644 --- a/packages/google-cloud-speech/protos/protos.d.ts +++ b/packages/google-cloud-speech/protos/protos.d.ts @@ -788,6 +788,9 @@ export namespace google { /** RecognitionConfig adaptation */ adaptation?: (google.cloud.speech.v1.ISpeechAdaptation|null); + /** RecognitionConfig transcriptNormalization */ + transcriptNormalization?: (google.cloud.speech.v1.ITranscriptNormalization|null); + /** RecognitionConfig speechContexts */ speechContexts?: (google.cloud.speech.v1.ISpeechContext[]|null); @@ -855,6 +858,9 @@ export namespace google { /** RecognitionConfig adaptation. */ public adaptation?: (google.cloud.speech.v1.ISpeechAdaptation|null); + /** RecognitionConfig transcriptNormalization. */ + public transcriptNormalization?: (google.cloud.speech.v1.ITranscriptNormalization|null); + /** RecognitionConfig speechContexts. */ public speechContexts: google.cloud.speech.v1.ISpeechContext[]; @@ -975,6 +981,7 @@ export namespace google { AMR_WB = 5, OGG_OPUS = 6, SPEEX_WITH_HEADER_BYTE = 7, + MP3 = 8, WEBM_OPUS = 9 } } @@ -2354,6 +2361,9 @@ export namespace google { /** WordInfo speakerTag */ speakerTag?: (number|null); + + /** WordInfo speakerLabel */ + speakerLabel?: (string|null); } /** Represents a WordInfo. */ @@ -2380,6 +2390,9 @@ export namespace google { /** WordInfo speakerTag. */ public speakerTag: number; + /** WordInfo speakerLabel. */ + public speakerLabel: string; + /** * Creates a new WordInfo instance using the specified properties. * @param [properties] Properties to set @@ -3200,6 +3213,215 @@ export namespace google { } } + /** Properties of a TranscriptNormalization. */ + interface ITranscriptNormalization { + + /** TranscriptNormalization entries */ + entries?: (google.cloud.speech.v1.TranscriptNormalization.IEntry[]|null); + } + + /** Represents a TranscriptNormalization. */ + class TranscriptNormalization implements ITranscriptNormalization { + + /** + * Constructs a new TranscriptNormalization. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v1.ITranscriptNormalization); + + /** TranscriptNormalization entries. */ + public entries: google.cloud.speech.v1.TranscriptNormalization.IEntry[]; + + /** + * Creates a new TranscriptNormalization instance using the specified properties. + * @param [properties] Properties to set + * @returns TranscriptNormalization instance + */ + public static create(properties?: google.cloud.speech.v1.ITranscriptNormalization): google.cloud.speech.v1.TranscriptNormalization; + + /** + * Encodes the specified TranscriptNormalization message. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.verify|verify} messages. + * @param message TranscriptNormalization message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v1.ITranscriptNormalization, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranscriptNormalization message, length delimited. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.verify|verify} messages. + * @param message TranscriptNormalization message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v1.ITranscriptNormalization, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranscriptNormalization message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranscriptNormalization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v1.TranscriptNormalization; + + /** + * Decodes a TranscriptNormalization message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranscriptNormalization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v1.TranscriptNormalization; + + /** + * Verifies a TranscriptNormalization message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranscriptNormalization message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranscriptNormalization + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v1.TranscriptNormalization; + + /** + * Creates a plain object from a TranscriptNormalization message. Also converts values to other types if specified. + * @param message TranscriptNormalization + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v1.TranscriptNormalization, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranscriptNormalization to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranscriptNormalization + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TranscriptNormalization { + + /** Properties of an Entry. */ + interface IEntry { + + /** Entry search */ + search?: (string|null); + + /** Entry replace */ + replace?: (string|null); + + /** Entry caseSensitive */ + caseSensitive?: (boolean|null); + } + + /** Represents an Entry. */ + class Entry implements IEntry { + + /** + * Constructs a new Entry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v1.TranscriptNormalization.IEntry); + + /** Entry search. */ + public search: string; + + /** Entry replace. */ + public replace: string; + + /** Entry caseSensitive. */ + public caseSensitive: boolean; + + /** + * Creates a new Entry instance using the specified properties. + * @param [properties] Properties to set + * @returns Entry instance + */ + public static create(properties?: google.cloud.speech.v1.TranscriptNormalization.IEntry): google.cloud.speech.v1.TranscriptNormalization.Entry; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v1.TranscriptNormalization.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v1.TranscriptNormalization.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v1.TranscriptNormalization.Entry; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v1.TranscriptNormalization.Entry; + + /** + * Verifies an Entry message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Entry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v1.TranscriptNormalization.Entry; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @param message Entry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v1.TranscriptNormalization.Entry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Represents an Adaptation */ class Adaptation extends $protobuf.rpc.Service { @@ -11726,94 +11948,303 @@ export namespace google { } } - /** Properties of a SpeechAdaptation. */ - interface ISpeechAdaptation { - - /** SpeechAdaptation phraseSets */ - phraseSets?: (google.cloud.speech.v2.SpeechAdaptation.IAdaptationPhraseSet[]|null); + /** Properties of a TranscriptNormalization. */ + interface ITranscriptNormalization { - /** SpeechAdaptation customClasses */ - customClasses?: (google.cloud.speech.v2.ICustomClass[]|null); + /** TranscriptNormalization entries */ + entries?: (google.cloud.speech.v2.TranscriptNormalization.IEntry[]|null); } - /** Represents a SpeechAdaptation. */ - class SpeechAdaptation implements ISpeechAdaptation { + /** Represents a TranscriptNormalization. */ + class TranscriptNormalization implements ITranscriptNormalization { /** - * Constructs a new SpeechAdaptation. + * Constructs a new TranscriptNormalization. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.speech.v2.ISpeechAdaptation); - - /** SpeechAdaptation phraseSets. */ - public phraseSets: google.cloud.speech.v2.SpeechAdaptation.IAdaptationPhraseSet[]; + constructor(properties?: google.cloud.speech.v2.ITranscriptNormalization); - /** SpeechAdaptation customClasses. */ - public customClasses: google.cloud.speech.v2.ICustomClass[]; + /** TranscriptNormalization entries. */ + public entries: google.cloud.speech.v2.TranscriptNormalization.IEntry[]; /** - * Creates a new SpeechAdaptation instance using the specified properties. + * Creates a new TranscriptNormalization instance using the specified properties. * @param [properties] Properties to set - * @returns SpeechAdaptation instance + * @returns TranscriptNormalization instance */ - public static create(properties?: google.cloud.speech.v2.ISpeechAdaptation): google.cloud.speech.v2.SpeechAdaptation; + public static create(properties?: google.cloud.speech.v2.ITranscriptNormalization): google.cloud.speech.v2.TranscriptNormalization; /** - * Encodes the specified SpeechAdaptation message. Does not implicitly {@link google.cloud.speech.v2.SpeechAdaptation.verify|verify} messages. - * @param message SpeechAdaptation message or plain object to encode + * Encodes the specified TranscriptNormalization message. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.verify|verify} messages. + * @param message TranscriptNormalization message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.speech.v2.ISpeechAdaptation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.speech.v2.ITranscriptNormalization, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SpeechAdaptation message, length delimited. Does not implicitly {@link google.cloud.speech.v2.SpeechAdaptation.verify|verify} messages. - * @param message SpeechAdaptation message or plain object to encode + * Encodes the specified TranscriptNormalization message, length delimited. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.verify|verify} messages. + * @param message TranscriptNormalization message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.speech.v2.ISpeechAdaptation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.speech.v2.ITranscriptNormalization, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SpeechAdaptation message from the specified reader or buffer. + * Decodes a TranscriptNormalization message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SpeechAdaptation + * @returns TranscriptNormalization * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v2.SpeechAdaptation; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v2.TranscriptNormalization; /** - * Decodes a SpeechAdaptation message from the specified reader or buffer, length delimited. + * Decodes a TranscriptNormalization message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SpeechAdaptation + * @returns TranscriptNormalization * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v2.SpeechAdaptation; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v2.TranscriptNormalization; /** - * Verifies a SpeechAdaptation message. + * Verifies a TranscriptNormalization message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SpeechAdaptation message from a plain object. Also converts values to their respective internal types. + * Creates a TranscriptNormalization message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SpeechAdaptation + * @returns TranscriptNormalization */ - public static fromObject(object: { [k: string]: any }): google.cloud.speech.v2.SpeechAdaptation; + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v2.TranscriptNormalization; /** - * Creates a plain object from a SpeechAdaptation message. Also converts values to other types if specified. - * @param message SpeechAdaptation + * Creates a plain object from a TranscriptNormalization message. Also converts values to other types if specified. + * @param message TranscriptNormalization * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.speech.v2.SpeechAdaptation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.speech.v2.TranscriptNormalization, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranscriptNormalization to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranscriptNormalization + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TranscriptNormalization { + + /** Properties of an Entry. */ + interface IEntry { + + /** Entry search */ + search?: (string|null); + + /** Entry replace */ + replace?: (string|null); + + /** Entry caseSensitive */ + caseSensitive?: (boolean|null); + } + + /** Represents an Entry. */ + class Entry implements IEntry { + + /** + * Constructs a new Entry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v2.TranscriptNormalization.IEntry); + + /** Entry search. */ + public search: string; + + /** Entry replace. */ + public replace: string; + + /** Entry caseSensitive. */ + public caseSensitive: boolean; + + /** + * Creates a new Entry instance using the specified properties. + * @param [properties] Properties to set + * @returns Entry instance + */ + public static create(properties?: google.cloud.speech.v2.TranscriptNormalization.IEntry): google.cloud.speech.v2.TranscriptNormalization.Entry; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v2.TranscriptNormalization.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v2.TranscriptNormalization.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v2.TranscriptNormalization.Entry; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v2.TranscriptNormalization.Entry; + + /** + * Verifies an Entry message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Entry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v2.TranscriptNormalization.Entry; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @param message Entry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v2.TranscriptNormalization.Entry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SpeechAdaptation. */ + interface ISpeechAdaptation { + + /** SpeechAdaptation phraseSets */ + phraseSets?: (google.cloud.speech.v2.SpeechAdaptation.IAdaptationPhraseSet[]|null); + + /** SpeechAdaptation customClasses */ + customClasses?: (google.cloud.speech.v2.ICustomClass[]|null); + } + + /** Represents a SpeechAdaptation. */ + class SpeechAdaptation implements ISpeechAdaptation { + + /** + * Constructs a new SpeechAdaptation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v2.ISpeechAdaptation); + + /** SpeechAdaptation phraseSets. */ + public phraseSets: google.cloud.speech.v2.SpeechAdaptation.IAdaptationPhraseSet[]; + + /** SpeechAdaptation customClasses. */ + public customClasses: google.cloud.speech.v2.ICustomClass[]; + + /** + * Creates a new SpeechAdaptation instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechAdaptation instance + */ + public static create(properties?: google.cloud.speech.v2.ISpeechAdaptation): google.cloud.speech.v2.SpeechAdaptation; + + /** + * Encodes the specified SpeechAdaptation message. Does not implicitly {@link google.cloud.speech.v2.SpeechAdaptation.verify|verify} messages. + * @param message SpeechAdaptation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v2.ISpeechAdaptation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechAdaptation message, length delimited. Does not implicitly {@link google.cloud.speech.v2.SpeechAdaptation.verify|verify} messages. + * @param message SpeechAdaptation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v2.ISpeechAdaptation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechAdaptation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechAdaptation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v2.SpeechAdaptation; + + /** + * Decodes a SpeechAdaptation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechAdaptation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v2.SpeechAdaptation; + + /** + * Verifies a SpeechAdaptation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechAdaptation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechAdaptation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v2.SpeechAdaptation; + + /** + * Creates a plain object from a SpeechAdaptation message. Also converts values to other types if specified. + * @param message SpeechAdaptation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v2.SpeechAdaptation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this SpeechAdaptation to JSON. @@ -11958,6 +12389,9 @@ export namespace google { /** RecognitionConfig adaptation */ adaptation?: (google.cloud.speech.v2.ISpeechAdaptation|null); + + /** RecognitionConfig transcriptNormalization */ + transcriptNormalization?: (google.cloud.speech.v2.ITranscriptNormalization|null); } /** Represents a RecognitionConfig. */ @@ -11987,6 +12421,9 @@ export namespace google { /** RecognitionConfig adaptation. */ public adaptation?: (google.cloud.speech.v2.ISpeechAdaptation|null); + /** RecognitionConfig transcriptNormalization. */ + public transcriptNormalization?: (google.cloud.speech.v2.ITranscriptNormalization|null); + /** RecognitionConfig decodingConfig. */ public decodingConfig?: ("autoDecodingConfig"|"explicitDecodingConfig"); @@ -13809,11 +14246,202 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a BatchRecognizeFileResult. */ - interface IBatchRecognizeFileResult { + /** Properties of a CloudStorageResult. */ + interface ICloudStorageResult { - /** BatchRecognizeFileResult uri */ + /** CloudStorageResult uri */ uri?: (string|null); + } + + /** Represents a CloudStorageResult. */ + class CloudStorageResult implements ICloudStorageResult { + + /** + * Constructs a new CloudStorageResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v2.ICloudStorageResult); + + /** CloudStorageResult uri. */ + public uri: string; + + /** + * Creates a new CloudStorageResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CloudStorageResult instance + */ + public static create(properties?: google.cloud.speech.v2.ICloudStorageResult): google.cloud.speech.v2.CloudStorageResult; + + /** + * Encodes the specified CloudStorageResult message. Does not implicitly {@link google.cloud.speech.v2.CloudStorageResult.verify|verify} messages. + * @param message CloudStorageResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v2.ICloudStorageResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloudStorageResult message, length delimited. Does not implicitly {@link google.cloud.speech.v2.CloudStorageResult.verify|verify} messages. + * @param message CloudStorageResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v2.ICloudStorageResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloudStorageResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloudStorageResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v2.CloudStorageResult; + + /** + * Decodes a CloudStorageResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloudStorageResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v2.CloudStorageResult; + + /** + * Verifies a CloudStorageResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloudStorageResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloudStorageResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v2.CloudStorageResult; + + /** + * Creates a plain object from a CloudStorageResult message. Also converts values to other types if specified. + * @param message CloudStorageResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v2.CloudStorageResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloudStorageResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloudStorageResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InlineResult. */ + interface IInlineResult { + + /** InlineResult transcript */ + transcript?: (google.cloud.speech.v2.IBatchRecognizeResults|null); + } + + /** Represents an InlineResult. */ + class InlineResult implements IInlineResult { + + /** + * Constructs a new InlineResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v2.IInlineResult); + + /** InlineResult transcript. */ + public transcript?: (google.cloud.speech.v2.IBatchRecognizeResults|null); + + /** + * Creates a new InlineResult instance using the specified properties. + * @param [properties] Properties to set + * @returns InlineResult instance + */ + public static create(properties?: google.cloud.speech.v2.IInlineResult): google.cloud.speech.v2.InlineResult; + + /** + * Encodes the specified InlineResult message. Does not implicitly {@link google.cloud.speech.v2.InlineResult.verify|verify} messages. + * @param message InlineResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v2.IInlineResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InlineResult message, length delimited. Does not implicitly {@link google.cloud.speech.v2.InlineResult.verify|verify} messages. + * @param message InlineResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v2.IInlineResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InlineResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InlineResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v2.InlineResult; + + /** + * Decodes an InlineResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InlineResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v2.InlineResult; + + /** + * Verifies an InlineResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InlineResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InlineResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v2.InlineResult; + + /** + * Creates a plain object from an InlineResult message. Also converts values to other types if specified. + * @param message InlineResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v2.InlineResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InlineResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InlineResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchRecognizeFileResult. */ + interface IBatchRecognizeFileResult { /** BatchRecognizeFileResult error */ error?: (google.rpc.IStatus|null); @@ -13821,6 +14449,15 @@ export namespace google { /** BatchRecognizeFileResult metadata */ metadata?: (google.cloud.speech.v2.IRecognitionResponseMetadata|null); + /** BatchRecognizeFileResult cloudStorageResult */ + cloudStorageResult?: (google.cloud.speech.v2.ICloudStorageResult|null); + + /** BatchRecognizeFileResult inlineResult */ + inlineResult?: (google.cloud.speech.v2.IInlineResult|null); + + /** BatchRecognizeFileResult uri */ + uri?: (string|null); + /** BatchRecognizeFileResult transcript */ transcript?: (google.cloud.speech.v2.IBatchRecognizeResults|null); } @@ -13834,18 +14471,27 @@ export namespace google { */ constructor(properties?: google.cloud.speech.v2.IBatchRecognizeFileResult); - /** BatchRecognizeFileResult uri. */ - public uri: string; - /** BatchRecognizeFileResult error. */ public error?: (google.rpc.IStatus|null); /** BatchRecognizeFileResult metadata. */ public metadata?: (google.cloud.speech.v2.IRecognitionResponseMetadata|null); + /** BatchRecognizeFileResult cloudStorageResult. */ + public cloudStorageResult?: (google.cloud.speech.v2.ICloudStorageResult|null); + + /** BatchRecognizeFileResult inlineResult. */ + public inlineResult?: (google.cloud.speech.v2.IInlineResult|null); + + /** BatchRecognizeFileResult uri. */ + public uri: string; + /** BatchRecognizeFileResult transcript. */ public transcript?: (google.cloud.speech.v2.IBatchRecognizeResults|null); + /** BatchRecognizeFileResult result. */ + public result?: ("cloudStorageResult"|"inlineResult"); + /** * Creates a new BatchRecognizeFileResult instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-speech/protos/protos.js b/packages/google-cloud-speech/protos/protos.js index c6ade7d4cea..057d0a469d1 100644 --- a/packages/google-cloud-speech/protos/protos.js +++ b/packages/google-cloud-speech/protos/protos.js @@ -1740,6 +1740,7 @@ * @property {number|null} [maxAlternatives] RecognitionConfig maxAlternatives * @property {boolean|null} [profanityFilter] RecognitionConfig profanityFilter * @property {google.cloud.speech.v1.ISpeechAdaptation|null} [adaptation] RecognitionConfig adaptation + * @property {google.cloud.speech.v1.ITranscriptNormalization|null} [transcriptNormalization] RecognitionConfig transcriptNormalization * @property {Array.|null} [speechContexts] RecognitionConfig speechContexts * @property {boolean|null} [enableWordTimeOffsets] RecognitionConfig enableWordTimeOffsets * @property {boolean|null} [enableWordConfidence] RecognitionConfig enableWordConfidence @@ -1841,6 +1842,14 @@ */ RecognitionConfig.prototype.adaptation = null; + /** + * RecognitionConfig transcriptNormalization. + * @member {google.cloud.speech.v1.ITranscriptNormalization|null|undefined} transcriptNormalization + * @memberof google.cloud.speech.v1.RecognitionConfig + * @instance + */ + RecognitionConfig.prototype.transcriptNormalization = null; + /** * RecognitionConfig speechContexts. * @member {Array.} speechContexts @@ -1985,6 +1994,8 @@ $root.google.protobuf.BoolValue.encode(message.enableSpokenPunctuation, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.enableSpokenEmojis != null && Object.hasOwnProperty.call(message, "enableSpokenEmojis")) $root.google.protobuf.BoolValue.encode(message.enableSpokenEmojis, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.transcriptNormalization != null && Object.hasOwnProperty.call(message, "transcriptNormalization")) + $root.google.cloud.speech.v1.TranscriptNormalization.encode(message.transcriptNormalization, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); return writer; }; @@ -2057,6 +2068,10 @@ message.adaptation = $root.google.cloud.speech.v1.SpeechAdaptation.decode(reader, reader.uint32()); break; } + case 24: { + message.transcriptNormalization = $root.google.cloud.speech.v1.TranscriptNormalization.decode(reader, reader.uint32()); + break; + } case 6: { if (!(message.speechContexts && message.speechContexts.length)) message.speechContexts = []; @@ -2146,6 +2161,7 @@ case 5: case 6: case 7: + case 8: case 9: break; } @@ -2179,6 +2195,11 @@ if (error) return "adaptation." + error; } + if (message.transcriptNormalization != null && message.hasOwnProperty("transcriptNormalization")) { + var error = $root.google.cloud.speech.v1.TranscriptNormalization.verify(message.transcriptNormalization); + if (error) + return "transcriptNormalization." + error; + } if (message.speechContexts != null && message.hasOwnProperty("speechContexts")) { if (!Array.isArray(message.speechContexts)) return "speechContexts: array expected"; @@ -2277,6 +2298,10 @@ case 7: message.encoding = 7; break; + case "MP3": + case 8: + message.encoding = 8; + break; case "WEBM_OPUS": case 9: message.encoding = 9; @@ -2306,6 +2331,11 @@ throw TypeError(".google.cloud.speech.v1.RecognitionConfig.adaptation: object expected"); message.adaptation = $root.google.cloud.speech.v1.SpeechAdaptation.fromObject(object.adaptation); } + if (object.transcriptNormalization != null) { + if (typeof object.transcriptNormalization !== "object") + throw TypeError(".google.cloud.speech.v1.RecognitionConfig.transcriptNormalization: object expected"); + message.transcriptNormalization = $root.google.cloud.speech.v1.TranscriptNormalization.fromObject(object.transcriptNormalization); + } if (object.speechContexts) { if (!Array.isArray(object.speechContexts)) throw TypeError(".google.cloud.speech.v1.RecognitionConfig.speechContexts: array expected"); @@ -2384,6 +2414,7 @@ object.adaptation = null; object.enableSpokenPunctuation = null; object.enableSpokenEmojis = null; + object.transcriptNormalization = null; } if (message.encoding != null && message.hasOwnProperty("encoding")) object.encoding = options.enums === String ? $root.google.cloud.speech.v1.RecognitionConfig.AudioEncoding[message.encoding] === undefined ? message.encoding : $root.google.cloud.speech.v1.RecognitionConfig.AudioEncoding[message.encoding] : message.encoding; @@ -2429,6 +2460,8 @@ object.enableSpokenPunctuation = $root.google.protobuf.BoolValue.toObject(message.enableSpokenPunctuation, options); if (message.enableSpokenEmojis != null && message.hasOwnProperty("enableSpokenEmojis")) object.enableSpokenEmojis = $root.google.protobuf.BoolValue.toObject(message.enableSpokenEmojis, options); + if (message.transcriptNormalization != null && message.hasOwnProperty("transcriptNormalization")) + object.transcriptNormalization = $root.google.cloud.speech.v1.TranscriptNormalization.toObject(message.transcriptNormalization, options); return object; }; @@ -2470,6 +2503,7 @@ * @property {number} AMR_WB=5 AMR_WB value * @property {number} OGG_OPUS=6 OGG_OPUS value * @property {number} SPEEX_WITH_HEADER_BYTE=7 SPEEX_WITH_HEADER_BYTE value + * @property {number} MP3=8 MP3 value * @property {number} WEBM_OPUS=9 WEBM_OPUS value */ RecognitionConfig.AudioEncoding = (function() { @@ -2482,6 +2516,7 @@ values[valuesById[5] = "AMR_WB"] = 5; values[valuesById[6] = "OGG_OPUS"] = 6; values[valuesById[7] = "SPEEX_WITH_HEADER_BYTE"] = 7; + values[valuesById[8] = "MP3"] = 8; values[valuesById[9] = "WEBM_OPUS"] = 9; return values; })(); @@ -6218,6 +6253,7 @@ * @property {string|null} [word] WordInfo word * @property {number|null} [confidence] WordInfo confidence * @property {number|null} [speakerTag] WordInfo speakerTag + * @property {string|null} [speakerLabel] WordInfo speakerLabel */ /** @@ -6275,6 +6311,14 @@ */ WordInfo.prototype.speakerTag = 0; + /** + * WordInfo speakerLabel. + * @member {string} speakerLabel + * @memberof google.cloud.speech.v1.WordInfo + * @instance + */ + WordInfo.prototype.speakerLabel = ""; + /** * Creates a new WordInfo instance using the specified properties. * @function create @@ -6309,6 +6353,8 @@ writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); if (message.speakerTag != null && Object.hasOwnProperty.call(message, "speakerTag")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.speakerTag); + if (message.speakerLabel != null && Object.hasOwnProperty.call(message, "speakerLabel")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.speakerLabel); return writer; }; @@ -6363,6 +6409,10 @@ message.speakerTag = reader.int32(); break; } + case 6: { + message.speakerLabel = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6417,6 +6467,9 @@ if (message.speakerTag != null && message.hasOwnProperty("speakerTag")) if (!$util.isInteger(message.speakerTag)) return "speakerTag: integer expected"; + if (message.speakerLabel != null && message.hasOwnProperty("speakerLabel")) + if (!$util.isString(message.speakerLabel)) + return "speakerLabel: string expected"; return null; }; @@ -6448,6 +6501,8 @@ message.confidence = Number(object.confidence); if (object.speakerTag != null) message.speakerTag = object.speakerTag | 0; + if (object.speakerLabel != null) + message.speakerLabel = String(object.speakerLabel); return message; }; @@ -6470,6 +6525,7 @@ object.word = ""; object.confidence = 0; object.speakerTag = 0; + object.speakerLabel = ""; } if (message.startTime != null && message.hasOwnProperty("startTime")) object.startTime = $root.google.protobuf.Duration.toObject(message.startTime, options); @@ -6481,6 +6537,8 @@ object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; if (message.speakerTag != null && message.hasOwnProperty("speakerTag")) object.speakerTag = message.speakerTag; + if (message.speakerLabel != null && message.hasOwnProperty("speakerLabel")) + object.speakerLabel = message.speakerLabel; return object; }; @@ -8270,6 +8328,480 @@ return SpeechAdaptation; })(); + v1.TranscriptNormalization = (function() { + + /** + * Properties of a TranscriptNormalization. + * @memberof google.cloud.speech.v1 + * @interface ITranscriptNormalization + * @property {Array.|null} [entries] TranscriptNormalization entries + */ + + /** + * Constructs a new TranscriptNormalization. + * @memberof google.cloud.speech.v1 + * @classdesc Represents a TranscriptNormalization. + * @implements ITranscriptNormalization + * @constructor + * @param {google.cloud.speech.v1.ITranscriptNormalization=} [properties] Properties to set + */ + function TranscriptNormalization(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranscriptNormalization entries. + * @member {Array.} entries + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @instance + */ + TranscriptNormalization.prototype.entries = $util.emptyArray; + + /** + * Creates a new TranscriptNormalization instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {google.cloud.speech.v1.ITranscriptNormalization=} [properties] Properties to set + * @returns {google.cloud.speech.v1.TranscriptNormalization} TranscriptNormalization instance + */ + TranscriptNormalization.create = function create(properties) { + return new TranscriptNormalization(properties); + }; + + /** + * Encodes the specified TranscriptNormalization message. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {google.cloud.speech.v1.ITranscriptNormalization} message TranscriptNormalization message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranscriptNormalization.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.google.cloud.speech.v1.TranscriptNormalization.Entry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranscriptNormalization message, length delimited. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {google.cloud.speech.v1.ITranscriptNormalization} message TranscriptNormalization message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranscriptNormalization.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranscriptNormalization message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v1.TranscriptNormalization} TranscriptNormalization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranscriptNormalization.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v1.TranscriptNormalization(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.google.cloud.speech.v1.TranscriptNormalization.Entry.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranscriptNormalization message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v1.TranscriptNormalization} TranscriptNormalization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranscriptNormalization.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranscriptNormalization message. + * @function verify + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranscriptNormalization.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.google.cloud.speech.v1.TranscriptNormalization.Entry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates a TranscriptNormalization message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v1.TranscriptNormalization} TranscriptNormalization + */ + TranscriptNormalization.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v1.TranscriptNormalization) + return object; + var message = new $root.google.cloud.speech.v1.TranscriptNormalization(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.cloud.speech.v1.TranscriptNormalization.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".google.cloud.speech.v1.TranscriptNormalization.entries: object expected"); + message.entries[i] = $root.google.cloud.speech.v1.TranscriptNormalization.Entry.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TranscriptNormalization message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {google.cloud.speech.v1.TranscriptNormalization} message TranscriptNormalization + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranscriptNormalization.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.google.cloud.speech.v1.TranscriptNormalization.Entry.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this TranscriptNormalization to JSON. + * @function toJSON + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @instance + * @returns {Object.} JSON object + */ + TranscriptNormalization.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranscriptNormalization + * @function getTypeUrl + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranscriptNormalization.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.speech.v1.TranscriptNormalization"; + }; + + TranscriptNormalization.Entry = (function() { + + /** + * Properties of an Entry. + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @interface IEntry + * @property {string|null} [search] Entry search + * @property {string|null} [replace] Entry replace + * @property {boolean|null} [caseSensitive] Entry caseSensitive + */ + + /** + * Constructs a new Entry. + * @memberof google.cloud.speech.v1.TranscriptNormalization + * @classdesc Represents an Entry. + * @implements IEntry + * @constructor + * @param {google.cloud.speech.v1.TranscriptNormalization.IEntry=} [properties] Properties to set + */ + function Entry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entry search. + * @member {string} search + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @instance + */ + Entry.prototype.search = ""; + + /** + * Entry replace. + * @member {string} replace + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @instance + */ + Entry.prototype.replace = ""; + + /** + * Entry caseSensitive. + * @member {boolean} caseSensitive + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @instance + */ + Entry.prototype.caseSensitive = false; + + /** + * Creates a new Entry instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v1.TranscriptNormalization.IEntry=} [properties] Properties to set + * @returns {google.cloud.speech.v1.TranscriptNormalization.Entry} Entry instance + */ + Entry.create = function create(properties) { + return new Entry(properties); + }; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.Entry.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v1.TranscriptNormalization.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.search != null && Object.hasOwnProperty.call(message, "search")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.search); + if (message.replace != null && Object.hasOwnProperty.call(message, "replace")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.replace); + if (message.caseSensitive != null && Object.hasOwnProperty.call(message, "caseSensitive")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.caseSensitive); + return writer; + }; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.speech.v1.TranscriptNormalization.Entry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v1.TranscriptNormalization.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v1.TranscriptNormalization.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v1.TranscriptNormalization.Entry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.search = reader.string(); + break; + } + case 2: { + message.replace = reader.string(); + break; + } + case 3: { + message.caseSensitive = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v1.TranscriptNormalization.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entry message. + * @function verify + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.search != null && message.hasOwnProperty("search")) + if (!$util.isString(message.search)) + return "search: string expected"; + if (message.replace != null && message.hasOwnProperty("replace")) + if (!$util.isString(message.replace)) + return "replace: string expected"; + if (message.caseSensitive != null && message.hasOwnProperty("caseSensitive")) + if (typeof message.caseSensitive !== "boolean") + return "caseSensitive: boolean expected"; + return null; + }; + + /** + * Creates an Entry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v1.TranscriptNormalization.Entry} Entry + */ + Entry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v1.TranscriptNormalization.Entry) + return object; + var message = new $root.google.cloud.speech.v1.TranscriptNormalization.Entry(); + if (object.search != null) + message.search = String(object.search); + if (object.replace != null) + message.replace = String(object.replace); + if (object.caseSensitive != null) + message.caseSensitive = Boolean(object.caseSensitive); + return message; + }; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v1.TranscriptNormalization.Entry} message Entry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.search = ""; + object.replace = ""; + object.caseSensitive = false; + } + if (message.search != null && message.hasOwnProperty("search")) + object.search = message.search; + if (message.replace != null && message.hasOwnProperty("replace")) + object.replace = message.replace; + if (message.caseSensitive != null && message.hasOwnProperty("caseSensitive")) + object.caseSensitive = message.caseSensitive; + return object; + }; + + /** + * Converts this Entry to JSON. + * @function toJSON + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @instance + * @returns {Object.} JSON object + */ + Entry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Entry + * @function getTypeUrl + * @memberof google.cloud.speech.v1.TranscriptNormalization.Entry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.speech.v1.TranscriptNormalization.Entry"; + }; + + return Entry; + })(); + + return TranscriptNormalization; + })(); + v1.Adaptation = (function() { /** @@ -28702,6 +29234,480 @@ return RecognitionFeatures; })(); + v2.TranscriptNormalization = (function() { + + /** + * Properties of a TranscriptNormalization. + * @memberof google.cloud.speech.v2 + * @interface ITranscriptNormalization + * @property {Array.|null} [entries] TranscriptNormalization entries + */ + + /** + * Constructs a new TranscriptNormalization. + * @memberof google.cloud.speech.v2 + * @classdesc Represents a TranscriptNormalization. + * @implements ITranscriptNormalization + * @constructor + * @param {google.cloud.speech.v2.ITranscriptNormalization=} [properties] Properties to set + */ + function TranscriptNormalization(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranscriptNormalization entries. + * @member {Array.} entries + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @instance + */ + TranscriptNormalization.prototype.entries = $util.emptyArray; + + /** + * Creates a new TranscriptNormalization instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {google.cloud.speech.v2.ITranscriptNormalization=} [properties] Properties to set + * @returns {google.cloud.speech.v2.TranscriptNormalization} TranscriptNormalization instance + */ + TranscriptNormalization.create = function create(properties) { + return new TranscriptNormalization(properties); + }; + + /** + * Encodes the specified TranscriptNormalization message. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {google.cloud.speech.v2.ITranscriptNormalization} message TranscriptNormalization message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranscriptNormalization.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.google.cloud.speech.v2.TranscriptNormalization.Entry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranscriptNormalization message, length delimited. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {google.cloud.speech.v2.ITranscriptNormalization} message TranscriptNormalization message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranscriptNormalization.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranscriptNormalization message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v2.TranscriptNormalization} TranscriptNormalization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranscriptNormalization.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v2.TranscriptNormalization(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.google.cloud.speech.v2.TranscriptNormalization.Entry.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranscriptNormalization message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v2.TranscriptNormalization} TranscriptNormalization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranscriptNormalization.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranscriptNormalization message. + * @function verify + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranscriptNormalization.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.google.cloud.speech.v2.TranscriptNormalization.Entry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates a TranscriptNormalization message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v2.TranscriptNormalization} TranscriptNormalization + */ + TranscriptNormalization.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v2.TranscriptNormalization) + return object; + var message = new $root.google.cloud.speech.v2.TranscriptNormalization(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.cloud.speech.v2.TranscriptNormalization.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".google.cloud.speech.v2.TranscriptNormalization.entries: object expected"); + message.entries[i] = $root.google.cloud.speech.v2.TranscriptNormalization.Entry.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TranscriptNormalization message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {google.cloud.speech.v2.TranscriptNormalization} message TranscriptNormalization + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranscriptNormalization.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.google.cloud.speech.v2.TranscriptNormalization.Entry.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this TranscriptNormalization to JSON. + * @function toJSON + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @instance + * @returns {Object.} JSON object + */ + TranscriptNormalization.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranscriptNormalization + * @function getTypeUrl + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranscriptNormalization.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.speech.v2.TranscriptNormalization"; + }; + + TranscriptNormalization.Entry = (function() { + + /** + * Properties of an Entry. + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @interface IEntry + * @property {string|null} [search] Entry search + * @property {string|null} [replace] Entry replace + * @property {boolean|null} [caseSensitive] Entry caseSensitive + */ + + /** + * Constructs a new Entry. + * @memberof google.cloud.speech.v2.TranscriptNormalization + * @classdesc Represents an Entry. + * @implements IEntry + * @constructor + * @param {google.cloud.speech.v2.TranscriptNormalization.IEntry=} [properties] Properties to set + */ + function Entry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entry search. + * @member {string} search + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @instance + */ + Entry.prototype.search = ""; + + /** + * Entry replace. + * @member {string} replace + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @instance + */ + Entry.prototype.replace = ""; + + /** + * Entry caseSensitive. + * @member {boolean} caseSensitive + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @instance + */ + Entry.prototype.caseSensitive = false; + + /** + * Creates a new Entry instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v2.TranscriptNormalization.IEntry=} [properties] Properties to set + * @returns {google.cloud.speech.v2.TranscriptNormalization.Entry} Entry instance + */ + Entry.create = function create(properties) { + return new Entry(properties); + }; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.Entry.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v2.TranscriptNormalization.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.search != null && Object.hasOwnProperty.call(message, "search")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.search); + if (message.replace != null && Object.hasOwnProperty.call(message, "replace")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.replace); + if (message.caseSensitive != null && Object.hasOwnProperty.call(message, "caseSensitive")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.caseSensitive); + return writer; + }; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.speech.v2.TranscriptNormalization.Entry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v2.TranscriptNormalization.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v2.TranscriptNormalization.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v2.TranscriptNormalization.Entry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.search = reader.string(); + break; + } + case 2: { + message.replace = reader.string(); + break; + } + case 3: { + message.caseSensitive = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v2.TranscriptNormalization.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entry message. + * @function verify + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.search != null && message.hasOwnProperty("search")) + if (!$util.isString(message.search)) + return "search: string expected"; + if (message.replace != null && message.hasOwnProperty("replace")) + if (!$util.isString(message.replace)) + return "replace: string expected"; + if (message.caseSensitive != null && message.hasOwnProperty("caseSensitive")) + if (typeof message.caseSensitive !== "boolean") + return "caseSensitive: boolean expected"; + return null; + }; + + /** + * Creates an Entry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v2.TranscriptNormalization.Entry} Entry + */ + Entry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v2.TranscriptNormalization.Entry) + return object; + var message = new $root.google.cloud.speech.v2.TranscriptNormalization.Entry(); + if (object.search != null) + message.search = String(object.search); + if (object.replace != null) + message.replace = String(object.replace); + if (object.caseSensitive != null) + message.caseSensitive = Boolean(object.caseSensitive); + return message; + }; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {google.cloud.speech.v2.TranscriptNormalization.Entry} message Entry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.search = ""; + object.replace = ""; + object.caseSensitive = false; + } + if (message.search != null && message.hasOwnProperty("search")) + object.search = message.search; + if (message.replace != null && message.hasOwnProperty("replace")) + object.replace = message.replace; + if (message.caseSensitive != null && message.hasOwnProperty("caseSensitive")) + object.caseSensitive = message.caseSensitive; + return object; + }; + + /** + * Converts this Entry to JSON. + * @function toJSON + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @instance + * @returns {Object.} JSON object + */ + Entry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Entry + * @function getTypeUrl + * @memberof google.cloud.speech.v2.TranscriptNormalization.Entry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.speech.v2.TranscriptNormalization.Entry"; + }; + + return Entry; + })(); + + return TranscriptNormalization; + })(); + v2.SpeechAdaptation = (function() { /** @@ -29239,6 +30245,7 @@ * @property {Array.|null} [languageCodes] RecognitionConfig languageCodes * @property {google.cloud.speech.v2.IRecognitionFeatures|null} [features] RecognitionConfig features * @property {google.cloud.speech.v2.ISpeechAdaptation|null} [adaptation] RecognitionConfig adaptation + * @property {google.cloud.speech.v2.ITranscriptNormalization|null} [transcriptNormalization] RecognitionConfig transcriptNormalization */ /** @@ -29305,6 +30312,14 @@ */ RecognitionConfig.prototype.adaptation = null; + /** + * RecognitionConfig transcriptNormalization. + * @member {google.cloud.speech.v2.ITranscriptNormalization|null|undefined} transcriptNormalization + * @memberof google.cloud.speech.v2.RecognitionConfig + * @instance + */ + RecognitionConfig.prototype.transcriptNormalization = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -29356,6 +30371,8 @@ if (message.languageCodes != null && message.languageCodes.length) for (var i = 0; i < message.languageCodes.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.languageCodes[i]); + if (message.transcriptNormalization != null && Object.hasOwnProperty.call(message, "transcriptNormalization")) + $root.google.cloud.speech.v2.TranscriptNormalization.encode(message.transcriptNormalization, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); return writer; }; @@ -29416,6 +30433,10 @@ message.adaptation = $root.google.cloud.speech.v2.SpeechAdaptation.decode(reader, reader.uint32()); break; } + case 11: { + message.transcriptNormalization = $root.google.cloud.speech.v2.TranscriptNormalization.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -29490,6 +30511,11 @@ if (error) return "adaptation." + error; } + if (message.transcriptNormalization != null && message.hasOwnProperty("transcriptNormalization")) { + var error = $root.google.cloud.speech.v2.TranscriptNormalization.verify(message.transcriptNormalization); + if (error) + return "transcriptNormalization." + error; + } return null; }; @@ -29534,6 +30560,11 @@ throw TypeError(".google.cloud.speech.v2.RecognitionConfig.adaptation: object expected"); message.adaptation = $root.google.cloud.speech.v2.SpeechAdaptation.fromObject(object.adaptation); } + if (object.transcriptNormalization != null) { + if (typeof object.transcriptNormalization !== "object") + throw TypeError(".google.cloud.speech.v2.RecognitionConfig.transcriptNormalization: object expected"); + message.transcriptNormalization = $root.google.cloud.speech.v2.TranscriptNormalization.fromObject(object.transcriptNormalization); + } return message; }; @@ -29556,6 +30587,7 @@ object.features = null; object.adaptation = null; object.model = ""; + object.transcriptNormalization = null; } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.cloud.speech.v2.RecognitionFeatures.toObject(message.features, options); @@ -29578,6 +30610,8 @@ for (var j = 0; j < message.languageCodes.length; ++j) object.languageCodes[j] = message.languageCodes[j]; } + if (message.transcriptNormalization != null && message.hasOwnProperty("transcriptNormalization")) + object.transcriptNormalization = $root.google.cloud.speech.v2.TranscriptNormalization.toObject(message.transcriptNormalization, options); return object; }; @@ -33879,15 +34913,428 @@ return BatchRecognizeResults; })(); + v2.CloudStorageResult = (function() { + + /** + * Properties of a CloudStorageResult. + * @memberof google.cloud.speech.v2 + * @interface ICloudStorageResult + * @property {string|null} [uri] CloudStorageResult uri + */ + + /** + * Constructs a new CloudStorageResult. + * @memberof google.cloud.speech.v2 + * @classdesc Represents a CloudStorageResult. + * @implements ICloudStorageResult + * @constructor + * @param {google.cloud.speech.v2.ICloudStorageResult=} [properties] Properties to set + */ + function CloudStorageResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloudStorageResult uri. + * @member {string} uri + * @memberof google.cloud.speech.v2.CloudStorageResult + * @instance + */ + CloudStorageResult.prototype.uri = ""; + + /** + * Creates a new CloudStorageResult instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {google.cloud.speech.v2.ICloudStorageResult=} [properties] Properties to set + * @returns {google.cloud.speech.v2.CloudStorageResult} CloudStorageResult instance + */ + CloudStorageResult.create = function create(properties) { + return new CloudStorageResult(properties); + }; + + /** + * Encodes the specified CloudStorageResult message. Does not implicitly {@link google.cloud.speech.v2.CloudStorageResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {google.cloud.speech.v2.ICloudStorageResult} message CloudStorageResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudStorageResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + return writer; + }; + + /** + * Encodes the specified CloudStorageResult message, length delimited. Does not implicitly {@link google.cloud.speech.v2.CloudStorageResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {google.cloud.speech.v2.ICloudStorageResult} message CloudStorageResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudStorageResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloudStorageResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v2.CloudStorageResult} CloudStorageResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudStorageResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v2.CloudStorageResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloudStorageResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v2.CloudStorageResult} CloudStorageResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudStorageResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloudStorageResult message. + * @function verify + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloudStorageResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + return null; + }; + + /** + * Creates a CloudStorageResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v2.CloudStorageResult} CloudStorageResult + */ + CloudStorageResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v2.CloudStorageResult) + return object; + var message = new $root.google.cloud.speech.v2.CloudStorageResult(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a CloudStorageResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {google.cloud.speech.v2.CloudStorageResult} message CloudStorageResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloudStorageResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this CloudStorageResult to JSON. + * @function toJSON + * @memberof google.cloud.speech.v2.CloudStorageResult + * @instance + * @returns {Object.} JSON object + */ + CloudStorageResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloudStorageResult + * @function getTypeUrl + * @memberof google.cloud.speech.v2.CloudStorageResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloudStorageResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.speech.v2.CloudStorageResult"; + }; + + return CloudStorageResult; + })(); + + v2.InlineResult = (function() { + + /** + * Properties of an InlineResult. + * @memberof google.cloud.speech.v2 + * @interface IInlineResult + * @property {google.cloud.speech.v2.IBatchRecognizeResults|null} [transcript] InlineResult transcript + */ + + /** + * Constructs a new InlineResult. + * @memberof google.cloud.speech.v2 + * @classdesc Represents an InlineResult. + * @implements IInlineResult + * @constructor + * @param {google.cloud.speech.v2.IInlineResult=} [properties] Properties to set + */ + function InlineResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InlineResult transcript. + * @member {google.cloud.speech.v2.IBatchRecognizeResults|null|undefined} transcript + * @memberof google.cloud.speech.v2.InlineResult + * @instance + */ + InlineResult.prototype.transcript = null; + + /** + * Creates a new InlineResult instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {google.cloud.speech.v2.IInlineResult=} [properties] Properties to set + * @returns {google.cloud.speech.v2.InlineResult} InlineResult instance + */ + InlineResult.create = function create(properties) { + return new InlineResult(properties); + }; + + /** + * Encodes the specified InlineResult message. Does not implicitly {@link google.cloud.speech.v2.InlineResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {google.cloud.speech.v2.IInlineResult} message InlineResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InlineResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transcript != null && Object.hasOwnProperty.call(message, "transcript")) + $root.google.cloud.speech.v2.BatchRecognizeResults.encode(message.transcript, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InlineResult message, length delimited. Does not implicitly {@link google.cloud.speech.v2.InlineResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {google.cloud.speech.v2.IInlineResult} message InlineResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InlineResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InlineResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v2.InlineResult} InlineResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InlineResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v2.InlineResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.transcript = $root.google.cloud.speech.v2.BatchRecognizeResults.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InlineResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v2.InlineResult} InlineResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InlineResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InlineResult message. + * @function verify + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InlineResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transcript != null && message.hasOwnProperty("transcript")) { + var error = $root.google.cloud.speech.v2.BatchRecognizeResults.verify(message.transcript); + if (error) + return "transcript." + error; + } + return null; + }; + + /** + * Creates an InlineResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v2.InlineResult} InlineResult + */ + InlineResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v2.InlineResult) + return object; + var message = new $root.google.cloud.speech.v2.InlineResult(); + if (object.transcript != null) { + if (typeof object.transcript !== "object") + throw TypeError(".google.cloud.speech.v2.InlineResult.transcript: object expected"); + message.transcript = $root.google.cloud.speech.v2.BatchRecognizeResults.fromObject(object.transcript); + } + return message; + }; + + /** + * Creates a plain object from an InlineResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {google.cloud.speech.v2.InlineResult} message InlineResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InlineResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.transcript = null; + if (message.transcript != null && message.hasOwnProperty("transcript")) + object.transcript = $root.google.cloud.speech.v2.BatchRecognizeResults.toObject(message.transcript, options); + return object; + }; + + /** + * Converts this InlineResult to JSON. + * @function toJSON + * @memberof google.cloud.speech.v2.InlineResult + * @instance + * @returns {Object.} JSON object + */ + InlineResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InlineResult + * @function getTypeUrl + * @memberof google.cloud.speech.v2.InlineResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InlineResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.speech.v2.InlineResult"; + }; + + return InlineResult; + })(); + v2.BatchRecognizeFileResult = (function() { /** * Properties of a BatchRecognizeFileResult. * @memberof google.cloud.speech.v2 * @interface IBatchRecognizeFileResult - * @property {string|null} [uri] BatchRecognizeFileResult uri * @property {google.rpc.IStatus|null} [error] BatchRecognizeFileResult error * @property {google.cloud.speech.v2.IRecognitionResponseMetadata|null} [metadata] BatchRecognizeFileResult metadata + * @property {google.cloud.speech.v2.ICloudStorageResult|null} [cloudStorageResult] BatchRecognizeFileResult cloudStorageResult + * @property {google.cloud.speech.v2.IInlineResult|null} [inlineResult] BatchRecognizeFileResult inlineResult + * @property {string|null} [uri] BatchRecognizeFileResult uri * @property {google.cloud.speech.v2.IBatchRecognizeResults|null} [transcript] BatchRecognizeFileResult transcript */ @@ -33906,14 +35353,6 @@ this[keys[i]] = properties[keys[i]]; } - /** - * BatchRecognizeFileResult uri. - * @member {string} uri - * @memberof google.cloud.speech.v2.BatchRecognizeFileResult - * @instance - */ - BatchRecognizeFileResult.prototype.uri = ""; - /** * BatchRecognizeFileResult error. * @member {google.rpc.IStatus|null|undefined} error @@ -33930,6 +35369,30 @@ */ BatchRecognizeFileResult.prototype.metadata = null; + /** + * BatchRecognizeFileResult cloudStorageResult. + * @member {google.cloud.speech.v2.ICloudStorageResult|null|undefined} cloudStorageResult + * @memberof google.cloud.speech.v2.BatchRecognizeFileResult + * @instance + */ + BatchRecognizeFileResult.prototype.cloudStorageResult = null; + + /** + * BatchRecognizeFileResult inlineResult. + * @member {google.cloud.speech.v2.IInlineResult|null|undefined} inlineResult + * @memberof google.cloud.speech.v2.BatchRecognizeFileResult + * @instance + */ + BatchRecognizeFileResult.prototype.inlineResult = null; + + /** + * BatchRecognizeFileResult uri. + * @member {string} uri + * @memberof google.cloud.speech.v2.BatchRecognizeFileResult + * @instance + */ + BatchRecognizeFileResult.prototype.uri = ""; + /** * BatchRecognizeFileResult transcript. * @member {google.cloud.speech.v2.IBatchRecognizeResults|null|undefined} transcript @@ -33938,6 +35401,20 @@ */ BatchRecognizeFileResult.prototype.transcript = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchRecognizeFileResult result. + * @member {"cloudStorageResult"|"inlineResult"|undefined} result + * @memberof google.cloud.speech.v2.BatchRecognizeFileResult + * @instance + */ + Object.defineProperty(BatchRecognizeFileResult.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["cloudStorageResult", "inlineResult"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new BatchRecognizeFileResult instance using the specified properties. * @function create @@ -33970,6 +35447,10 @@ $root.google.cloud.speech.v2.RecognitionResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.transcript != null && Object.hasOwnProperty.call(message, "transcript")) $root.google.cloud.speech.v2.BatchRecognizeResults.encode(message.transcript, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.cloudStorageResult != null && Object.hasOwnProperty.call(message, "cloudStorageResult")) + $root.google.cloud.speech.v2.CloudStorageResult.encode(message.cloudStorageResult, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.inlineResult != null && Object.hasOwnProperty.call(message, "inlineResult")) + $root.google.cloud.speech.v2.InlineResult.encode(message.inlineResult, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -34004,10 +35485,6 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } case 2: { message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); break; @@ -34016,6 +35493,18 @@ message.metadata = $root.google.cloud.speech.v2.RecognitionResponseMetadata.decode(reader, reader.uint32()); break; } + case 5: { + message.cloudStorageResult = $root.google.cloud.speech.v2.CloudStorageResult.decode(reader, reader.uint32()); + break; + } + case 6: { + message.inlineResult = $root.google.cloud.speech.v2.InlineResult.decode(reader, reader.uint32()); + break; + } + case 1: { + message.uri = reader.string(); + break; + } case 4: { message.transcript = $root.google.cloud.speech.v2.BatchRecognizeResults.decode(reader, reader.uint32()); break; @@ -34055,9 +35544,7 @@ BatchRecognizeFileResult.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + var properties = {}; if (message.error != null && message.hasOwnProperty("error")) { var error = $root.google.rpc.Status.verify(message.error); if (error) @@ -34068,6 +35555,27 @@ if (error) return "metadata." + error; } + if (message.cloudStorageResult != null && message.hasOwnProperty("cloudStorageResult")) { + properties.result = 1; + { + var error = $root.google.cloud.speech.v2.CloudStorageResult.verify(message.cloudStorageResult); + if (error) + return "cloudStorageResult." + error; + } + } + if (message.inlineResult != null && message.hasOwnProperty("inlineResult")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.cloud.speech.v2.InlineResult.verify(message.inlineResult); + if (error) + return "inlineResult." + error; + } + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; if (message.transcript != null && message.hasOwnProperty("transcript")) { var error = $root.google.cloud.speech.v2.BatchRecognizeResults.verify(message.transcript); if (error) @@ -34088,8 +35596,6 @@ if (object instanceof $root.google.cloud.speech.v2.BatchRecognizeFileResult) return object; var message = new $root.google.cloud.speech.v2.BatchRecognizeFileResult(); - if (object.uri != null) - message.uri = String(object.uri); if (object.error != null) { if (typeof object.error !== "object") throw TypeError(".google.cloud.speech.v2.BatchRecognizeFileResult.error: object expected"); @@ -34100,6 +35606,18 @@ throw TypeError(".google.cloud.speech.v2.BatchRecognizeFileResult.metadata: object expected"); message.metadata = $root.google.cloud.speech.v2.RecognitionResponseMetadata.fromObject(object.metadata); } + if (object.cloudStorageResult != null) { + if (typeof object.cloudStorageResult !== "object") + throw TypeError(".google.cloud.speech.v2.BatchRecognizeFileResult.cloudStorageResult: object expected"); + message.cloudStorageResult = $root.google.cloud.speech.v2.CloudStorageResult.fromObject(object.cloudStorageResult); + } + if (object.inlineResult != null) { + if (typeof object.inlineResult !== "object") + throw TypeError(".google.cloud.speech.v2.BatchRecognizeFileResult.inlineResult: object expected"); + message.inlineResult = $root.google.cloud.speech.v2.InlineResult.fromObject(object.inlineResult); + } + if (object.uri != null) + message.uri = String(object.uri); if (object.transcript != null) { if (typeof object.transcript !== "object") throw TypeError(".google.cloud.speech.v2.BatchRecognizeFileResult.transcript: object expected"); @@ -34135,6 +35653,16 @@ object.metadata = $root.google.cloud.speech.v2.RecognitionResponseMetadata.toObject(message.metadata, options); if (message.transcript != null && message.hasOwnProperty("transcript")) object.transcript = $root.google.cloud.speech.v2.BatchRecognizeResults.toObject(message.transcript, options); + if (message.cloudStorageResult != null && message.hasOwnProperty("cloudStorageResult")) { + object.cloudStorageResult = $root.google.cloud.speech.v2.CloudStorageResult.toObject(message.cloudStorageResult, options); + if (options.oneofs) + object.result = "cloudStorageResult"; + } + if (message.inlineResult != null && message.hasOwnProperty("inlineResult")) { + object.inlineResult = $root.google.cloud.speech.v2.InlineResult.toObject(message.inlineResult, options); + if (options.oneofs) + object.result = "inlineResult"; + } return object; }; diff --git a/packages/google-cloud-speech/protos/protos.json b/packages/google-cloud-speech/protos/protos.json index e7161ac6873..6ede5b7e45f 100644 --- a/packages/google-cloud-speech/protos/protos.json +++ b/packages/google-cloud-speech/protos/protos.json @@ -239,6 +239,13 @@ "type": "SpeechAdaptation", "id": 20 }, + "transcriptNormalization": { + "type": "TranscriptNormalization", + "id": 24, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "speechContexts": { "rule": "repeated", "type": "SpeechContext", @@ -292,6 +299,7 @@ "AMR_WB": 5, "OGG_OPUS": 6, "SPEEX_WITH_HEADER_BYTE": 7, + "MP3": 8, "WEBM_OPUS": 9 } } @@ -645,6 +653,14 @@ "speakerTag": { "type": "int32", "id": 5, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "speakerLabel": { + "type": "string", + "id": 6, "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } @@ -766,6 +782,33 @@ } } }, + "TranscriptNormalization": { + "fields": { + "entries": { + "rule": "repeated", + "type": "Entry", + "id": 1 + } + }, + "nested": { + "Entry": { + "fields": { + "search": { + "type": "string", + "id": 1 + }, + "replace": { + "type": "string", + "id": 2 + }, + "caseSensitive": { + "type": "bool", + "id": 3 + } + } + } + } + }, "Adaptation": { "options": { "(google.api.default_host)": "speech.googleapis.com", @@ -3415,6 +3458,33 @@ } } }, + "TranscriptNormalization": { + "fields": { + "entries": { + "rule": "repeated", + "type": "Entry", + "id": 1 + } + }, + "nested": { + "Entry": { + "fields": { + "search": { + "type": "string", + "id": 1 + }, + "replace": { + "type": "string", + "id": 2 + }, + "caseSensitive": { + "type": "bool", + "id": 3 + } + } + } + } + }, "SpeechAdaptation": { "fields": { "phraseSets": { @@ -3494,6 +3564,13 @@ "adaptation": { "type": "SpeechAdaptation", "id": 6 + }, + "transcriptNormalization": { + "type": "TranscriptNormalization", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -3794,12 +3871,32 @@ } } }, - "BatchRecognizeFileResult": { + "CloudStorageResult": { "fields": { "uri": { "type": "string", "id": 1 - }, + } + } + }, + "InlineResult": { + "fields": { + "transcript": { + "type": "BatchRecognizeResults", + "id": 1 + } + } + }, + "BatchRecognizeFileResult": { + "oneofs": { + "result": { + "oneof": [ + "cloudStorageResult", + "inlineResult" + ] + } + }, + "fields": { "error": { "type": "google.rpc.Status", "id": 2 @@ -3808,9 +3905,27 @@ "type": "RecognitionResponseMetadata", "id": 3 }, + "cloudStorageResult": { + "type": "CloudStorageResult", + "id": 5 + }, + "inlineResult": { + "type": "InlineResult", + "id": 6 + }, + "uri": { + "type": "string", + "id": 1, + "options": { + "deprecated": true + } + }, "transcript": { "type": "BatchRecognizeResults", - "id": 4 + "id": 4, + "options": { + "deprecated": true + } } } },