asr

package
v0.0.0-...-8073c34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RecognitionConfig_AudioEncoding_name = map[int32]string{
		0:   "ENCODING_UNSPECIFIED",
		1:   "LINEAR16",
		2:   "FLAC",
		6:   "OGG_OPUS",
		7:   "OPUS_WITH_HEADER",
		100: "SOGOU_SPEEX",
	}
	RecognitionConfig_AudioEncoding_value = map[string]int32{
		"ENCODING_UNSPECIFIED": 0,
		"LINEAR16":             1,
		"FLAC":                 2,
		"OGG_OPUS":             6,
		"OPUS_WITH_HEADER":     7,
		"SOGOU_SPEEX":          100,
	}
)

Enum value maps for RecognitionConfig_AudioEncoding.

View Source
var (
	RecognitionMetadata_MicrophoneDistance_name = map[int32]string{
		0:   "MICROPHONE_DISTANCE_UNSPECIFIED",
		100: "NEARFIELD",
		300: "MIDFIELD",
		500: "FARFIELD",
	}
	RecognitionMetadata_MicrophoneDistance_value = map[string]int32{
		"MICROPHONE_DISTANCE_UNSPECIFIED": 0,
		"NEARFIELD":                       100,
		"MIDFIELD":                        300,
		"FARFIELD":                        500,
	}
)

Enum value maps for RecognitionMetadata_MicrophoneDistance.

View Source
var (
	StreamingRecognizeResponse_SpeechEventType_name = map[int32]string{
		0: "SPEECH_EVENT_UNSPECIFIED",
		1: "END_OF_SINGLE_UTTERANCE",
	}
	StreamingRecognizeResponse_SpeechEventType_value = map[string]int32{
		"SPEECH_EVENT_UNSPECIFIED": 0,
		"END_OF_SINGLE_UTTERANCE":  1,
	}
)

Enum value maps for StreamingRecognizeResponse_SpeechEventType.

View Source
var Asr_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "sogou.speech.asr.v1.asr",
	HandlerType: (*AsrServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Recognize",
			Handler:    _Asr_Recognize_Handler,
		},
		{
			MethodName: "LongRunningRecognize",
			Handler:    _Asr_LongRunningRecognize_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamingRecognize",
			Handler:       _Asr_StreamingRecognize_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "sogou/speech/asr/v1/asr.proto",
}

Asr_ServiceDesc is the grpc.ServiceDesc for Asr service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_sogou_speech_asr_v1_asr_proto protoreflect.FileDescriptor

Functions

func RegisterAsrServer

func RegisterAsrServer(s grpc.ServiceRegistrar, srv AsrServer)

Types

type AsrClient

type AsrClient interface {
	// Performs synchronous speech recognition: receive results after all audio
	// has been sent and processed.
	Recognize(ctx context.Context, in *RecognizeRequest, opts ...grpc.CallOption) (*RecognizeResponse, error)
	// Performs asynchronous speech recognition: receive results via sogou.speech.longrunning.GetOperation interface
	LongRunningRecognize(ctx context.Context, in *LongRunningRecognizeRequest, opts ...grpc.CallOption) (*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) (Asr_StreamingRecognizeClient, error)
}

AsrClient is the client API for Asr service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewAsrClient

func NewAsrClient(cc grpc.ClientConnInterface) AsrClient

type AsrServer

type AsrServer interface {
	// Performs synchronous speech recognition: receive results after all audio
	// has been sent and processed.
	Recognize(context.Context, *RecognizeRequest) (*RecognizeResponse, error)
	// Performs asynchronous speech recognition: receive results via sogou.speech.longrunning.GetOperation interface
	LongRunningRecognize(context.Context, *LongRunningRecognizeRequest) (*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(Asr_StreamingRecognizeServer) error
	// contains filtered or unexported methods
}

AsrServer is the server API for Asr service. All implementations must embed UnimplementedAsrServer for forward compatibility

type Asr_StreamingRecognizeClient

type Asr_StreamingRecognizeClient interface {
	Send(*StreamingRecognizeRequest) error
	Recv() (*StreamingRecognizeResponse, error)
	grpc.ClientStream
}

type Asr_StreamingRecognizeServer

type Asr_StreamingRecognizeServer interface {
	Send(*StreamingRecognizeResponse) error
	Recv() (*StreamingRecognizeRequest, error)
	grpc.ServerStream
}

type LongRunningRecognizeMetadata

type LongRunningRecognizeMetadata 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,proto3" json:"progress_percent,omitempty"`
	// Time when the request was received.
	StartTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	// Time of the most recent processing update.
	LastUpdateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=last_update_time,json=lastUpdateTime,proto3" json:"last_update_time,omitempty"`
	// contains filtered or unexported fields
}

Describes the progress of a long-running `LongRunningRecognize` call. It is included in the `metadata` field of the `Operation` returned by the `GetOperation` call of the `sogou.speech.longrunning.Operations` service.

func (*LongRunningRecognizeMetadata) Descriptor deprecated

func (*LongRunningRecognizeMetadata) Descriptor() ([]byte, []int)

Deprecated: Use LongRunningRecognizeMetadata.ProtoReflect.Descriptor instead.

func (*LongRunningRecognizeMetadata) GetLastUpdateTime

func (x *LongRunningRecognizeMetadata) GetLastUpdateTime() *timestamppb.Timestamp

func (*LongRunningRecognizeMetadata) GetProgressPercent

func (x *LongRunningRecognizeMetadata) GetProgressPercent() int32

func (*LongRunningRecognizeMetadata) GetStartTime

func (*LongRunningRecognizeMetadata) ProtoMessage

func (*LongRunningRecognizeMetadata) ProtoMessage()

func (*LongRunningRecognizeMetadata) ProtoReflect

func (*LongRunningRecognizeMetadata) Reset

func (x *LongRunningRecognizeMetadata) Reset()

func (*LongRunningRecognizeMetadata) String

type LongRunningRecognizeRequest

type LongRunningRecognizeRequest struct {

	// *Required* Provides information to the recognizer that specifies how to
	// process the request.
	Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
	// *Required* The audio data to be recognized.
	Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio,proto3" json:"audio,omitempty"`
	// contains filtered or unexported fields
}

The top-level message sent by the client for the `LongRunningRecognize` method.

func (*LongRunningRecognizeRequest) Descriptor deprecated

func (*LongRunningRecognizeRequest) Descriptor() ([]byte, []int)

Deprecated: Use LongRunningRecognizeRequest.ProtoReflect.Descriptor instead.

func (*LongRunningRecognizeRequest) GetAudio

func (*LongRunningRecognizeRequest) GetConfig

func (*LongRunningRecognizeRequest) ProtoMessage

func (*LongRunningRecognizeRequest) ProtoMessage()

func (*LongRunningRecognizeRequest) ProtoReflect

func (*LongRunningRecognizeRequest) Reset

func (x *LongRunningRecognizeRequest) Reset()

func (*LongRunningRecognizeRequest) String

func (x *LongRunningRecognizeRequest) String() string

type LongRunningRecognizeResponse

type LongRunningRecognizeResponse struct {
	Results []*SpeechRecognitionResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// contains filtered or unexported fields
}

The only message returned to the client by the `LongRunningRecognize` method. 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 `sogou.speech.longrunning.Operations` service.

func (*LongRunningRecognizeResponse) Descriptor deprecated

func (*LongRunningRecognizeResponse) Descriptor() ([]byte, []int)

Deprecated: Use LongRunningRecognizeResponse.ProtoReflect.Descriptor instead.

func (*LongRunningRecognizeResponse) GetResults

func (*LongRunningRecognizeResponse) ProtoMessage

func (*LongRunningRecognizeResponse) ProtoMessage()

func (*LongRunningRecognizeResponse) ProtoReflect

func (*LongRunningRecognizeResponse) Reset

func (x *LongRunningRecognizeResponse) Reset()

func (*LongRunningRecognizeResponse) String

type RecognitionAudio

type RecognitionAudio struct {

	// The audio source, which is either inline content or a uri.
	//
	// Types that are assignable to AudioSource:
	//	*RecognitionAudio_Content
	//	*RecognitionAudio_Uri
	AudioSource isRecognitionAudio_AudioSource `protobuf_oneof:"audio_source"`
	// contains filtered or unexported fields
}

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].

func (*RecognitionAudio) Descriptor deprecated

func (*RecognitionAudio) Descriptor() ([]byte, []int)

Deprecated: Use RecognitionAudio.ProtoReflect.Descriptor instead.

func (*RecognitionAudio) GetAudioSource

func (m *RecognitionAudio) GetAudioSource() isRecognitionAudio_AudioSource

func (*RecognitionAudio) GetContent

func (x *RecognitionAudio) GetContent() []byte

func (*RecognitionAudio) GetUri

func (x *RecognitionAudio) GetUri() string

func (*RecognitionAudio) ProtoMessage

func (*RecognitionAudio) ProtoMessage()

func (*RecognitionAudio) ProtoReflect

func (x *RecognitionAudio) ProtoReflect() protoreflect.Message

func (*RecognitionAudio) Reset

func (x *RecognitionAudio) Reset()

func (*RecognitionAudio) String

func (x *RecognitionAudio) String() string

type RecognitionAudio_Content

type RecognitionAudio_Content struct {
	// The audio data bytes encoded as specified in
	// `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a
	// pure binary representation, whereas JSON representations use base64.
	Content []byte `protobuf:"bytes,1,opt,name=content,proto3,oneof"`
}

type RecognitionAudio_Uri

type RecognitionAudio_Uri struct {
	// ** CURRENTLY SOGOU INTERNAL USE ONLY. **
	// URI that points to a file that contains audio data bytes as specified in
	// `RecognitionConfig`. Currently, only SOGOU INTERNAL URIs are
	// supported, (other URI formats return [google.rpc.Code.INVALID_ARGUMENT]).
	Uri string `protobuf:"bytes,2,opt,name=uri,proto3,oneof"`
}

type RecognitionConfig

type RecognitionConfig struct {

	// *Required* Encoding of audio data sent in all `RecognitionAudio` messages.
	Encoding RecognitionConfig_AudioEncoding `` /* 127-byte string literal not displayed */
	// *Required* Sample rate in Hertz of the audio data sent in all
	// `RecognitionAudio` messages.
	// In most cases, it should be specified as 16000.
	SampleRateHertz int32 `protobuf:"varint,2,opt,name=sample_rate_hertz,json=sampleRateHertz,proto3" json:"sample_rate_hertz,omitempty"`
	// *Required* The language code of the supplied audio.
	// Example: "zh-cmn-Hans-CN".
	// See [Language Support](https://zhiyin.sogou.com/doc/?url=/docs/content/asr/concepts/lauguages/) for a list of the currently supported language codes.
	LanguageCode string `protobuf:"bytes,3,opt,name=language_code,json=languageCode,proto3" 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`-`5`. A value of `0` or `1` will return 1.
	// If omitted, will return 1.
	MaxAlternatives int32 `protobuf:"varint,4,opt,name=max_alternatives,json=maxAlternatives,proto3" json:"max_alternatives,omitempty"`
	// *Optional* If set to `true`, the server will attempt to filter out
	// profanities
	ProfanityFilter bool `protobuf:"varint,5,opt,name=profanity_filter,json=profanityFilter,proto3" json:"profanity_filter,omitempty"`
	// *Optional* A means to provide context to assist the speech recognition.
	SpeechContexts []*SpeechContext `protobuf:"bytes,6,rep,name=speech_contexts,json=speechContexts,proto3" json:"speech_contexts,omitempty"`
	// *Optional* If `true`, the top result includes a list of words and
	// the start and end time offsets (timestamps) for those words. If
	// `false`, no word-level time offset information is returned. The default is
	// `false`.
	EnableWordTimeOffsets bool `` /* 129-byte string literal not displayed */
	// *Optional* Metadata regarding this request.
	Metadata *RecognitionMetadata `protobuf:"bytes,9,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// *Optional* If 'true', stop adds punctuation to recognition result hypotheses.
	// The default 'false' value DOES add punctuation to result hypotheses.
	DisableAutomaticPunctuation bool `` /* 146-byte string literal not displayed */
	// *Optional* Which model to select for the given request. Select the model
	// best suited to your domain to get best results. If a model is not
	// explicitly specified, "default" model is used.
	Model string `protobuf:"bytes,13,opt,name=model,proto3" json:"model,omitempty"`
	// contains filtered or unexported fields
}

Provides information to the recognizer that specifies how to process the request.

func (*RecognitionConfig) Descriptor deprecated

func (*RecognitionConfig) Descriptor() ([]byte, []int)

Deprecated: Use RecognitionConfig.ProtoReflect.Descriptor instead.

func (*RecognitionConfig) GetDisableAutomaticPunctuation

func (x *RecognitionConfig) GetDisableAutomaticPunctuation() bool

func (*RecognitionConfig) GetEnableWordTimeOffsets

func (x *RecognitionConfig) GetEnableWordTimeOffsets() bool

func (*RecognitionConfig) GetEncoding

func (*RecognitionConfig) GetLanguageCode

func (x *RecognitionConfig) GetLanguageCode() string

func (*RecognitionConfig) GetMaxAlternatives

func (x *RecognitionConfig) GetMaxAlternatives() int32

func (*RecognitionConfig) GetMetadata

func (x *RecognitionConfig) GetMetadata() *RecognitionMetadata

func (*RecognitionConfig) GetModel

func (x *RecognitionConfig) GetModel() string

func (*RecognitionConfig) GetProfanityFilter

func (x *RecognitionConfig) GetProfanityFilter() bool

func (*RecognitionConfig) GetSampleRateHertz

func (x *RecognitionConfig) GetSampleRateHertz() int32

func (*RecognitionConfig) GetSpeechContexts

func (x *RecognitionConfig) GetSpeechContexts() []*SpeechContext

func (*RecognitionConfig) ProtoMessage

func (*RecognitionConfig) ProtoMessage()

func (*RecognitionConfig) ProtoReflect

func (x *RecognitionConfig) ProtoReflect() protoreflect.Message

func (*RecognitionConfig) Reset

func (x *RecognitionConfig) Reset()

func (*RecognitionConfig) String

func (x *RecognitionConfig) String() string

type RecognitionConfig_AudioEncoding

type RecognitionConfig_AudioEncoding int32

Audio encoding of the data sent in the audio message. All encodings support only 1 channel (mono) audio. Only `FLAC` include 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, which include the other codecs listed in this section, are used to capture or transmit the audio, particularly if background noise is present.

const (
	// Not specified. Will return result status 400.
	RecognitionConfig_ENCODING_UNSPECIFIED RecognitionConfig_AudioEncoding = 0
	// Uncompressed 16-bit signed little-endian samples (Linear PCM).
	// `sample_rate_hertz` must be 16000.
	// (when language-code = zh-cmn-Hans-CN and model = phonecall, it must be 8000)
	RecognitionConfig_LINEAR16 RecognitionConfig_AudioEncoding = 1
	// [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio
	// Codec) is the recommended encoding because it is
	// lossless--therefore recognition is not compromised--and
	// requires only about half the bandwidth of `LINEAR16`. `FLAC` stream
	// encoding only supports 16-bit samples, however, not all fields in
	// `STREAMINFO` are supported.
	// `sample_rate_hertz` must be 16000.
	// (when language-code = zh-cmn-Hans-CN and model = phonecall, it must be 8000)
	RecognitionConfig_FLAC RecognitionConfig_AudioEncoding = 2
	// Opus encoded audio frames in Ogg container
	// ([OggOpus](https://wiki.xiph.org/OggOpus)).
	// `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, or 48000.
	RecognitionConfig_OGG_OPUS RecognitionConfig_AudioEncoding = 6
	// Raw opus format
	// 16-bit big endian integer n follows n bytes opus frame
	// `sample_rate_hertz` must be 16000.
	RecognitionConfig_OPUS_WITH_HEADER RecognitionConfig_AudioEncoding = 7
	// Sogou specific speex format 16-bit samples 1 channel
	RecognitionConfig_SOGOU_SPEEX RecognitionConfig_AudioEncoding = 100
)

func (RecognitionConfig_AudioEncoding) Descriptor

func (RecognitionConfig_AudioEncoding) Enum

func (RecognitionConfig_AudioEncoding) EnumDescriptor deprecated

func (RecognitionConfig_AudioEncoding) EnumDescriptor() ([]byte, []int)

Deprecated: Use RecognitionConfig_AudioEncoding.Descriptor instead.

func (RecognitionConfig_AudioEncoding) Number

func (RecognitionConfig_AudioEncoding) String

func (RecognitionConfig_AudioEncoding) Type

type RecognitionMetadata

type RecognitionMetadata struct {

	// The audio type that most closely describes the audio being recognized.
	MicrophoneDistance RecognitionMetadata_MicrophoneDistance `` /* 180-byte string literal not displayed */
	// The name of device used to make the recording.
	RecordingDeviceName string `protobuf:"bytes,7,opt,name=recording_device_name,json=recordingDeviceName,proto3" json:"recording_device_name,omitempty"`
	// contains filtered or unexported fields
}

Description of audio data to be recognized.

func (*RecognitionMetadata) Descriptor deprecated

func (*RecognitionMetadata) Descriptor() ([]byte, []int)

Deprecated: Use RecognitionMetadata.ProtoReflect.Descriptor instead.

func (*RecognitionMetadata) GetMicrophoneDistance

func (*RecognitionMetadata) GetRecordingDeviceName

func (x *RecognitionMetadata) GetRecordingDeviceName() string

func (*RecognitionMetadata) ProtoMessage

func (*RecognitionMetadata) ProtoMessage()

func (*RecognitionMetadata) ProtoReflect

func (x *RecognitionMetadata) ProtoReflect() protoreflect.Message

func (*RecognitionMetadata) Reset

func (x *RecognitionMetadata) Reset()

func (*RecognitionMetadata) String

func (x *RecognitionMetadata) String() string

type RecognitionMetadata_MicrophoneDistance

type RecognitionMetadata_MicrophoneDistance int32

Enumerates the types of capture settings describing an audio file.

const (
	// Audio type is not known.
	RecognitionMetadata_MICROPHONE_DISTANCE_UNSPECIFIED RecognitionMetadata_MicrophoneDistance = 0
	// The audio was captured from a closely placed microphone. Eg. phone,
	// dictaphone, or handheld microphone. Generally if there speaker is within
	// 1 meter of the microphone.
	RecognitionMetadata_NEARFIELD RecognitionMetadata_MicrophoneDistance = 100
	// The speaker if within 3 meters of the microphone.
	RecognitionMetadata_MIDFIELD RecognitionMetadata_MicrophoneDistance = 300
	// The speaker is more than 3 meters away from the microphone.
	RecognitionMetadata_FARFIELD RecognitionMetadata_MicrophoneDistance = 500
)

func (RecognitionMetadata_MicrophoneDistance) Descriptor

func (RecognitionMetadata_MicrophoneDistance) Enum

func (RecognitionMetadata_MicrophoneDistance) EnumDescriptor deprecated

func (RecognitionMetadata_MicrophoneDistance) EnumDescriptor() ([]byte, []int)

Deprecated: Use RecognitionMetadata_MicrophoneDistance.Descriptor instead.

func (RecognitionMetadata_MicrophoneDistance) Number

func (RecognitionMetadata_MicrophoneDistance) String

func (RecognitionMetadata_MicrophoneDistance) Type

type RecognizeRequest

type RecognizeRequest struct {

	// *Required* Provides information to the recognizer that specifies how to
	// process the request.
	Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
	// *Required* The audio data to be recognized.
	Audio *RecognitionAudio `protobuf:"bytes,2,opt,name=audio,proto3" json:"audio,omitempty"`
	// contains filtered or unexported fields
}

The top-level message sent by the client for the `Recognize` method.

func (*RecognizeRequest) Descriptor deprecated

func (*RecognizeRequest) Descriptor() ([]byte, []int)

Deprecated: Use RecognizeRequest.ProtoReflect.Descriptor instead.

func (*RecognizeRequest) GetAudio

func (x *RecognizeRequest) GetAudio() *RecognitionAudio

func (*RecognizeRequest) GetConfig

func (x *RecognizeRequest) GetConfig() *RecognitionConfig

func (*RecognizeRequest) ProtoMessage

func (*RecognizeRequest) ProtoMessage()

func (*RecognizeRequest) ProtoReflect

func (x *RecognizeRequest) ProtoReflect() protoreflect.Message

func (*RecognizeRequest) Reset

func (x *RecognizeRequest) Reset()

func (*RecognizeRequest) String

func (x *RecognizeRequest) String() string

type RecognizeResponse

type RecognizeResponse struct {

	// Output only. Sequential list of transcription results corresponding to
	// sequential portions of audio.
	Results []*SpeechRecognitionResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// contains filtered or unexported fields
}

The only message returned to the client by the `Recognize` method. It contains the result as zero or more sequential `SpeechRecognitionResult` messages.

func (*RecognizeResponse) Descriptor deprecated

func (*RecognizeResponse) Descriptor() ([]byte, []int)

Deprecated: Use RecognizeResponse.ProtoReflect.Descriptor instead.

func (*RecognizeResponse) GetResults

func (x *RecognizeResponse) GetResults() []*SpeechRecognitionResult

func (*RecognizeResponse) ProtoMessage

func (*RecognizeResponse) ProtoMessage()

func (*RecognizeResponse) ProtoReflect

func (x *RecognizeResponse) ProtoReflect() protoreflect.Message

func (*RecognizeResponse) Reset

func (x *RecognizeResponse) Reset()

func (*RecognizeResponse) String

func (x *RecognizeResponse) String() string

type SpeechContext

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]
	Phrases []string `protobuf:"bytes,1,rep,name=phrases,proto3" json:"phrases,omitempty"`
	// contains filtered or unexported fields
}

Provides "hints" to the speech recognizer to favor specific words and phrases in the results.

func (*SpeechContext) Descriptor deprecated

func (*SpeechContext) Descriptor() ([]byte, []int)

Deprecated: Use SpeechContext.ProtoReflect.Descriptor instead.

func (*SpeechContext) GetPhrases

func (x *SpeechContext) GetPhrases() []string

func (*SpeechContext) ProtoMessage

func (*SpeechContext) ProtoMessage()

func (*SpeechContext) ProtoReflect

func (x *SpeechContext) ProtoReflect() protoreflect.Message

func (*SpeechContext) Reset

func (x *SpeechContext) Reset()

func (*SpeechContext) String

func (x *SpeechContext) String() string

type SpeechRecognitionAlternative

type SpeechRecognitionAlternative struct {

	// *Output-only* Transcript text representing the words that the user spoke.
	Transcript string `protobuf:"bytes,1,opt,name=transcript,proto3" 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 consistent.
	// The default of 0.0 is a sentinel value indicating `confidence` was not set.
	Confidence float32 `protobuf:"fixed32,2,opt,name=confidence,proto3" json:"confidence,omitempty"`
	// *Output-only* A list of word-specific information for each recognized word.
	Words []*WordInfo `protobuf:"bytes,3,rep,name=words,proto3" json:"words,omitempty"`
	// contains filtered or unexported fields
}

Alternative hypotheses (a.k.a. n-best list).

func (*SpeechRecognitionAlternative) Descriptor deprecated

func (*SpeechRecognitionAlternative) Descriptor() ([]byte, []int)

Deprecated: Use SpeechRecognitionAlternative.ProtoReflect.Descriptor instead.

func (*SpeechRecognitionAlternative) GetConfidence

func (x *SpeechRecognitionAlternative) GetConfidence() float32

func (*SpeechRecognitionAlternative) GetTranscript

func (x *SpeechRecognitionAlternative) GetTranscript() string

func (*SpeechRecognitionAlternative) GetWords

func (x *SpeechRecognitionAlternative) GetWords() []*WordInfo

func (*SpeechRecognitionAlternative) ProtoMessage

func (*SpeechRecognitionAlternative) ProtoMessage()

func (*SpeechRecognitionAlternative) ProtoReflect

func (*SpeechRecognitionAlternative) Reset

func (x *SpeechRecognitionAlternative) Reset()

func (*SpeechRecognitionAlternative) String

type SpeechRecognitionResult

type SpeechRecognitionResult struct {

	// Output only. May contain one or more recognition hypotheses (up to the
	// maximum specified in `max_alternatives`).
	// These alternatives are ordered in terms of accuracy, with the top (first)
	// alternative being the most probable, as ranked by the recognizer.
	Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives,proto3" json:"alternatives,omitempty"`
	// contains filtered or unexported fields
}

A speech recognition result corresponding to a portion of the audio.

func (*SpeechRecognitionResult) Descriptor deprecated

func (*SpeechRecognitionResult) Descriptor() ([]byte, []int)

Deprecated: Use SpeechRecognitionResult.ProtoReflect.Descriptor instead.

func (*SpeechRecognitionResult) GetAlternatives

func (x *SpeechRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternative

func (*SpeechRecognitionResult) ProtoMessage

func (*SpeechRecognitionResult) ProtoMessage()

func (*SpeechRecognitionResult) ProtoReflect

func (x *SpeechRecognitionResult) ProtoReflect() protoreflect.Message

func (*SpeechRecognitionResult) Reset

func (x *SpeechRecognitionResult) Reset()

func (*SpeechRecognitionResult) String

func (x *SpeechRecognitionResult) String() string

type StreamingRecognitionConfig

type StreamingRecognitionConfig struct {

	// *Required* Provides information to the recognizer that specifies how to
	// process the request.
	Config *RecognitionConfig `protobuf:"bytes,1,opt,name=config,proto3" 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_SINGLE_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,proto3" 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,proto3" json:"interim_results,omitempty"`
	// *Optional* If `true`, adds punctuation to interim recognition result hypotheses.
	// available only if RecognitionConfig.disable_automatic_punctuation = false AND interim_results = true
	//
	// NOTE: deprecated
	EnableInterimResultsPunctuation bool `` /* 159-byte string literal not displayed */
	// *Optional* similar to `single_utterance`. But if `true`,
	// the recognizer will NOT detect any single spoken utterance
	// until the client closes the input stream (gRPC API) or
	// until the maximum time limit has been reached (approximately 30 seconds).
	// It will return only one `StreamingRecognitionResult`s with the `is_final` set to `true`.
	MergeUtterance bool `protobuf:"varint,5,opt,name=merge_utterance,json=mergeUtterance,proto3" json:"merge_utterance,omitempty"`
	// contains filtered or unexported fields
}

Provides information to the recognizer that specifies how to process the request.

func (*StreamingRecognitionConfig) Descriptor deprecated

func (*StreamingRecognitionConfig) Descriptor() ([]byte, []int)

Deprecated: Use StreamingRecognitionConfig.ProtoReflect.Descriptor instead.

func (*StreamingRecognitionConfig) GetConfig

func (*StreamingRecognitionConfig) GetEnableInterimResultsPunctuation

func (x *StreamingRecognitionConfig) GetEnableInterimResultsPunctuation() bool

func (*StreamingRecognitionConfig) GetInterimResults

func (x *StreamingRecognitionConfig) GetInterimResults() bool

func (*StreamingRecognitionConfig) GetMergeUtterance

func (x *StreamingRecognitionConfig) GetMergeUtterance() bool

func (*StreamingRecognitionConfig) GetSingleUtterance

func (x *StreamingRecognitionConfig) GetSingleUtterance() bool

func (*StreamingRecognitionConfig) ProtoMessage

func (*StreamingRecognitionConfig) ProtoMessage()

func (*StreamingRecognitionConfig) ProtoReflect

func (*StreamingRecognitionConfig) Reset

func (x *StreamingRecognitionConfig) Reset()

func (*StreamingRecognitionConfig) String

func (x *StreamingRecognitionConfig) String() string

type StreamingRecognitionResult

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,proto3" 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,proto3" 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,proto3" json:"stability,omitempty"`
	// contains filtered or unexported fields
}

A streaming speech recognition result corresponding to a portion of the audio that is currently being processed.

func (*StreamingRecognitionResult) Descriptor deprecated

func (*StreamingRecognitionResult) Descriptor() ([]byte, []int)

Deprecated: Use StreamingRecognitionResult.ProtoReflect.Descriptor instead.

func (*StreamingRecognitionResult) GetAlternatives

func (*StreamingRecognitionResult) GetIsFinal

func (x *StreamingRecognitionResult) GetIsFinal() bool

func (*StreamingRecognitionResult) GetStability

func (x *StreamingRecognitionResult) GetStability() float32

func (*StreamingRecognitionResult) ProtoMessage

func (*StreamingRecognitionResult) ProtoMessage()

func (*StreamingRecognitionResult) ProtoReflect

func (*StreamingRecognitionResult) Reset

func (x *StreamingRecognitionResult) Reset()

func (*StreamingRecognitionResult) String

func (x *StreamingRecognitionResult) String() string

type StreamingRecognizeRequest

type StreamingRecognizeRequest struct {

	// The streaming request, which is either a streaming config or audio content.
	//
	// Types that are assignable to StreamingRequest:
	//	*StreamingRecognizeRequest_StreamingConfig
	//	*StreamingRecognizeRequest_AudioContent
	StreamingRequest isStreamingRecognizeRequest_StreamingRequest `protobuf_oneof:"streaming_request"`
	// contains filtered or unexported fields
}

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.

func (*StreamingRecognizeRequest) Descriptor deprecated

func (*StreamingRecognizeRequest) Descriptor() ([]byte, []int)

Deprecated: Use StreamingRecognizeRequest.ProtoReflect.Descriptor instead.

func (*StreamingRecognizeRequest) GetAudioContent

func (x *StreamingRecognizeRequest) GetAudioContent() []byte

func (*StreamingRecognizeRequest) GetStreamingConfig

func (x *StreamingRecognizeRequest) GetStreamingConfig() *StreamingRecognitionConfig

func (*StreamingRecognizeRequest) GetStreamingRequest

func (m *StreamingRecognizeRequest) GetStreamingRequest() isStreamingRecognizeRequest_StreamingRequest

func (*StreamingRecognizeRequest) ProtoMessage

func (*StreamingRecognizeRequest) ProtoMessage()

func (*StreamingRecognizeRequest) ProtoReflect

func (*StreamingRecognizeRequest) Reset

func (x *StreamingRecognizeRequest) Reset()

func (*StreamingRecognizeRequest) String

func (x *StreamingRecognizeRequest) String() string

type StreamingRecognizeRequest_AudioContent

type StreamingRecognizeRequest_AudioContent struct {
	// The audio data to be recognized. Sequential chunks of audio data are sent
	// in sequential `StreamingRecognizeRequest` messages. The first
	// `StreamingRecognizeRequest` message must not contain `audio_content` data
	// and all subsequent `StreamingRecognizeRequest` messages must contain
	// `audio_content` data. The audio bytes must be encoded as specified in
	// `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a
	// pure binary representation (not base64).
	AudioContent []byte `protobuf:"bytes,2,opt,name=audio_content,json=audioContent,proto3,oneof"`
}

type StreamingRecognizeRequest_StreamingConfig

type StreamingRecognizeRequest_StreamingConfig struct {
	// Provides information to the recognizer that specifies how to process the
	// request. The first `StreamingRecognizeRequest` message must contain a
	// `streaming_config`  message.
	StreamingConfig *StreamingRecognitionConfig `protobuf:"bytes,1,opt,name=streaming_config,json=streamingConfig,proto3,oneof"`
}

type StreamingRecognizeResponse

type StreamingRecognizeResponse struct {

	// *Output-only* If set, returns a [google.rpc.Status] message that
	// specifies the error for the operation.
	Error *status.Status `protobuf:"bytes,1,opt,name=error,proto3" 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 more `is_final=false` results followed by zero or one
	// `is_final=true` result (the newly settled portion).
	Results []*StreamingRecognitionResult `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"`
	// *Output-only* Indicates the type of speech event.
	SpeechEventType StreamingRecognizeResponse_SpeechEventType `` /* 177-byte string literal not displayed */
	// contains filtered or unexported fields
}

`StreamingRecognizeResponse` is the only message returned to the client by `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse` messages are streamed back to the client. If there is no recognizable audio, and `single_utterance` is set to false, then no messages are streamed back to the client. In each response, only one of these fields will be set:

`error`,
`speech_event_type`, or
one or more (repeated) `results`.

func (*StreamingRecognizeResponse) Descriptor deprecated

func (*StreamingRecognizeResponse) Descriptor() ([]byte, []int)

Deprecated: Use StreamingRecognizeResponse.ProtoReflect.Descriptor instead.

func (*StreamingRecognizeResponse) GetError

func (x *StreamingRecognizeResponse) GetError() *status.Status

func (*StreamingRecognizeResponse) GetResults

func (*StreamingRecognizeResponse) GetSpeechEventType

func (*StreamingRecognizeResponse) ProtoMessage

func (*StreamingRecognizeResponse) ProtoMessage()

func (*StreamingRecognizeResponse) ProtoReflect

func (*StreamingRecognizeResponse) Reset

func (x *StreamingRecognizeResponse) Reset()

func (*StreamingRecognizeResponse) String

func (x *StreamingRecognizeResponse) String() string

type StreamingRecognizeResponse_SpeechEventType

type StreamingRecognizeResponse_SpeechEventType int32

Indicates the type of speech event.

const (
	// No speech event specified.
	StreamingRecognizeResponse_SPEECH_EVENT_UNSPECIFIED StreamingRecognizeResponse_SpeechEventType = 0
	// This event 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. This event is only sent if
	// `single_utterance` was set to `true`, and is not used otherwise.
	StreamingRecognizeResponse_END_OF_SINGLE_UTTERANCE StreamingRecognizeResponse_SpeechEventType = 1
)

func (StreamingRecognizeResponse_SpeechEventType) Descriptor

func (StreamingRecognizeResponse_SpeechEventType) Enum

func (StreamingRecognizeResponse_SpeechEventType) EnumDescriptor deprecated

func (StreamingRecognizeResponse_SpeechEventType) EnumDescriptor() ([]byte, []int)

Deprecated: Use StreamingRecognizeResponse_SpeechEventType.Descriptor instead.

func (StreamingRecognizeResponse_SpeechEventType) Number

func (StreamingRecognizeResponse_SpeechEventType) String

func (StreamingRecognizeResponse_SpeechEventType) Type

type UnimplementedAsrServer

type UnimplementedAsrServer struct {
}

UnimplementedAsrServer must be embedded to have forward compatible implementations.

func (UnimplementedAsrServer) LongRunningRecognize

func (UnimplementedAsrServer) Recognize

func (UnimplementedAsrServer) StreamingRecognize

type UnsafeAsrServer

type UnsafeAsrServer interface {
	// contains filtered or unexported methods
}

UnsafeAsrServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AsrServer will result in compilation errors.

type WordInfo

type WordInfo struct {

	// *Output-only* Time offset relative to the beginning of the audio,
	// and corresponding to the start of the spoken word.
	// This field is only set if `enable_word_time_offsets=true` and only
	// in the top hypothesis.
	// This is an experimental feature and the accuracy of the time offset can
	// vary.
	StartTime *durationpb.Duration `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	// *Output-only* Time offset relative to the beginning of the audio,
	// and corresponding to the end of the spoken word.
	// This field is only set if `enable_word_time_offsets=true` and only
	// in the top hypothesis.
	// This is an experimental feature and the accuracy of the time offset can
	// vary.
	EndTime *durationpb.Duration `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	// *Output-only* The word corresponding to this set of information.
	Word string `protobuf:"bytes,3,opt,name=word,proto3" json:"word,omitempty"`
	// contains filtered or unexported fields
}

Word-specific information for recognized words. Word information is only included in the response when certain request parameters are set, such as `enable_word_time_offsets`.

func (*WordInfo) Descriptor deprecated

func (*WordInfo) Descriptor() ([]byte, []int)

Deprecated: Use WordInfo.ProtoReflect.Descriptor instead.

func (*WordInfo) GetEndTime

func (x *WordInfo) GetEndTime() *durationpb.Duration

func (*WordInfo) GetStartTime

func (x *WordInfo) GetStartTime() *durationpb.Duration

func (*WordInfo) GetWord

func (x *WordInfo) GetWord() string

func (*WordInfo) ProtoMessage

func (*WordInfo) ProtoMessage()

func (*WordInfo) ProtoReflect

func (x *WordInfo) ProtoReflect() protoreflect.Message

func (*WordInfo) Reset

func (x *WordInfo) Reset()

func (*WordInfo) String

func (x *WordInfo) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL