使用phonegap进行连续语音识别 [英] Continuous speech recognition with phonegap

查看:184
本文介绍了使用phonegap进行连续语音识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Android和IOS中通过连续语音识别在phonegap中创建应用。我的应用程序应该等待用户语音,当他/她说下一步时,应用程序应该更新屏幕并执行一些操作。

I want to create app in phonegap with continuous speech recognition in Android and IOS. My app should wait for user voice and when he/she say "next", app should update screen and do some actions.

我找到了这个插件: https://github.com / macdonst / SpeechRecognitionPlugin ,它的工作速度非常快。但是在语音识别开始并且没有语音几秒钟后,语音识别器停止。是否有像isSpeechRecognizerAlive或任何其他解决方案的任何方法或标志?或者是否可以将其作为服务运行?

I find this plugin: https://github.com/macdonst/SpeechRecognitionPlugin and it works really fast. But after few seconds after voice recognition is started and there is no voice, speech recogniser stops. Is there any method or flag like isSpeechRecognizerAlive or any other solution? Or is it possible to run it as a service?

我也想知道IOS上有类似的插件以及如何管理它:)

I'm also wondering that is there similar plugin on IOS and how to manage it :)

推荐答案

此插件基于此处的Web Speech API( https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples
例3&您发出的4个地址

This plugin is based on Web Speech API located here (https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples) Example 3 & 4 addresses you issue with


recognition.continuous = true

recognition.continuous = true



<textarea id="textarea" rows=10 cols=80></textarea>
  <button id="button" onclick="toggleStartStop()"></button>

  <script type="text/javascript">
    var recognizing;
    var recognition = new SpeechRecognition();
    recognition.continuous = true;
    reset();
    recognition.onend = reset;

    recognition.onresult = function (event) {
      for (var i = resultIndex; i < event.results.length; ++i) {
        if (event.results.final) {
          textarea.value += event.results[i][0].transcript;
        }
      }
    }

    function reset() {
      recognizing = false;
      button.innerHTML = "Click to Speak";
    }

    function toggleStartStop() {
      if (recognizing) {
        recognition.stop();
        reset();
      } else {
        recognition.start();
        recognizing = true;
        button.innerHTML = "Click to Stop";
      }
    }
  </script>

此外还有另一个插件可以在此处进行连续语音识别

Also there is another plugin which does the continuous Speech recognition located here


https://github.com/daao87/ContinuousSpeechRecognizer

但有些问题尚未解决。虽然效果很好(在Lollipop 5.1上测试)

But is has some issues not solved yet. Though it works great (tested on Lollipop 5.1)

这篇关于使用phonegap进行连续语音识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆