watson-developer-cloud / unity-sdk

:video_game: Unity SDK to use the IBM Watson services.
Apache License 2.0
571 stars 206 forks source link

Cannot find SpechResultList library #187

Closed doanhtai00 closed 7 years ago

doanhtai00 commented 7 years ago

Hi. I cannot find SpeechResultList import on file for function SpeechToText. Please help me. Thanks.

Miojo commented 7 years ago

change it to SpeechRecognitionEvent instead. If you are trying to make the speech to texto tutorial work, also change the variables to lower case:

void HandleOnRecognize(SpeechRecognitionEvent result)

{
    if (result != null && result.results.Length > 0)
    {
        foreach (var res in result.results)
        {
            foreach (var alt in res.alternatives)
            {
                string text = alt.transcript;
                Debug.Log(string.Format("{0} ({1}, {2:0.00})\n", text, res.final ? "Final" : "Interim", alt.confidence));
            }
        }
    }
}
mediumTaj commented 7 years ago

@doanhtai00 Were you able to resolve the issue?

Joshua-Carr commented 7 years ago

The above fix resolved the same problems I was facing.

For others: the examples/scripts/ folders show the SpeechRecognitionEvent and not SpeechResultList as found in the readme

mediumTaj commented 7 years ago

Thanks, tracking here

https://github.com/watson-developer-cloud/unity-sdk/issues/216

daphna-kaplan commented 7 years ago

hey I am having similar issue the SpeechResultList and the SpeechResult are not recognized and I dont know how to replace them the function is : protected void OnSpeechToTextResult(SpeechResultList results) { if (results.HasResult()) { SpeechResult watsonResult = results.Results[0]; var textResult = m_WatsonSpeechToTextComponent.CreateSpeechToTextResult(watsonResult); if (m_OnTextResult != null) { m_OnTextResult(textResult); } m_LastResult = textResult; } }