所以我在谷歌浏览器中有这个代码:
var recognition = null;
$(document).ready(function(){
recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.onresult = function(event){
// delve into words detected results & get the latest
// total results detected
var resultsLength = event.results.length;
// get length of latest results
var ArrayLength = event.results[resultsLength-1].length;
// get last word detected
var saidWord = event.results[resultsLength-1][ArrayLength-1].transcript;
console.log("***"+saidWord+",");
}
//don't forget to start the recognition!
recognition.start();
});
当我从1到10计数时,我在控制台中看到了这一点:
*** 012345678910,
当我说"两个......七"时,我在控制台中看到了这一点:
*** 27
当我说"二十七"时,我在控制台中看到了这一点:
*** 27
为什么检测到的数字没有分隔?
对于以上三种情况,我想看看:
*** 0,1,2,3,4,5,6,7,8,9,10,
*** 2,7
*** 27
我试图在这里连续发言中检测数字......