Class: Google::Apis::SpeechV1beta1::RecognitionConfig
- Inherits:
-
Object
- Object
- Google::Apis::SpeechV1beta1::RecognitionConfig
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- generated/google/apis/speech_v1beta1/classes.rb,
generated/google/apis/speech_v1beta1/representations.rb,
generated/google/apis/speech_v1beta1/representations.rb
Overview
The RecognitionConfig
message provides information to the recognizer
that specifies how to process the request.
Instance Attribute Summary collapse
-
#encoding ⇒ String
[Required] Encoding of audio data sent in all
RecognitionAudio
messages. -
#language_code ⇒ String
[Optional] 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 ⇒ Fixnum
[Required] Sample rate in Hertz of the audio data sent in all
RecognitionAudio
messages. -
#speech_context ⇒ Google::Apis::SpeechV1beta1::SpeechContext
Provides "hints" to the speech recognizer to favor specific words and phrases in the results.
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.
324 325 326 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 324 def initialize(**args) update!(**args) end |
Instance Attribute Details
#encoding ⇒ String
[Required] Encoding of audio data sent in all RecognitionAudio
messages.
Corresponds to the JSON property encoding
304 305 306 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 304 def encoding @encoding end |
#language_code ⇒ String
[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
for a list of the currently supported language codes.
Corresponds to the JSON property languageCode
293 294 295 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 293 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
1
. If omitted, defaults to 1
.
Corresponds to the JSON property maxAlternatives
284 285 286 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 284 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
312 313 314 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 312 def profanity_filter @profanity_filter end |
#sample_rate ⇒ 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 sampleRate
322 323 324 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 322 def sample_rate @sample_rate end |
#speech_context ⇒ Google::Apis::SpeechV1beta1::SpeechContext
Provides "hints" to the speech recognizer to favor specific words and phrases
in the results.
Corresponds to the JSON property speechContext
299 300 301 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 299 def speech_context @speech_context end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
329 330 331 332 333 334 335 336 |
# File 'generated/google/apis/speech_v1beta1/classes.rb', line 329 def update!(**args) @max_alternatives = args[:max_alternatives] if args.key?(:max_alternatives) @language_code = args[:language_code] if args.key?(:language_code) @speech_context = args[:speech_context] if args.key?(:speech_context) @encoding = args[:encoding] if args.key?(:encoding) @profanity_filter = args[:profanity_filter] if args.key?(:profanity_filter) @sample_rate = args[:sample_rate] if args.key?(:sample_rate) end |