Skip to content

Commit 76bed90

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add transcript normalization
Committer: @jameszhao PiperOrigin-RevId: 391603958
1 parent 5d0a689 commit 76bed90

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

google/cloud/speech/v1p1beta1/cloud_speech.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@ message RecognitionConfig {
327327
// documentation.
328328
SpeechAdaptation adaptation = 20;
329329

330+
// Use transcription normalization to automatically replace parts of the
331+
// transcript with phrases of your choosing. For StreamingRecognize, this
332+
// normalization only applies to stable partial transcripts (stability > 0.8)
333+
// and final transcripts.
334+
TranscriptNormalization transcript_normalization = 24;
335+
330336
// Array of [SpeechContext][google.cloud.speech.v1p1beta1.SpeechContext].
331337
// A means to provide context to assist the speech recognition. For more
332338
// information, see

google/cloud/speech/v1p1beta1/resource.proto

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ syntax = "proto3";
1717
package google.cloud.speech.v1p1beta1;
1818

1919
import "google/api/resource.proto";
20+
import "google/protobuf/timestamp.proto";
2021
import "google/api/annotations.proto";
2122

2223
option cc_enable_arenas = true;
@@ -132,3 +133,27 @@ message SpeechAdaptation {
132133
// `custom_class_id`.
133134
repeated CustomClass custom_classes = 3;
134135
}
136+
137+
// Transcription normalization configuration. Use transcription normalization
138+
// to automatically replace parts of the transcript with phrases of your
139+
// choosing. For StreamingRecognize, this normalization only applies to stable
140+
// partial transcripts (stability > 0.8) and final transcripts.
141+
message TranscriptNormalization {
142+
// A single replacement configuration.
143+
message Entry {
144+
// What to replace. Max length is 100 characters.
145+
string search = 1;
146+
147+
// What to replace with. Max length is 100 characters.
148+
string replace = 2;
149+
150+
// Whether the search is case sensitive.
151+
bool case_sensitive = 3;
152+
}
153+
154+
// A list of replacement entries. We will perform replacement with one entry
155+
// at a time. For example, the second entry in ["cat" => "dog", "mountain cat"
156+
// => "mountain dog"] will never be applied because we will always process the
157+
// first entry before it. At most 100 entries.
158+
repeated Entry entries = 1;
159+
}

0 commit comments

Comments
 (0)