Package speech
Overview ▹
Index ▹
Variables
var RecognitionConfig_AudioEncoding_name = map[int32]string{ 0: "ENCODING_UNSPECIFIED", 1: "LINEAR16", 2: "FLAC", 3: "MULAW", 4: "AMR", 5: "AMR_WB", }
var RecognitionConfig_AudioEncoding_value = map[string]int32{ "ENCODING_UNSPECIFIED": 0, "LINEAR16": 1, "FLAC": 2, "MULAW": 3, "AMR": 4, "AMR_WB": 5, }
var StreamingRecognizeResponse_EndpointerType_name = map[int32]string{ 0: "ENDPOINTER_EVENT_UNSPECIFIED", 1: "START_OF_SPEECH", 2: "END_OF_SPEECH", 3: "END_OF_AUDIO", 4: "END_OF_UTTERANCE", }
var StreamingRecognizeResponse_EndpointerType_value = map[string]int32{ "ENDPOINTER_EVENT_UNSPECIFIED": 0, "START_OF_SPEECH": 1, "END_OF_SPEECH": 2, "END_OF_AUDIO": 3, "END_OF_UTTERANCE": 4, }
func RegisterSpeechServer ¶
func RegisterSpeechServer(s *grpc.Server, srv SpeechServer)
type AsyncRecognizeMetadata ¶
Describes the progress of a long-running `AsyncRecognize` call. It is included in the `metadata` field of the `Operation` returned by the `GetOperation` call of the `google::longrunning::Operations` service.
type AsyncRecognizeMetadata struct { // Approximate percentage of audio processed thus far. Guaranteed to be 100 // when the audio is fully processed and the results are available. ProgressPercent int32 `protobuf:"varint,1,opt,name=progress_percent,json=progressPercent" json:"progress_percent,omitempty"` // Time when the request was received. StartTime *google_protobuf4.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"` // Time of the most recent processing update. LastUpdateTime *google_protobuf4.Timestamp `protobuf:"bytes,3,opt,name=last_update_time,json=lastUpdateTime" json:"last_update_time,omitempty"` }
func (*AsyncRecognizeMetadata) Descriptor ¶
func (*AsyncRecognizeMetadata) Descriptor() ([]byte, []int)
func (*AsyncRecognizeMetadata) GetLastUpdateTime ¶
func (m *AsyncRecognizeMetadata) GetLastUpdateTime() *google_protobuf4.Timestamp
func (*AsyncRecognizeMetadata) GetProgressPercent ¶
func (m *AsyncRecognizeMetadata) GetProgressPercent() int32
func (*AsyncRecognizeMetadata) GetStartTime ¶
func (m *AsyncRecognizeMetadata) GetStartTime() *google_protobuf4.Timestamp
func (*AsyncRecognizeMetadata) ProtoMessage ¶
func (*AsyncRecognizeMetadata) ProtoMessage()
func (*AsyncRecognizeMetadata) Reset ¶
func (m *AsyncRecognizeMetadata) Reset()
func (*AsyncRecognizeMetadata) String ¶
func (m *AsyncRecognizeMetadata) String() string
type AsyncRecognizeRequest ¶
The top-level message sent by the client for the `AsyncRecognize` method.
type AsyncRecognizeRequest struct { // *Required* Provides information to the recognizer that specifies how to // process the request. Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` // *Required* The audio data to be recognized. Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio" json:"audio,omitempty"` }
func (*AsyncRecognizeRequest) Descriptor ¶
func (*AsyncRecognizeRequest) Descriptor() ([]byte, []int)
func (*AsyncRecognizeRequest) GetAudio ¶
func (m *AsyncRecognizeRequest) GetAudio() *RecognitionAudio
func (*AsyncRecognizeRequest) GetConfig ¶
func (m *AsyncRecognizeRequest) GetConfig() *RecognitionConfig
func (*AsyncRecognizeRequest) ProtoMessage ¶
func (*AsyncRecognizeRequest) ProtoMessage()
func (*AsyncRecognizeRequest) Reset ¶
func (m *AsyncRecognizeRequest) Reset()
func (*AsyncRecognizeRequest) String ¶
func (m *AsyncRecognizeRequest) String() string
type AsyncRecognizeResponse ¶
The only message returned to the client by `AsyncRecognize`. It contains the result as zero or more sequential `SpeechRecognitionResult` messages. It is included in the `result.response` field of the `Operation` returned by the `GetOperation` call of the `google::longrunning::Operations` service.
type AsyncRecognizeResponse struct { // *Output-only* Sequential list of transcription results corresponding to // sequential portions of audio. Results []*SpeechRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` }
func (*AsyncRecognizeResponse) Descriptor ¶
func (*AsyncRecognizeResponse) Descriptor() ([]byte, []int)
func (*AsyncRecognizeResponse) GetResults ¶
func (m *AsyncRecognizeResponse) GetResults() []*SpeechRecognitionResult
func (*AsyncRecognizeResponse) ProtoMessage ¶
func (*AsyncRecognizeResponse) ProtoMessage()
func (*AsyncRecognizeResponse) Reset ¶
func (m *AsyncRecognizeResponse) Reset()
func (*AsyncRecognizeResponse) String ¶
func (m *AsyncRecognizeResponse) String() string
type RecognitionAudio ¶
Contains audio data in the encoding specified in the `RecognitionConfig`. Either `content` or `uri` must be supplied. Supplying both or neither returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See [audio limits](https://cloud.google.com/speech/limits#content).
type RecognitionAudio struct { // Types that are valid to be assigned to AudioSource: // *RecognitionAudio_Content // *RecognitionAudio_Uri AudioSource isRecognitionAudio_AudioSource `protobuf_oneof:"audio_source"` }
func (*RecognitionAudio) Descriptor ¶
func (*RecognitionAudio) Descriptor() ([]byte, []int)
func (*RecognitionAudio) GetAudioSource ¶
func (m *RecognitionAudio) GetAudioSource() isRecognitionAudio_AudioSource
func (*RecognitionAudio) GetContent ¶
func (m *RecognitionAudio) GetContent() []byte
func (*RecognitionAudio) GetUri ¶
func (m *RecognitionAudio) GetUri() string
func (*RecognitionAudio) ProtoMessage ¶
func (*RecognitionAudio) ProtoMessage()
func (*RecognitionAudio) Reset ¶
func (m *RecognitionAudio) Reset()
func (*RecognitionAudio) String ¶
func (m *RecognitionAudio) String() string
func (*RecognitionAudio) XXX_OneofFuncs ¶
func (*RecognitionAudio) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type RecognitionAudio_Content ¶
type RecognitionAudio_Content struct { Content []byte `protobuf:"bytes,1,opt,name=content,proto3,oneof"` }
type RecognitionAudio_Uri ¶
type RecognitionAudio_Uri struct { Uri string `protobuf:"bytes,2,opt,name=uri,oneof"` }
type RecognitionConfig ¶
Provides information to the recognizer that specifies how to process the request.
type RecognitionConfig struct { // *Required* Encoding of audio data sent in all `RecognitionAudio` messages. Encoding RecognitionConfig_AudioEncoding `protobuf:"varint,1,opt,name=encoding,enum=google.cloud.speech.v1beta1.RecognitionConfig_AudioEncoding" json:"encoding,omitempty"` // *Required* Sample rate in Hertz of the audio data sent in all // `RecognitionAudio` messages. Valid values are: 8000-48000. // 16000 is optimal. For best results, set the sampling rate of the audio // source to 16000 Hz. If that's not possible, use the native sample rate of // the audio source (instead of re-sampling). SampleRate int32 `protobuf:"varint,2,opt,name=sample_rate,json=sampleRate" json:"sample_rate,omitempty"` // *Optional* The language of the supplied audio as a BCP-47 language tag. // Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt // If omitted, defaults to "en-US". See // [Language Support](https://cloud.google.com/speech/docs/languages) // for a list of the currently supported language codes. LanguageCode string `protobuf:"bytes,3,opt,name=language_code,json=languageCode" json:"language_code,omitempty"` // *Optional* Maximum number of recognition hypotheses to be returned. // Specifically, the maximum number of `SpeechRecognitionAlternative` messages // within each `SpeechRecognitionResult`. // The server may return fewer than `max_alternatives`. // Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of // one. If omitted, will return a maximum of one. MaxAlternatives int32 `protobuf:"varint,4,opt,name=max_alternatives,json=maxAlternatives" json:"max_alternatives,omitempty"` // *Optional* If set to `true`, the server will attempt to filter out // profanities, replacing all but the initial character in each filtered word // with asterisks, e.g. "f***". If set to `false` or omitted, profanities // won't be filtered out. ProfanityFilter bool `protobuf:"varint,5,opt,name=profanity_filter,json=profanityFilter" json:"profanity_filter,omitempty"` // *Optional* A means to provide context to assist the speech recognition. SpeechContext *SpeechContext `protobuf:"bytes,6,opt,name=speech_context,json=speechContext" json:"speech_context,omitempty"` }
func (*RecognitionConfig) Descriptor ¶
func (*RecognitionConfig) Descriptor() ([]byte, []int)
func (*RecognitionConfig) GetEncoding ¶
func (m *RecognitionConfig) GetEncoding() RecognitionConfig_AudioEncoding
func (*RecognitionConfig) GetLanguageCode ¶
func (m *RecognitionConfig) GetLanguageCode() string
func (*RecognitionConfig) GetMaxAlternatives ¶
func (m *RecognitionConfig) GetMaxAlternatives() int32
func (*RecognitionConfig) GetProfanityFilter ¶
func (m *RecognitionConfig) GetProfanityFilter() bool
func (*RecognitionConfig) GetSampleRate ¶
func (m *RecognitionConfig) GetSampleRate() int32
func (*RecognitionConfig) GetSpeechContext ¶
func (m *RecognitionConfig) GetSpeechContext() *SpeechContext
func (*RecognitionConfig) ProtoMessage ¶
func (*RecognitionConfig) ProtoMessage()
func (*RecognitionConfig) Reset ¶
func (m *RecognitionConfig) Reset()
func (*RecognitionConfig) String ¶
func (m *RecognitionConfig) String() string
type RecognitionConfig_AudioEncoding ¶
Audio encoding of the data sent in the audio message. All encodings support only 1 channel (mono) audio. Only `FLAC` includes a header that describes the bytes of audio that follow the header. The other encodings are raw audio bytes with no header.
For best results, the audio source should be captured and transmitted using a lossless encoding (`FLAC` or `LINEAR16`). Recognition accuracy may be reduced if lossy codecs (such as AMR, AMR_WB and MULAW) are used to capture or transmit the audio, particularly if background noise is present.
type RecognitionConfig_AudioEncoding int32
const ( // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. RecognitionConfig_ENCODING_UNSPECIFIED RecognitionConfig_AudioEncoding = 0 // Uncompressed 16-bit signed little-endian samples (Linear PCM). // This is the only encoding that may be used by `AsyncRecognize`. RecognitionConfig_LINEAR16 RecognitionConfig_AudioEncoding = 1 // This is the recommended encoding for `SyncRecognize` and // `StreamingRecognize` because it uses lossless compression; therefore // recognition accuracy is not compromised by a lossy codec. // // The stream FLAC (Free Lossless Audio Codec) encoding is specified at: // http://flac.sourceforge.net/documentation.html. // 16-bit and 24-bit samples are supported. // Not all fields in STREAMINFO are supported. RecognitionConfig_FLAC RecognitionConfig_AudioEncoding = 2 // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. RecognitionConfig_MULAW RecognitionConfig_AudioEncoding = 3 // Adaptive Multi-Rate Narrowband codec. `sample_rate` must be 8000 Hz. RecognitionConfig_AMR RecognitionConfig_AudioEncoding = 4 // Adaptive Multi-Rate Wideband codec. `sample_rate` must be 16000 Hz. RecognitionConfig_AMR_WB RecognitionConfig_AudioEncoding = 5 )
func (RecognitionConfig_AudioEncoding) EnumDescriptor ¶
func (RecognitionConfig_AudioEncoding) EnumDescriptor() ([]byte, []int)
func (RecognitionConfig_AudioEncoding) String ¶
func (x RecognitionConfig_AudioEncoding) String() string
type SpeechClient ¶
type SpeechClient interface { // Performs synchronous speech recognition: receive results after all audio // has been sent and processed. SyncRecognize(ctx context.Context, in *SyncRecognizeRequest, opts ...grpc.CallOption) (*SyncRecognizeResponse, error) // Performs asynchronous speech recognition: receive results via the // [google.longrunning.Operations] // (/speech/reference/rest/v1beta1/operations#Operation) // interface. Returns either an // `Operation.error` or an `Operation.response` which contains // an `AsyncRecognizeResponse` message. AsyncRecognize(ctx context.Context, in *AsyncRecognizeRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) // Performs bidirectional streaming speech recognition: receive results while // sending audio. This method is only available via the gRPC API (not REST). StreamingRecognize(ctx context.Context, opts ...grpc.CallOption) (Speech_StreamingRecognizeClient, error) }
func NewSpeechClient ¶
func NewSpeechClient(cc *grpc.ClientConn) SpeechClient
type SpeechContext ¶
Provides "hints" to the speech recognizer to favor specific words and phrases in the results.
type SpeechContext struct { // *Optional* A list of strings containing words and phrases "hints" so that // the speech recognition is more likely to recognize them. This can be used // to improve the accuracy for specific words and phrases, for example, if // specific commands are typically spoken by the user. This can also be used // to add additional words to the vocabulary of the recognizer. See // [usage limits](https://cloud.google.com/speech/limits#content). Phrases []string `protobuf:"bytes,1,rep,name=phrases" json:"phrases,omitempty"` }
func (*SpeechContext) Descriptor ¶
func (*SpeechContext) Descriptor() ([]byte, []int)
func (*SpeechContext) GetPhrases ¶
func (m *SpeechContext) GetPhrases() []string
func (*SpeechContext) ProtoMessage ¶
func (*SpeechContext) ProtoMessage()
func (*SpeechContext) Reset ¶
func (m *SpeechContext) Reset()
func (*SpeechContext) String ¶
func (m *SpeechContext) String() string
type SpeechRecognitionAlternative ¶
Alternative hypotheses (a.k.a. n-best list).
type SpeechRecognitionAlternative struct { // *Output-only* Transcript text representing the words that the user spoke. Transcript string `protobuf:"bytes,1,opt,name=transcript" json:"transcript,omitempty"` // *Output-only* The confidence estimate between 0.0 and 1.0. A higher number // indicates an estimated greater likelihood that the recognized words are // correct. This field is typically provided only for the top hypothesis, and // only for `is_final=true` results. Clients should not rely on the // `confidence` field as it is not guaranteed to be accurate, or even set, in // any of the results. // The default of 0.0 is a sentinel value indicating `confidence` was not set. Confidence float32 `protobuf:"fixed32,2,opt,name=confidence" json:"confidence,omitempty"` }
func (*SpeechRecognitionAlternative) Descriptor ¶
func (*SpeechRecognitionAlternative) Descriptor() ([]byte, []int)
func (*SpeechRecognitionAlternative) GetConfidence ¶
func (m *SpeechRecognitionAlternative) GetConfidence() float32
func (*SpeechRecognitionAlternative) GetTranscript ¶
func (m *SpeechRecognitionAlternative) GetTranscript() string
func (*SpeechRecognitionAlternative) ProtoMessage ¶
func (*SpeechRecognitionAlternative) ProtoMessage()
func (*SpeechRecognitionAlternative) Reset ¶
func (m *SpeechRecognitionAlternative) Reset()
func (*SpeechRecognitionAlternative) String ¶
func (m *SpeechRecognitionAlternative) String() string
type SpeechRecognitionResult ¶
A speech recognition result corresponding to a portion of the audio.
type SpeechRecognitionResult struct { // *Output-only* May contain one or more recognition hypotheses (up to the // maximum specified in `max_alternatives`). Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives" json:"alternatives,omitempty"` }
func (*SpeechRecognitionResult) Descriptor ¶
func (*SpeechRecognitionResult) Descriptor() ([]byte, []int)
func (*SpeechRecognitionResult) GetAlternatives ¶
func (m *SpeechRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternative
func (*SpeechRecognitionResult) ProtoMessage ¶
func (*SpeechRecognitionResult) ProtoMessage()
func (*SpeechRecognitionResult) Reset ¶
func (m *SpeechRecognitionResult) Reset()
func (*SpeechRecognitionResult) String ¶
func (m *SpeechRecognitionResult) String() string
type SpeechServer ¶
type SpeechServer interface { // Performs synchronous speech recognition: receive results after all audio // has been sent and processed. SyncRecognize(context.Context, *SyncRecognizeRequest) (*SyncRecognizeResponse, error) // Performs asynchronous speech recognition: receive results via the // [google.longrunning.Operations] // (/speech/reference/rest/v1beta1/operations#Operation) // interface. Returns either an // `Operation.error` or an `Operation.response` which contains // an `AsyncRecognizeResponse` message. AsyncRecognize(context.Context, *AsyncRecognizeRequest) (*google_longrunning.Operation, error) // Performs bidirectional streaming speech recognition: receive results while // sending audio. This method is only available via the gRPC API (not REST). StreamingRecognize(Speech_StreamingRecognizeServer) error }
type Speech_StreamingRecognizeClient ¶
type Speech_StreamingRecognizeClient interface { Send(*StreamingRecognizeRequest) error Recv() (*StreamingRecognizeResponse, error) grpc.ClientStream }
type Speech_StreamingRecognizeServer ¶
type Speech_StreamingRecognizeServer interface { Send(*StreamingRecognizeResponse) error Recv() (*StreamingRecognizeRequest, error) grpc.ServerStream }
type StreamingRecognitionConfig ¶
Provides information to the recognizer that specifies how to process the request.
type StreamingRecognitionConfig struct { // *Required* Provides information to the recognizer that specifies how to // process the request. Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` // *Optional* If `false` or omitted, the recognizer will perform continuous // recognition (continuing to wait for and process audio even if the user // pauses speaking) until the client closes the input stream (gRPC API) or // until the maximum time limit has been reached. May return multiple // `StreamingRecognitionResult`s with the `is_final` flag set to `true`. // // If `true`, the recognizer will detect a single spoken utterance. When it // detects that the user has paused or stopped speaking, it will return an // `END_OF_UTTERANCE` event and cease recognition. It will return no more than // one `StreamingRecognitionResult` with the `is_final` flag set to `true`. SingleUtterance bool `protobuf:"varint,2,opt,name=single_utterance,json=singleUtterance" json:"single_utterance,omitempty"` // *Optional* If `true`, interim results (tentative hypotheses) may be // returned as they become available (these interim results are indicated with // the `is_final=false` flag). // If `false` or omitted, only `is_final=true` result(s) are returned. InterimResults bool `protobuf:"varint,3,opt,name=interim_results,json=interimResults" json:"interim_results,omitempty"` }
func (*StreamingRecognitionConfig) Descriptor ¶
func (*StreamingRecognitionConfig) Descriptor() ([]byte, []int)
func (*StreamingRecognitionConfig) GetConfig ¶
func (m *StreamingRecognitionConfig) GetConfig() *RecognitionConfig
func (*StreamingRecognitionConfig) GetInterimResults ¶
func (m *StreamingRecognitionConfig) GetInterimResults() bool
func (*StreamingRecognitionConfig) GetSingleUtterance ¶
func (m *StreamingRecognitionConfig) GetSingleUtterance() bool
func (*StreamingRecognitionConfig) ProtoMessage ¶
func (*StreamingRecognitionConfig) ProtoMessage()
func (*StreamingRecognitionConfig) Reset ¶
func (m *StreamingRecognitionConfig) Reset()
func (*StreamingRecognitionConfig) String ¶
func (m *StreamingRecognitionConfig) String() string
type StreamingRecognitionResult ¶
A streaming speech recognition result corresponding to a portion of the audio that is currently being processed.
type StreamingRecognitionResult struct { // *Output-only* May contain one or more recognition hypotheses (up to the // maximum specified in `max_alternatives`). Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives" json:"alternatives,omitempty"` // *Output-only* If `false`, this `StreamingRecognitionResult` represents an // interim result that may change. If `true`, this is the final time the // speech service will return this particular `StreamingRecognitionResult`, // the recognizer will not return any further hypotheses for this portion of // the transcript and corresponding audio. IsFinal bool `protobuf:"varint,2,opt,name=is_final,json=isFinal" json:"is_final,omitempty"` // *Output-only* An estimate of the likelihood that the recognizer will not // change its guess about this interim result. Values range from 0.0 // (completely unstable) to 1.0 (completely stable). // This field is only provided for interim results (`is_final=false`). // The default of 0.0 is a sentinel value indicating `stability` was not set. Stability float32 `protobuf:"fixed32,3,opt,name=stability" json:"stability,omitempty"` }
func (*StreamingRecognitionResult) Descriptor ¶
func (*StreamingRecognitionResult) Descriptor() ([]byte, []int)
func (*StreamingRecognitionResult) GetAlternatives ¶
func (m *StreamingRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternative
func (*StreamingRecognitionResult) GetIsFinal ¶
func (m *StreamingRecognitionResult) GetIsFinal() bool
func (*StreamingRecognitionResult) GetStability ¶
func (m *StreamingRecognitionResult) GetStability() float32
func (*StreamingRecognitionResult) ProtoMessage ¶
func (*StreamingRecognitionResult) ProtoMessage()
func (*StreamingRecognitionResult) Reset ¶
func (m *StreamingRecognitionResult) Reset()
func (*StreamingRecognitionResult) String ¶
func (m *StreamingRecognitionResult) String() string
type StreamingRecognizeRequest ¶
The top-level message sent by the client for the `StreamingRecognize` method. Multiple `StreamingRecognizeRequest` messages are sent. The first message must contain a `streaming_config` message and must not contain `audio` data. All subsequent messages must contain `audio` data and must not contain a `streaming_config` message.
type StreamingRecognizeRequest struct { // Types that are valid to be assigned to StreamingRequest: // *StreamingRecognizeRequest_StreamingConfig // *StreamingRecognizeRequest_AudioContent StreamingRequest isStreamingRecognizeRequest_StreamingRequest `protobuf_oneof:"streaming_request"` }
func (*StreamingRecognizeRequest) Descriptor ¶
func (*StreamingRecognizeRequest) Descriptor() ([]byte, []int)
func (*StreamingRecognizeRequest) GetAudioContent ¶
func (m *StreamingRecognizeRequest) GetAudioContent() []byte
func (*StreamingRecognizeRequest) GetStreamingConfig ¶
func (m *StreamingRecognizeRequest) GetStreamingConfig() *StreamingRecognitionConfig
func (*StreamingRecognizeRequest) GetStreamingRequest ¶
func (m *StreamingRecognizeRequest) GetStreamingRequest() isStreamingRecognizeRequest_StreamingRequest
func (*StreamingRecognizeRequest) ProtoMessage ¶
func (*StreamingRecognizeRequest) ProtoMessage()
func (*StreamingRecognizeRequest) Reset ¶
func (m *StreamingRecognizeRequest) Reset()
func (*StreamingRecognizeRequest) String ¶
func (m *StreamingRecognizeRequest) String() string
func (*StreamingRecognizeRequest) XXX_OneofFuncs ¶
func (*StreamingRecognizeRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type StreamingRecognizeRequest_AudioContent ¶
type StreamingRecognizeRequest_AudioContent struct { AudioContent []byte `protobuf:"bytes,2,opt,name=audio_content,json=audioContent,proto3,oneof"` }
type StreamingRecognizeRequest_StreamingConfig ¶
type StreamingRecognizeRequest_StreamingConfig struct { StreamingConfig *StreamingRecognitionConfig `protobuf:"bytes,1,opt,name=streaming_config,json=streamingConfig,oneof"` }
type StreamingRecognizeResponse ¶
`StreamingRecognizeResponse` is the only message returned to the client by `StreamingRecognize`. A series of one or more `StreamingRecognizeResponse` messages are streamed back to the client.
Here's an example of a series of ten `StreamingRecognizeResponse`s that might be returned while processing audio:
1. endpointer_type: START_OF_SPEECH
2. results { alternatives { transcript: "tube" } stability: 0.01 }
result_index: 0
3. results { alternatives { transcript: "to be a" } stability: 0.01 }
result_index: 0
4. results { alternatives { transcript: "to be" } stability: 0.9 }
results { alternatives { transcript: " or not to be" } stability: 0.01 } result_index: 0
5. results { alternatives { transcript: "to be or not to be"
confidence: 0.92 } alternatives { transcript: "to bee or not to bee" } is_final: true } result_index: 0
6. results { alternatives { transcript: " that's" } stability: 0.01 }
result_index: 1
7. results { alternatives { transcript: " that is" } stability: 0.9 }
results { alternatives { transcript: " the question" } stability: 0.01 } result_index: 1
8. endpointer_type: END_OF_SPEECH
9. results { alternatives { transcript: " that is the question"
confidence: 0.98 } alternatives { transcript: " that was the question" } is_final: true } result_index: 1
10. endpointer_type: END_OF_AUDIO
Notes:
- Only two of the above responses #5 and #9 contain final results, they are
indicated by `is_final: true`. Concatenating these together generates the full transcript: "to be or not to be that is the question".
- The others contain interim `results`. #4 and #7 contain two interim
`results`, the first portion has a high stability and is less likely to change, the second portion has a low stability and is very likely to change. A UI designer might choose to show only high stability `results`.
- The specific `stability` and `confidence` values shown above are only for
illustrative purposes. Actual values may vary.
- The `result_index` indicates the portion of audio that has had final
results returned, and is no longer being processed. For example, the `results` in #6 and later correspond to the portion of audio after "to be or not to be".
type StreamingRecognizeResponse struct { // *Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that // specifies the error for the operation. Error *google_rpc.Status `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` // *Output-only* This repeated list contains zero or more results that // correspond to consecutive portions of the audio currently being processed. // It contains zero or one `is_final=true` result (the newly settled portion), // followed by zero or more `is_final=false` results. Results []*StreamingRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` // *Output-only* Indicates the lowest index in the `results` array that has // changed. The repeated `StreamingRecognitionResult` results overwrite past // results at this index and higher. ResultIndex int32 `protobuf:"varint,3,opt,name=result_index,json=resultIndex" json:"result_index,omitempty"` // *Output-only* Indicates the type of endpointer event. EndpointerType StreamingRecognizeResponse_EndpointerType `protobuf:"varint,4,opt,name=endpointer_type,json=endpointerType,enum=google.cloud.speech.v1beta1.StreamingRecognizeResponse_EndpointerType" json:"endpointer_type,omitempty"` }
func (*StreamingRecognizeResponse) Descriptor ¶
func (*StreamingRecognizeResponse) Descriptor() ([]byte, []int)
func (*StreamingRecognizeResponse) GetEndpointerType ¶
func (m *StreamingRecognizeResponse) GetEndpointerType() StreamingRecognizeResponse_EndpointerType
func (*StreamingRecognizeResponse) GetError ¶
func (m *StreamingRecognizeResponse) GetError() *google_rpc.Status
func (*StreamingRecognizeResponse) GetResultIndex ¶
func (m *StreamingRecognizeResponse) GetResultIndex() int32
func (*StreamingRecognizeResponse) GetResults ¶
func (m *StreamingRecognizeResponse) GetResults() []*StreamingRecognitionResult
func (*StreamingRecognizeResponse) ProtoMessage ¶
func (*StreamingRecognizeResponse) ProtoMessage()
func (*StreamingRecognizeResponse) Reset ¶
func (m *StreamingRecognizeResponse) Reset()
func (*StreamingRecognizeResponse) String ¶
func (m *StreamingRecognizeResponse) String() string
type StreamingRecognizeResponse_EndpointerType ¶
Indicates the type of endpointer event.
type StreamingRecognizeResponse_EndpointerType int32
const ( // No endpointer event specified. StreamingRecognizeResponse_ENDPOINTER_EVENT_UNSPECIFIED StreamingRecognizeResponse_EndpointerType = 0 // Speech has been detected in the audio stream, and the service is // beginning to process it. StreamingRecognizeResponse_START_OF_SPEECH StreamingRecognizeResponse_EndpointerType = 1 // Speech has ceased to be detected in the audio stream. (For example, the // user may have paused after speaking.) If `single_utterance` is `false`, // the service will continue to process audio, and if subsequent speech is // detected, will send another START_OF_SPEECH event. StreamingRecognizeResponse_END_OF_SPEECH StreamingRecognizeResponse_EndpointerType = 2 // This event is sent after the client has half-closed the input stream gRPC // connection and the server has received all of the audio. (The server may // still be processing the audio and may subsequently return additional // results.) StreamingRecognizeResponse_END_OF_AUDIO StreamingRecognizeResponse_EndpointerType = 3 // This event is only sent when `single_utterance` is `true`. It indicates // that the server has detected the end of the user's speech utterance and // expects no additional speech. Therefore, the server will not process // additional audio (although it may subsequently return additional // results). The client should stop sending additional audio data, // half-close the gRPC connection, and wait for any additional results // until the server closes the gRPC connection. StreamingRecognizeResponse_END_OF_UTTERANCE StreamingRecognizeResponse_EndpointerType = 4 )
func (StreamingRecognizeResponse_EndpointerType) EnumDescriptor ¶
func (StreamingRecognizeResponse_EndpointerType) EnumDescriptor() ([]byte, []int)
func (StreamingRecognizeResponse_EndpointerType) String ¶
func (x StreamingRecognizeResponse_EndpointerType) String() string
type SyncRecognizeRequest ¶
The top-level message sent by the client for the `SyncRecognize` method.
type SyncRecognizeRequest struct { // *Required* Provides information to the recognizer that specifies how to // process the request. Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"` // *Required* The audio data to be recognized. Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio" json:"audio,omitempty"` }
func (*SyncRecognizeRequest) Descriptor ¶
func (*SyncRecognizeRequest) Descriptor() ([]byte, []int)
func (*SyncRecognizeRequest) GetAudio ¶
func (m *SyncRecognizeRequest) GetAudio() *RecognitionAudio
func (*SyncRecognizeRequest) GetConfig ¶
func (m *SyncRecognizeRequest) GetConfig() *RecognitionConfig
func (*SyncRecognizeRequest) ProtoMessage ¶
func (*SyncRecognizeRequest) ProtoMessage()
func (*SyncRecognizeRequest) Reset ¶
func (m *SyncRecognizeRequest) Reset()
func (*SyncRecognizeRequest) String ¶
func (m *SyncRecognizeRequest) String() string
type SyncRecognizeResponse ¶
The only message returned to the client by `SyncRecognize`. It contains the result as zero or more sequential `SpeechRecognitionResult` messages.
type SyncRecognizeResponse struct { // *Output-only* Sequential list of transcription results corresponding to // sequential portions of audio. Results []*SpeechRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` }
func (*SyncRecognizeResponse) Descriptor ¶
func (*SyncRecognizeResponse) Descriptor() ([]byte, []int)
func (*SyncRecognizeResponse) GetResults ¶
func (m *SyncRecognizeResponse) GetResults() []*SpeechRecognitionResult
func (*SyncRecognizeResponse) ProtoMessage ¶
func (*SyncRecognizeResponse) ProtoMessage()
func (*SyncRecognizeResponse) Reset ¶
func (m *SyncRecognizeResponse) Reset()
func (*SyncRecognizeResponse) String ¶
func (m *SyncRecognizeResponse) String() string