RecognitionConfigBeta constructor
RecognitionConfigBeta({
- required AudioEncoding encoding,
- required String languageCode,
- int? sampleRateHertz,
- int audioChannelCount = 1,
- bool enableSeparateRecognitionPerChannel = false,
- int maxAlternatives = 1,
- bool profanityFilter = false,
- List<
String> alternativeLanguageCodes = const [], - List<
SpeechContextBeta> speechContexts = const [], - bool enableWordTimeOffsets = false,
- bool enableWordConfidence = false,
- bool enableAutomaticPunctuation = false,
- SpeakerDiarizationConfig? diarizationConfig,
- RecognitionMetadata? recognitionMetadata,
- RecognitionModel model = RecognitionModel.basic,
- bool useEnhanced = false,
Provides information to the recognizer that specifies how to process the request.
Implementation
RecognitionConfigBeta({
required this.encoding,
required this.languageCode,
this.sampleRateHertz,
this.audioChannelCount = 1,
this.enableSeparateRecognitionPerChannel = false,
this.maxAlternatives = 1,
this.profanityFilter = false,
this.alternativeLanguageCodes = const [],
this.speechContexts = const [],
this.enableWordTimeOffsets = false,
this.enableWordConfidence = false,
this.enableAutomaticPunctuation = false,
this.diarizationConfig,
this.recognitionMetadata,
this.model = RecognitionModel.basic,
this.useEnhanced = false,
}) : assert(encoding != AudioEncoding.AMR || sampleRateHertz == 8000,
'sampleRateHertz must be 8000.'),
assert(encoding != AudioEncoding.AMR_WB || sampleRateHertz == 16000,
'sampleRateHertz must be 16000.'),
assert(
encoding != AudioEncoding.OGG_OPUS ||
[8000, 12000, 16000, 24000, 48000].contains(sampleRateHertz),
'sampleRateHertz must be one of 8000, 12000, 16000, 24000, or 48000.'),
assert(
encoding != AudioEncoding.SPEEX_WITH_HEADER_BYTE ||
sampleRateHertz == 16000,
'sampleRateHertz must be 16000.');