1***@163.com
1***@163.com
  • 发布:2017-07-26 17:19
  • 更新:2017-07-26 22:01
  • 阅读:2311

怎么才能让mui集成的语音识别功能只识别数字

分类:MUI
2017-07-26 17:19 负责人:无 分享
已邀请:
lhyh

lhyh - 目前就职成都

识别到了结果之后,对识别结果进行正则匹配,从识别结果中截取数字

  • 1***@163.com (作者)

    怎么才能拿到结果?通过什么函数或方法?

    2017-07-26 18:20

lhyh

lhyh - 目前就职成都

function startRecognize() {  
    if(plus.os.name=='Android'&&navigator.userAgent.indexOf('StreamApp')>0){  
        plus.nativeUI.toast('当前环境暂不支持语音识别插件');  
        return;  
    }  
    var options = {};  
    options.engine = 'iFly';  
    //options.punctuation = false;  // 是否需要标点符号   

    plus.speech.startRecognize( options, function ( s ) {  

        alert("语音识别结果"+s);  
                 //do sth here  
    }, function ( e ) {  
        alert( "语音识别失败:"+e.message );  
    } );  
}
  • 1***@163.com (作者)

    我是这样写的可是没有起到作用 是不是因为我引用了mui.min.js文件?

    2017-07-27 09:03

该问题目前已经被锁定, 无法添加新回复