Search in sources :

Example 6 with SpeechToText

use of com.ibm.watson.speech_to_text.v1.SpeechToText in project java-sdk by watson-developer-cloud.

the class SpeechToTextExample method main.

public static void main(String[] args) throws FileNotFoundException {
    Authenticator authenticator = new IamAuthenticator("<iam_api_key>");
    SpeechToText service = new SpeechToText(authenticator);
    File audio = new File("src/test/resources/speech_to_text/sample1.wav");
    RecognizeOptions options = new RecognizeOptions.Builder().audio(audio).contentType(HttpMediaType.AUDIO_WAV).build();
    SpeechRecognitionResults transcript = service.recognize(options).execute().getResult();
    System.out.println(transcript);
}
Also used : IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) File(java.io.File) Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) SpeechRecognitionResults(com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults) RecognizeOptions(com.ibm.watson.speech_to_text.v1.model.RecognizeOptions)

Aggregations

IamAuthenticator (com.ibm.cloud.sdk.core.security.IamAuthenticator)6 Authenticator (com.ibm.cloud.sdk.core.security.Authenticator)5 SpeechRecognitionResults (com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults)5 RecognizeWithWebsocketsOptions (com.ibm.watson.speech_to_text.v1.model.RecognizeWithWebsocketsOptions)4 BaseRecognizeCallback (com.ibm.watson.speech_to_text.v1.websocket.BaseRecognizeCallback)3 RecognizeOptions (com.ibm.watson.speech_to_text.v1.model.RecognizeOptions)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 SpeechToText (com.ibm.watson.speech_to_text.v1.SpeechToText)1 AddCorpusOptions (com.ibm.watson.speech_to_text.v1.model.AddCorpusOptions)1 AddWordOptions (com.ibm.watson.speech_to_text.v1.model.AddWordOptions)1 Corpora (com.ibm.watson.speech_to_text.v1.model.Corpora)1 Corpus (com.ibm.watson.speech_to_text.v1.model.Corpus)1 CreateLanguageModelOptions (com.ibm.watson.speech_to_text.v1.model.CreateLanguageModelOptions)1 DeleteLanguageModelOptions (com.ibm.watson.speech_to_text.v1.model.DeleteLanguageModelOptions)1 GetCorpusOptions (com.ibm.watson.speech_to_text.v1.model.GetCorpusOptions)1 GetLanguageModelOptions (com.ibm.watson.speech_to_text.v1.model.GetLanguageModelOptions)1 LanguageModel (com.ibm.watson.speech_to_text.v1.model.LanguageModel)1 ListCorporaOptions (com.ibm.watson.speech_to_text.v1.model.ListCorporaOptions)1 ListWordsOptions (com.ibm.watson.speech_to_text.v1.model.ListWordsOptions)1