Speech to Text Built-ins ¶
The Speech-to-Text built-ins provide a function that takes the audio file and language as parameters and returns an object containing the recognized test. The audio file must be accessed through File Built-ins, which are described in the following section.
Additional information is available in the section about Using Speech-to-Text in Test Cases.
<speechToText Result> := SpeechToText.recognize(<audioFile File>, <language String>)
The recognition result is an object containing information about the status of the operation and the recognized text:
assert result.isOk() println(result.text) // text is valid only if isOk() is true
audioFile - A file as provided by
language - One of the languages supported by the Google Cloud Speech-to-Text API
1 2 3 4 5 6 7
stepdef "do speech-to-text" audioFile := File.fromProject("audio.wav") result := SpeechToText.recognize(audioFile, "de-DE") assert result.isOk() println(result.text) end