如何检测语音到文本中的句子检测是否已完成(Unity IBM Watson sdk)?

weijia_yu

我想在每次检测完句子后将其发送到服务器。

例如,当检测到我说“我该怎么办”。我想将此句子发送到服务器。但是,以下方法在每次尝试组成句子时都会被调用。例如,当我说“我该怎么做”时,它会打印“如何”,“怎么做”,“我怎么做”,是否有一个我可以知道句子结束的地方?

private void OnRecognize(SpeechRecognitionEvent result)
{
    m_ResultOutput.SendData(new SpeechToTextData(result));

    if (result != null && result.results.Length > 0)
    {
        if (m_Transcript != null)
             m_Transcript.text = "";

        foreach (var res in result.results)
        {
            foreach (var alt in res.alternatives)
            {
                string text = alt.transcript;

                if (m_Transcript != null)
                {
                        //   print(text);

                        //m_Transcript.text += string.Format("{0} ({1}, {2:0.00})\n",
                        //    text, res.final ? "Final" : "Interim", alt.confidence);

                        m_Transcript.text = text;
                }
            }       
        }   
    }
}
泰姬陵

final响应对象中有一个属性。

private void OnRecognize(SpeechRecognitionEvent result)
{
    m_ResultOutput.SendData(new SpeechToTextData(result));

    if (result != null && result.results.Length > 0)
    {
        if (m_Transcript != null)
             m_Transcript.text = "";

        foreach (var res in result.results)
        {
            foreach (var alt in res.alternatives)
            {
                string text = alt.transcript;

                if (m_Transcript != null)
                {
                    // print(text);

                    //m_Transcript.text += string.Format("{0} ({1}, {2:0.00})\n",
                    //  text, res.final ? "Final" : "Interim", alt.confidence);

                    if(res.final)
                    {
                        m_Transcript.text = text;
                        //  do something with the final transcription
                    }
                }
            }       
        }   
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在IBM Watson unity SDK中获取时间戳

IBM Watson语音到文本仅使用Java SDK返回第一个单词

IBM Watson语音转文本:无法使用Swift SDK转录文本

使用WebSockets的IBM Watson语音到文本

IBM Watson API Java SDK使用Watson令牌认证失败

IBM Watson NLC-如何在Java SDK中重新训练现有分类器

我们如何使用java sdk在IBM Watson Assistant中创建插槽?

IBM Watson中的跳转错误

IBM Watson Unity 3D SDK保护服务(即将运行!)

尝试在 SDK 中验证/初始化 IBM Watson 服务时出现语法错误

将WAV录制到IBM Watson语音到文本

找不到version.properties文件IBM watson bot sdk

导入Pycharm时,IBM Watson的Python SDK错误

IBM Watson:如何向 Watson Responses 添加超链接?

IBM Watson 问答系统中的对话

Powershell 中的 IBM Watson 视觉识别

IBM Watson Assistant 中的数字比较

如何解决 IBM Watson 中的 com.ibm.watson.developer_cloud.service.exception.NotFoundException?

IBM Watson语音对文本的单词置信度差异

您好,我如何使用 IBM Watson 对话显示使用 IBM Watson 链接到 facebook messenger 的图像?

语音到文本Ibm Watson C#的语音,长音频超过100 MB

Anaconda与IBM Watson Studio

如何使用 IBM watson 情感分析分析任何文本

IBM Watson Assistant,如何从数组中删除多个项目?

Flutter中的IBM Watson Assistant:如何显示选项?

如何在 IBM Watson Studio 中获得“键盘输入”?

对于Watson的语音转文本Unity SDK,如何指定关键字?

IBM Watson语音到文本发送麦克风数据关闭了连接

使用ibm-watson服务C#进行语音到文本