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.
Syntax
1 | <speechToText Result> := SpeechToText.recognizeWithLanguage(<audioFile File>, <language String>) |
Returns
The recognition result is an object containing information about the status of the operation and the recognized text:
1 2 | assert result.isOk() println(result.text) // text is valid only if isOk() is true |
Parameters
-
audioFile - A file as provided by
File.fromProject
orFile.fromSystem
Built-ins -
language - One of the languages supported by the Google Cloud Speech-to-Text API
Example
1 2 3 4 5 6 7 | stepdef "do speech-to-text" audioFile := File.fromProject("audio.wav") result := SpeechToText.recognizeWithLanguage(audioFile, "de-DE") assert result.isOk() println(result.text) end |