recognize method

Future<RecognizeResponse> recognize(
  1. RecognitionConfigV2 config,
  2. List<int> audio, {
  3. String location = 'global',
})

Sends a RecognizeRequest request to the Google Speech Api. Requires a RecognitionConfig and an RecognitionAudio.

Audio files transcribed with recognize must not be longer than 60 seconds. For longer audio files longRunningRecognize must be used.

Implementation

Future<RecognizeResponse> recognize(
    RecognitionConfigV2 config, List<int> audio,
    {String location = 'global'}) {
  final client = SpeechClient(_channel, options: _options);

  // Create the request, which transmits the necessary
  // data to the Google Api.
  final request = (RecognizeRequest()
    ..recognizer = 'projects/$projectId/locations/$location/recognizers/_'
    ..config = config.toConfig()
    ..content = audio);
  return client.recognize(request);
}