RecognitionConfigBeta constructor

RecognitionConfigBeta({
  1. required AudioEncoding encoding,
  2. required String languageCode,
  3. int? sampleRateHertz,
  4. int audioChannelCount = 1,
  5. bool enableSeparateRecognitionPerChannel = false,
  6. int maxAlternatives = 1,
  7. bool profanityFilter = false,
  8. List<String> alternativeLanguageCodes = const [],
  9. List<SpeechContextBeta> speechContexts = const [],
  10. bool enableWordTimeOffsets = false,
  11. bool enableWordConfidence = false,
  12. bool enableAutomaticPunctuation = false,
  13. SpeakerDiarizationConfig? diarizationConfig,
  14. RecognitionMetadata? recognitionMetadata,
  15. RecognitionModel model = RecognitionModel.basic,
  16. 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.');