简体   繁体   中英

Continuous speech recognition with 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.

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?

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

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

<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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM