public class SpeechToText extends WatsonService
defaultHeaders, MESSAGE_CODE, MESSAGE_ERROR, skipAuthentication, VERSION| Constructor and Description |
|---|
SpeechToText()
Instantiates a new `SpeechToText`.
|
SpeechToText(java.lang.String username,
java.lang.String password)
Instantiates a new `SpeechToText` with username and password.
|
| Modifier and Type | Method and Description |
|---|---|
ServiceCall<java.lang.Void> |
addAudio(AddAudioOptions addAudioOptions)
Adds an audio resource to a custom acoustic model.
|
ServiceCall<java.lang.Void> |
addCorpus(AddCorpusOptions addCorpusOptions)
Adds a corpus text file to a custom language model.
|
ServiceCall<java.lang.Void> |
addWord(AddWordOptions addWordOptions)
Adds a custom word to a custom language model.
|
ServiceCall<java.lang.Void> |
addWords(AddWordsOptions addWordsOptions)
Adds one or more custom words to a custom language model.
|
ServiceCall<RecognitionJob> |
checkJob(CheckJobOptions checkJobOptions)
Checks the status of the specified asynchronous job.
|
ServiceCall<RecognitionJobs> |
checkJobs()
Checks the status of all asynchronous jobs.
|
ServiceCall<RecognitionJobs> |
checkJobs(CheckJobsOptions checkJobsOptions)
Checks the status of all asynchronous jobs.
|
ServiceCall<AcousticModel> |
createAcousticModel(CreateAcousticModelOptions createAcousticModelOptions)
Creates a custom acoustic model.
|
ServiceCall<RecognitionJob> |
createJob(CreateJobOptions createJobOptions)
Creates a job for an asynchronous recognition request.
|
ServiceCall<LanguageModel> |
createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions)
Creates a custom language model.
|
ServiceCall<java.lang.Void> |
deleteAcousticModel(DeleteAcousticModelOptions deleteAcousticModelOptions)
Deletes a custom acoustic model.
|
ServiceCall<java.lang.Void> |
deleteAudio(DeleteAudioOptions deleteAudioOptions)
Deletes an audio resource from a custom acoustic model.
|
ServiceCall<java.lang.Void> |
deleteCorpus(DeleteCorpusOptions deleteCorpusOptions)
Deletes a corpus from a custom language model.
|
ServiceCall<java.lang.Void> |
deleteJob(DeleteJobOptions deleteJobOptions)
Deletes the specified asynchronous job.
|
ServiceCall<java.lang.Void> |
deleteLanguageModel(DeleteLanguageModelOptions deleteLanguageModelOptions)
Deletes a custom language model.
|
ServiceCall<java.lang.Void> |
deleteWord(DeleteWordOptions deleteWordOptions)
Deletes a custom word from a custom language model.
|
ServiceCall<AcousticModel> |
getAcousticModel(GetAcousticModelOptions getAcousticModelOptions)
Lists information about a custom acoustic model.
|
ServiceCall<AudioListing> |
getAudio(GetAudioOptions getAudioOptions)
Lists information about an audio resource for a custom acoustic model.
|
ServiceCall<Corpus> |
getCorpus(GetCorpusOptions getCorpusOptions)
Lists information about a corpus for a custom language model.
|
ServiceCall<LanguageModel> |
getLanguageModel(GetLanguageModelOptions getLanguageModelOptions)
Lists information about a custom language model.
|
ServiceCall<SpeechModel> |
getModel(GetModelOptions getModelOptions)
Retrieves information about the model.
|
ServiceCall<Word> |
getWord(GetWordOptions getWordOptions)
Lists a custom word from a custom language model.
|
ServiceCall<AcousticModels> |
listAcousticModels()
Lists information about all custom acoustic models.
|
ServiceCall<AcousticModels> |
listAcousticModels(ListAcousticModelsOptions listAcousticModelsOptions)
Lists information about all custom acoustic models.
|
ServiceCall<AudioResources> |
listAudio(ListAudioOptions listAudioOptions)
Lists information about all audio resources for a custom acoustic model.
|
ServiceCall<Corpora> |
listCorpora(ListCorporaOptions listCorporaOptions)
Lists information about all corpora for a custom language model.
|
ServiceCall<LanguageModels> |
listLanguageModels()
Lists information about all custom language models.
|
ServiceCall<LanguageModels> |
listLanguageModels(ListLanguageModelsOptions listLanguageModelsOptions)
Lists information about all custom language models.
|
ServiceCall<SpeechModels> |
listModels()
Retrieves the models available for the service.
|
ServiceCall<SpeechModels> |
listModels(ListModelsOptions listModelsOptions)
Retrieves the models available for the service.
|
ServiceCall<Words> |
listWords(ListWordsOptions listWordsOptions)
Lists all custom words from a custom language model.
|
ServiceCall<SpeechRecognitionResults> |
recognize(RecognizeOptions recognizeOptions)
Recognizes an audio file and returns
SpeechRecognitionResults.Here is an example of how to recognize an audio file: |
okhttp3.WebSocket |
recognizeUsingWebSocket(RecognizeOptions recognizeOptions,
RecognizeCallback callback)
Sends audio and returns transcription results for recognition requests over a WebSocket connection.
|
ServiceCall<RegisterStatus> |
registerCallback(RegisterCallbackOptions registerCallbackOptions)
Registers a callback URL for use with the asynchronous interface.
|
ServiceCall<java.lang.Void> |
resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions)
Resets a custom acoustic model.
|
ServiceCall<java.lang.Void> |
resetLanguageModel(ResetLanguageModelOptions resetLanguageModelOptions)
Resets a custom language model.
|
ServiceCall<java.lang.Void> |
trainAcousticModel(TrainAcousticModelOptions trainAcousticModelOptions)
Trains a custom acoustic model.
|
ServiceCall<java.lang.Void> |
trainLanguageModel(TrainLanguageModelOptions trainLanguageModelOptions)
Trains a custom language model.
|
ServiceCall<java.lang.Void> |
unregisterCallback(UnregisterCallbackOptions unregisterCallbackOptions)
Removes the registration for an asynchronous callback URL.
|
ServiceCall<java.lang.Void> |
upgradeAcousticModel(UpgradeAcousticModelOptions upgradeAcousticModelOptions)
Upgrades a custom acoustic model.
|
ServiceCall<java.lang.Void> |
upgradeLanguageModel(UpgradeLanguageModelOptions upgradeLanguageModelOptions)
Upgrades a custom language model.
|
configureHttpClient, createServiceCall, getApiKey, getEndPoint, getName, getPassword, getToken, getUsername, processServiceCall, setApiKey, setAuthentication, setDefaultHeaders, setDefaultHeaders, setEndPoint, setSkipAuthentication, setUsernameAndPassword, toStringpublic SpeechToText()
public SpeechToText(java.lang.String username,
java.lang.String password)
username - the usernamepassword - the passwordpublic ServiceCall<SpeechModel> getModel(GetModelOptions getModelOptions)
getModelOptions - the GetModelOptions containing the options for the callServiceCall with a response type of SpeechModelpublic ServiceCall<SpeechModels> listModels(ListModelsOptions listModelsOptions)
listModelsOptions - the ListModelsOptions containing the options for the callServiceCall with a response type of SpeechModelspublic ServiceCall<SpeechModels> listModels()
ServiceCall with a response type of SpeechModelspublic ServiceCall<SpeechRecognitionResults> recognize(RecognizeOptions recognizeOptions)
SpeechRecognitionResults.
SpeechToText service = new SpeechToText();
service.setUsernameAndPassword("USERNAME", "PASSWORD");
service.setEndPoint("SERVICE_URL");
RecognizeOptions options = new RecognizeOptions().maxAlternatives(3).continuous(true);
File audio = new File("sample1.wav");
SpeechResults results = service.recognize(audio, options).execute();
System.out.println(results);
recognizeOptions - the recognize optionsSpeechRecognitionResultspublic okhttp3.WebSocket recognizeUsingWebSocket(RecognizeOptions recognizeOptions, RecognizeCallback callback)
recognizeOptions - the recognize optionscallback - the RecognizeCallback instance where results will be sentWebSocketpublic ServiceCall<RecognitionJob> checkJob(CheckJobOptions checkJobOptions)
checkJobOptions - the CheckJobOptions containing the options for the callServiceCall with a response type of RecognitionJobpublic ServiceCall<RecognitionJobs> checkJobs(CheckJobsOptions checkJobsOptions)
checkJobsOptions - the CheckJobsOptions containing the options for the callServiceCall with a response type of RecognitionJobspublic ServiceCall<RecognitionJobs> checkJobs()
ServiceCall with a response type of RecognitionJobspublic ServiceCall<RecognitionJob> createJob(CreateJobOptions createJobOptions)
createJobOptions - the CreateJobOptions containing the options for the callServiceCall with a response type of RecognitionJobpublic ServiceCall<java.lang.Void> deleteJob(DeleteJobOptions deleteJobOptions)
deleteJobOptions - the DeleteJobOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<RegisterStatus> registerCallback(RegisterCallbackOptions registerCallbackOptions)
registerCallbackOptions - the RegisterCallbackOptions containing the options for the callServiceCall with a response type of RegisterStatuspublic ServiceCall<java.lang.Void> unregisterCallback(UnregisterCallbackOptions unregisterCallbackOptions)
unregisterCallbackOptions - the UnregisterCallbackOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<LanguageModel> createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions)
createLanguageModelOptions - the CreateLanguageModelOptions containing the options for the callServiceCall with a response type of LanguageModelpublic ServiceCall<java.lang.Void> deleteLanguageModel(DeleteLanguageModelOptions deleteLanguageModelOptions)
deleteLanguageModelOptions - the DeleteLanguageModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<LanguageModel> getLanguageModel(GetLanguageModelOptions getLanguageModelOptions)
getLanguageModelOptions - the GetLanguageModelOptions containing the options for the callServiceCall with a response type of LanguageModelpublic ServiceCall<LanguageModels> listLanguageModels(ListLanguageModelsOptions listLanguageModelsOptions)
listLanguageModelsOptions - the ListLanguageModelsOptions containing the options for the callServiceCall with a response type of LanguageModelspublic ServiceCall<LanguageModels> listLanguageModels()
ServiceCall with a response type of LanguageModelspublic ServiceCall<java.lang.Void> resetLanguageModel(ResetLanguageModelOptions resetLanguageModelOptions)
resetLanguageModelOptions - the ResetLanguageModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> trainLanguageModel(TrainLanguageModelOptions trainLanguageModelOptions)
trainLanguageModelOptions - the TrainLanguageModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> upgradeLanguageModel(UpgradeLanguageModelOptions upgradeLanguageModelOptions)
upgradeLanguageModelOptions - the UpgradeLanguageModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> addCorpus(AddCorpusOptions addCorpusOptions)
addCorpusOptions - the AddCorpusOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> deleteCorpus(DeleteCorpusOptions deleteCorpusOptions)
deleteCorpusOptions - the DeleteCorpusOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<Corpus> getCorpus(GetCorpusOptions getCorpusOptions)
getCorpusOptions - the GetCorpusOptions containing the options for the callServiceCall with a response type of Corpuspublic ServiceCall<Corpora> listCorpora(ListCorporaOptions listCorporaOptions)
listCorporaOptions - the ListCorporaOptions containing the options for the callServiceCall with a response type of Corporapublic ServiceCall<java.lang.Void> addWord(AddWordOptions addWordOptions)
addWordOptions - the AddWordOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> addWords(AddWordsOptions addWordsOptions)
addWordsOptions - the AddWordsOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> deleteWord(DeleteWordOptions deleteWordOptions)
deleteWordOptions - the DeleteWordOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<Word> getWord(GetWordOptions getWordOptions)
getWordOptions - the GetWordOptions containing the options for the callServiceCall with a response type of Wordpublic ServiceCall<Words> listWords(ListWordsOptions listWordsOptions)
listWordsOptions - the ListWordsOptions containing the options for the callServiceCall with a response type of Wordspublic ServiceCall<AcousticModel> createAcousticModel(CreateAcousticModelOptions createAcousticModelOptions)
createAcousticModelOptions - the CreateAcousticModelOptions containing the options for the callServiceCall with a response type of AcousticModelpublic ServiceCall<java.lang.Void> deleteAcousticModel(DeleteAcousticModelOptions deleteAcousticModelOptions)
deleteAcousticModelOptions - the DeleteAcousticModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<AcousticModel> getAcousticModel(GetAcousticModelOptions getAcousticModelOptions)
getAcousticModelOptions - the GetAcousticModelOptions containing the options for the callServiceCall with a response type of AcousticModelpublic ServiceCall<AcousticModels> listAcousticModels(ListAcousticModelsOptions listAcousticModelsOptions)
listAcousticModelsOptions - the ListAcousticModelsOptions containing the options for the callServiceCall with a response type of AcousticModelspublic ServiceCall<AcousticModels> listAcousticModels()
ServiceCall with a response type of AcousticModelspublic ServiceCall<java.lang.Void> resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions)
resetAcousticModelOptions - the ResetAcousticModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> trainAcousticModel(TrainAcousticModelOptions trainAcousticModelOptions)
trainAcousticModelOptions - the TrainAcousticModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> upgradeAcousticModel(UpgradeAcousticModelOptions upgradeAcousticModelOptions)
upgradeAcousticModelOptions - the UpgradeAcousticModelOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> addAudio(AddAudioOptions addAudioOptions)
addAudioOptions - the AddAudioOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<java.lang.Void> deleteAudio(DeleteAudioOptions deleteAudioOptions)
deleteAudioOptions - the DeleteAudioOptions containing the options for the callServiceCall with a response type of Voidpublic ServiceCall<AudioListing> getAudio(GetAudioOptions getAudioOptions)
getAudioOptions - the GetAudioOptions containing the options for the callServiceCall with a response type of AudioListingpublic ServiceCall<AudioResources> listAudio(ListAudioOptions listAudioOptions)
listAudioOptions - the ListAudioOptions containing the options for the callServiceCall with a response type of AudioResources