Why am I getting a list index out of range error for Watson Speech to Text
I'm getting a list index out of range error for speech to text with the new Watson sdk. The weird thing is that it only occurs with the japanese models. I can change the model to chinese and english and I don't get the error. The only code I have changed from the ExampleStreaming.cs file is the following:
public bool Active
{
get { return _speechToText.IsListening; }
set
{
if (value && !_speechToText.IsListening)
{
//_speechToText.RecognizeModel = "zh-CN_BroadbandModel";
//_speechToText.RecognizeModel = "en-US_BroadbandModel";
_speechToText.RecognizeModel = "ja-JP_BroadbandModel";
_speechToText.DetectSilence = true;
_speechToText.EnableWordConfidence = true;
_speechToText.EnableTimestamps = true;
_speechToText.SilenceThreshold = 0.01f;
_speechToText.MaxAlternatives = 0;
_speechToText.EnableInterimResults = true;
_speechToText.OnError = OnError;
_speechToText.InactivityTimeout = -1;
_speechToText.ProfanityFilter = false;
_speechToText.SmartFormatting = true;
_speechToText.SpeakerLabels = false;
_speechToText.WordAlternativesThreshold = null;
_speechToText.StartListening(OnRecognize, OnRecognizeSpeaker);
}
else if (!value && _speechToText.IsListening)
{
_speechToText.StopListening();
}
}
}
Here is the error: [02/26/2018 01:23:03][SpeechToText.OnListenMessage()][ERROR] Error: list index out of range UnityEngine.Debug:LogError(Object) IBM.Watson.DeveloperCloud.Debug.DebugReactor:ProcessLog(LogRecord) (at Assets/Watson/Scripts/Debug/DebugReactor.cs:60) IBM.Watson.DeveloperCloud.Logging.LogSystem:ProcessLog(LogRecord) (at Assets/Watson/Scripts/Logging/Logger.cs:196) IBM.Watson.DeveloperCloud.Logging.Log:Error(String, String, Object[]) (at Assets/Watson/Scripts/Logging/Logger.cs:261) IBM.Watson.DeveloperCloud.Services.SpeechToText.v1.SpeechToText:OnListenMessage(Message) (at Assets/Watson/Scripts/Services/SpeechToText/v1/SpeechToText.cs:789) IBM.Watson.DeveloperCloud.Connection.c__Iterator0:MoveNext() (at Assets/Watson/Scripts/Connection/WSConnector.cs:286) IBM.Watson.DeveloperCloud.Utilities.Routine:MoveNext() (at Assets/Watson/Scripts/Utilities/Runnable.cs:128) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
Answer by SolidVirtual · Mar 01, 2018 at 11:12 AM
I have the same problem with spanish (es-ES_BroadbandModel). Any help?
Answer by redmage0602 · Mar 15, 2018 at 04:44 AM
I have the same problem with ja-JP_BroadbandModel. Anyone know?
Answer by Static-Dynamo · Mar 19, 2018 at 07:05 PM
Same exact issue. Here's where mine pops up
Line 791 of SpeechToText.cs
else if (json.Contains("error"))
{
string error = (string)json["error"];
Log.Error("SpeechToText.OnListenMessage()", "Error: {0}", error);
StopListening();
if (OnError != null)
OnError(error);
}
And here's an image of my inspection of json when I hit my breakpoints, it says "Children could not be evaluated"
Edit#2 Providing keywords to _speechToText.Keywords in the ExampleStreaming.cs seems to resolve this issue.
However it does occur if no keywords are provided. So still a bug, but this should allow you work around it for now.
Answer by missamarakay · May 18, 2018 at 05:11 PM
This should have been cleared up with the latest SDK version in the asset store. Can you download the newest version and try again?