Class: Google::Apis::SpeechV1::RecognitionConfig
- Inherits:
-
Object
- Object
- Google::Apis::SpeechV1::RecognitionConfig
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- generated/google/apis/speech_v1/classes.rb,
generated/google/apis/speech_v1/representations.rb,
generated/google/apis/speech_v1/representations.rb
Overview
Provides information to the recognizer that specifies how to process the request.
Instance Attribute Summary collapse
-
#enable_word_confidence ⇒ Boolean
(also: #enable_word_confidence?)
Optional If
true, the top result includes a list of words and the confidence for those words. -
#enable_word_time_offsets ⇒ Boolean
(also: #enable_word_time_offsets?)
Optional If
true, the top result includes a list of words and the start and end time offsets (timestamps) for those words. -
#encoding ⇒ String
Required Encoding of audio data sent in all
RecognitionAudiomessages. -
#language_code ⇒ String
Required The language of the supplied audio as a BCP-47 language tag.
-
#max_alternatives ⇒ Fixnum
Optional Maximum number of recognition hypotheses to be returned.
-
#profanity_filter ⇒ Boolean
(also: #profanity_filter?)
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. -
#sample_rate_hertz ⇒ Fixnum
Required Sample rate in Hertz of the audio data sent in all
RecognitionAudiomessages. -
#speech_contexts ⇒ Array<Google::Apis::SpeechV1::SpeechContext>
Optional A means to provide context to assist the speech recognition.
Instance Method Summary collapse
-
#initialize(**args) ⇒ RecognitionConfig
constructor
A new instance of RecognitionConfig.
-
#update!(**args) ⇒ Object
Update properties of this object.
Methods included from Core::JsonObjectSupport
Methods included from Core::Hashable
Constructor Details
#initialize(**args) ⇒ RecognitionConfig
Returns a new instance of RecognitionConfig
257 258 259 |
# File 'generated/google/apis/speech_v1/classes.rb', line 257 def initialize(**args) update!(**args) end |
Instance Attribute Details
#enable_word_confidence ⇒ Boolean Also known as: enable_word_confidence?
Optional 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.
Corresponds to the JSON property enableWordConfidence
198 199 200 |
# File 'generated/google/apis/speech_v1/classes.rb', line 198 def enable_word_confidence @enable_word_confidence end |
#enable_word_time_offsets ⇒ Boolean Also known as: enable_word_time_offsets?
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.
Corresponds to the JSON property enableWordTimeOffsets
207 208 209 |
# File 'generated/google/apis/speech_v1/classes.rb', line 207 def enable_word_time_offsets @enable_word_time_offsets end |
#encoding ⇒ String
Required Encoding of audio data sent in all RecognitionAudio messages.
Corresponds to the JSON property encoding
213 214 215 |
# File 'generated/google/apis/speech_v1/classes.rb', line 213 def encoding @encoding end |
#language_code ⇒ 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.
Corresponds to the JSON property languageCode
222 223 224 |
# File 'generated/google/apis/speech_v1/classes.rb', line 222 def language_code @language_code end |
#max_alternatives ⇒ Fixnum
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.
Corresponds to the JSON property maxAlternatives
232 233 234 |
# File 'generated/google/apis/speech_v1/classes.rb', line 232 def max_alternatives @max_alternatives end |
#profanity_filter ⇒ Boolean Also known as: profanity_filter?
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.
Corresponds to the JSON property profanityFilter
240 241 242 |
# File 'generated/google/apis/speech_v1/classes.rb', line 240 def profanity_filter @profanity_filter end |
#sample_rate_hertz ⇒ Fixnum
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).
Corresponds to the JSON property sampleRateHertz
250 251 252 |
# File 'generated/google/apis/speech_v1/classes.rb', line 250 def sample_rate_hertz @sample_rate_hertz end |
#speech_contexts ⇒ Array<Google::Apis::SpeechV1::SpeechContext>
Optional A means to provide context to assist the speech recognition.
Corresponds to the JSON property speechContexts
255 256 257 |
# File 'generated/google/apis/speech_v1/classes.rb', line 255 def speech_contexts @speech_contexts end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
262 263 264 265 266 267 268 269 270 271 |
# File 'generated/google/apis/speech_v1/classes.rb', line 262 def update!(**args) @enable_word_confidence = args[:enable_word_confidence] if args.key?(:enable_word_confidence) @enable_word_time_offsets = args[:enable_word_time_offsets] if args.key?(:enable_word_time_offsets) @encoding = args[:encoding] if args.key?(:encoding) @language_code = args[:language_code] if args.key?(:language_code) @max_alternatives = args[:max_alternatives] if args.key?(:max_alternatives) @profanity_filter = args[:profanity_filter] if args.key?(:profanity_filter) @sample_rate_hertz = args[:sample_rate_hertz] if args.key?(:sample_rate_hertz) @speech_contexts = args[:speech_contexts] if args.key?(:speech_contexts) end |