RecognitionConfig class

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

Inheritance
  • Object
  • GeneratedMessage
  • RecognitionConfig

Constructors

RecognitionConfig({RecognitionConfig_AudioEncoding? encoding, int? sampleRateHertz, String? languageCode, int? maxAlternatives, bool? profanityFilter, Iterable<SpeechContext>? speechContexts, int? audioChannelCount, bool? enableWordTimeOffsets, RecognitionMetadata? metadata, bool? enableAutomaticPunctuation, bool? enableSeparateRecognitionPerChannel, String? model, bool? useEnhanced, bool? enableWordConfidence, Iterable<String>? alternativeLanguageCodes, SpeakerDiarizationConfig? diarizationConfig, SpeechAdaptation? adaptation, BoolValue? enableSpokenPunctuation, BoolValue? enableSpokenEmojis})
factory
RecognitionConfig.fromBuffer(List<int> i, [ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY])
factory
RecognitionConfig.fromJson(String i, [ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY])
factory

Properties

adaptation SpeechAdaptation
Speech adaptation configuration improves the accuracy of speech recognition. For more information, see the speech adaptation documentation. When speech adaptation is set it supersedes the speech_contexts field.
getter/setter pair
alternativeLanguageCodes List<String>
A list of up to 3 additional BCP-47 language tags, listing possible alternative languages of the supplied audio. See Language Support for a list of the currently supported language codes. If alternative languages are listed, recognition result will contain recognition in the most likely language detected including the main language_code. The recognition result will include the language tag of the language detected in the audio. Note: This feature is only supported for Voice Command and Voice Search use cases and performance may vary for other use cases (e.g., phone call transcription).
no setter
audioChannelCount int
The number of channels in the input audio data. ONLY set this for MULTI-CHANNEL recognition. Valid values for LINEAR16, OGG_OPUS and FLAC are 1-8. Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only 1. If 0 or omitted, defaults to one channel (mono). Note: We only recognize the first channel by default. To perform independent recognition on each channel set enable_separate_recognition_per_channel to 'true'.
getter/setter pair
diarizationConfig SpeakerDiarizationConfig
Config to enable speaker diarization and set additional parameters to make diarization better suited for your application. Note: When this is enabled, we send all the words from the beginning of the audio for the top alternative in every consecutive STREAMING responses. This is done in order to improve our speaker tags as our models learn to identify the speakers in the conversation over time. For non-streaming requests, the diarization results will be provided only in the top alternative of the FINAL SpeechRecognitionResult.
getter/setter pair
enableAutomaticPunctuation bool
If 'true', adds punctuation to recognition result hypotheses. This feature is only available in select languages. Setting this for requests in other languages has no effect at all. The default 'false' value does not add punctuation to result hypotheses.
getter/setter pair
enableSeparateRecognitionPerChannel bool
This needs to be set to true explicitly and audio_channel_count > 1 to get each channel recognized separately. The recognition result will contain a channel_tag field to state which channel that result belongs to. If this is not true, we will only recognize the first channel. The request is billed cumulatively for all channels recognized: audio_channel_count multiplied by the length of the audio.
getter/setter pair
enableSpokenEmojis BoolValue
The spoken emoji behavior for the call If not set, uses default behavior based on model of choice If 'true', adds spoken emoji formatting for the request. This will replace spoken emojis with the corresponding Unicode symbols in the final transcript. If 'false', spoken emojis are not replaced.
getter/setter pair
enableSpokenPunctuation BoolValue
The spoken punctuation behavior for the call If not set, uses default behavior based on model of choice e.g. command_and_search will enable spoken punctuation by default If 'true', replaces spoken punctuation with the corresponding symbols in the request. For example, "how are you question mark" becomes "how are you?". See https://cloud.google.com/speech-to-text/docs/spoken-punctuation for support. If 'false', spoken punctuation is not replaced.
getter/setter pair
enableWordConfidence bool
If true, the top result includes a list of words and the confidence for those words. If false, no word-level confidence information is returned. The default is false.
getter/setter pair
enableWordTimeOffsets bool
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.
getter/setter pair
encoding RecognitionConfig_AudioEncoding
Encoding of audio data sent in all RecognitionAudio messages. This field is optional for FLAC and WAV audio files and required for all other audio formats. For details, see google.cloud.speech.v1.RecognitionConfig.AudioEncoding.
getter/setter pair
eventPlugin → EventPlugin?
Subclasses can override this getter to be notified of changes to protobuf fields.
no setterinherited
hashCode int
Calculates a hash code based on the contents of the protobuf.
no setterinherited
info_ → BuilderInfo
no setteroverride
isFrozen bool
Returns true if this message is marked read-only. Otherwise false.
no setterinherited
languageCode String
Required. The language of the supplied audio as a BCP-47 language tag. Example: "en-US". See Language Support for a list of the currently supported language codes.
getter/setter pair
maxAlternatives int
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.
getter/setter pair
metadata RecognitionMetadata
Metadata regarding this request.
getter/setter pair
model String
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, then we auto-select a model based on the parameters in the RecognitionConfig.
getter/setter pair
profanityFilter bool
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.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleRateHertz int
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). This field is optional for FLAC and WAV audio files, but is required for all other audio formats. For details, see google.cloud.speech.v1.RecognitionConfig.AudioEncoding.
getter/setter pair
speechContexts List<SpeechContext>
Array of google.cloud.speech.v1.SpeechContext. A means to provide context to assist the speech recognition. For more information, see speech adaptation.
no setter
unknownFields → UnknownFieldSet
no setterinherited
useEnhanced bool
Set to true to use an enhanced model for speech recognition. If use_enhanced is set to true and the model field is not set, then an appropriate enhanced model is chosen if an enhanced model exists for the audio.
getter/setter pair

Methods

addExtension(Extension extension, Object? value) → void
Adds an extension field value to a repeated field.
inherited
check() → void
inherited
clear() → void
Clears all data that was set in this message.
inherited
clearAdaptation() → void
clearAudioChannelCount() → void
clearDiarizationConfig() → void
clearEnableAutomaticPunctuation() → void
clearEnableSeparateRecognitionPerChannel() → void
clearEnableSpokenEmojis() → void
clearEnableSpokenPunctuation() → void
clearEnableWordConfidence() → void
clearEnableWordTimeOffsets() → void
clearEncoding() → void
clearExtension(Extension extension) → void
Clears an extension field and also removes the extension.
inherited
clearField(int tagNumber) → void
Clears the contents of a given field.
inherited
clearLanguageCode() → void
clearMaxAlternatives() → void
clearMetadata() → void
clearModel() → void
clearProfanityFilter() → void
clearSampleRateHertz() → void
clearUseEnhanced() → void
clone() RecognitionConfig
Creates a deep copy of the fields in this message. (The generated code uses mergeFromMessage.)
override
copyWith(void updates(RecognitionConfig)) RecognitionConfig
Apply updates to a copy of this message.
override
createEmptyInstance() RecognitionConfig
Creates an empty instance of the same message type as this.
override
createMapField<K, V>(int tagNumber, MapFieldInfo<K, V> fi) Map<K, V>
Creates a Map representing a map field.
inherited
createRepeatedField<T>(int tagNumber, FieldInfo<T> fi) List<T>
Creates List implementing a mutable repeated field.
inherited
ensureAdaptation() SpeechAdaptation
ensureDiarizationConfig() SpeakerDiarizationConfig
ensureEnableSpokenEmojis() BoolValue
ensureEnableSpokenPunctuation() BoolValue
ensureMetadata() RecognitionMetadata
extensionsAreInitialized() bool
inherited
freeze() → GeneratedMessage
Make this message read-only.
inherited
getDefaultForField(int tagNumber) → dynamic
Returns the default value for the given field.
inherited
getExtension(Extension extension) → dynamic
Returns the value of extension.
inherited
getField(int tagNumber) → dynamic
Returns the value of the field associated with tagNumber, or the default value if it is not set.
inherited
getFieldOrNull(int tagNumber) → dynamic
Returns the value of a field, ignoring any defaults.
inherited
getTagNumber(String fieldName) int?
inherited
hasAdaptation() bool
hasAudioChannelCount() bool
hasDiarizationConfig() bool
hasEnableAutomaticPunctuation() bool
hasEnableSeparateRecognitionPerChannel() bool
hasEnableSpokenEmojis() bool
hasEnableSpokenPunctuation() bool
hasEnableWordConfidence() bool
hasEnableWordTimeOffsets() bool
hasEncoding() bool
hasExtension(Extension extension) bool
Returns true if a value of extension is present.
inherited
hasField(int tagNumber) bool
Whether this message has a field associated with tagNumber.
inherited
hasLanguageCode() bool
hasMaxAlternatives() bool
hasMetadata() bool
hasModel() bool
hasProfanityFilter() bool
hasRequiredFields() bool
Whether the message has required fields.
inherited
hasSampleRateHertz() bool
hasUseEnhanced() bool
isInitialized() bool
Whether all required fields in the message and embedded messages are set.
inherited
mergeFromBuffer(List<int> input, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void
Merges serialized protocol buffer data into this message.
inherited
mergeFromCodedBufferReader(CodedBufferReader input, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void
inherited
mergeFromJson(String data, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void
Merges field values from data, a JSON object, encoded as described by GeneratedMessage.writeToJson.
inherited
mergeFromJsonMap(Map<String, dynamic> json, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void
Merges field values from a JSON object represented as a Dart map.
inherited
mergeFromMessage(GeneratedMessage other) → void
Merges the contents of the other into this message.
inherited
mergeFromProto3Json(Object? json, {TypeRegistry typeRegistry = const TypeRegistry.empty(), bool ignoreUnknownFields = false, bool supportNamesWithUnderscores = true, bool permissiveEnums = false}) → void
Merges field values from json, a JSON object using proto3 encoding.
inherited
mergeUnknownFields(UnknownFieldSet unknownFieldSet) → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setExtension(Extension extension, Object value) → void
Sets the value of a non-repeated extension field to value.
inherited
setField(int tagNumber, Object value) → void
Sets the value of a field by its tagNumber.
inherited
toBuilder() → GeneratedMessage
Creates a writable, shallow copy of this message.
inherited
toDebugString() String
Returns a String representation of this message.
inherited
toProto3Json({TypeRegistry typeRegistry = const TypeRegistry.empty()}) Object?
Returns an Object representing Proto3 JSON serialization of this.
inherited
toString() String
Returns a String representation of this message.
inherited
writeToBuffer() Uint8List
inherited
writeToCodedBufferWriter(CodedBufferWriter output) → void
inherited
writeToJson() String
Returns a JSON string that encodes this message.
inherited
writeToJsonMap() Map<String, dynamic>
Returns the JSON encoding of this message as a Dart Map.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited