watson-developer-cloud / speech-to-text-websockets-ruby

Ruby client that interacts with the IBM Watson Speech to Text service through its WebSockets interface
Apache License 2.0
19 stars 13 forks source link

[Speech to Text] The model parameter for websocket doesn't take effect. #8

Open alpha-netzilla opened 6 years ago

alpha-netzilla commented 6 years ago

Hi,

I specified the language model for transcription in params as follows, and prepared a wav file according to the model format.

params = {
     'action'             => "start",
     'model'              => 'ja-JP_BroadbandModel',
     'content-type'       => "audio/wav", 
     'continuous'         => true,
     'inactivity_timeout' => -1,
     'interim_results'    => true
}

However, Speech to Text tries to recognize the uploaded file as the default language model of en-US_BroadbandModel.

Deconstruct the issue, I used the same parameter in Node.js SDK. Speech to Text returned the transcription as desired. https://github.com/watson-developer-cloud/node-sdk

Could you think of anything that might have caused it?

germanattanasio commented 6 years ago

You are specifying a parameter that is not supported by this sample. If you look at the line https://github.com/watson-developer-cloud/speech-to-text-websockets-ruby/blob/master/example.rb#L36 you will see that model is not being used in the url to /recognize.

The model needs to be added to the query string

watson_url = "wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?
watson-token=#{token.body}&model=ja-JP_BroadbandModel"
alpha-netzilla commented 6 years ago

I see. Thanks!