speech recognition

webkitSpeechRecognition

natural language



demo


API

  • webkitSpeechRecognition
  • continuous
  • interimResults
  • start/stop()

var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.lang = 'zh-Hans';
...
recognition.start();
...
recognition.stop();

Events

start / result / error / end

recognition.onresult = onRecognitionResult;

function onRecognitionResult(event){
    for(var i=0; i<event.results.length; i++){
        var result = event.results[i];
        console.log('result[i] = ' + result[0].transcript);
        console.log('confidence = ' + result[0].confidence);
        console.log('is final ? ' + result.isFinal);
    }
}

Browser Support


Chrome Only

extend


Made with Slides.com