Pocketsphinx.js是一个在浏览器上通过纯JavaScript实现语音识别的功能,支持Chrome和Firefox浏览器。提供录音的功能。
特性:
100%纯JavaScriptAPI,
可通过WebWorkers录制
支持PocketSphinx所支持的所有声音模型
支持大多数PocketSphinx的命令行参数
支持JavaScript有限状态语法FSG输入
支持在编译时的来自文件的统计语言模型
支持键盘监测
可用于实时识别的可选音频录制库
示例代码:
var array = ... // array that contains an audio buffervar buffer = new Module.AudioBuffer();for (var i = 0 ; i < array.length ; i++) buffer.push_back(array[i]); // Feed the array with audio datavar output = recognizer.start(); // Starts recognition on current language modeloutput = recognizer.process(buffer); // Processes the buffervar hyp = recognizer.getHyp(); // Gets the current recognized string (hypothesis)/* ... */for (var i = 0 ; i < array.length ; i++) buffer.set(i, array[i]); // Feed buffer with new dataoutput = recognizer.process(buffer);hyp = recognizer.getHyp();/* ... */output = recognizer.stop();// Gets the final recognized string:var final_hyp = recognizer.getHyp();buffer.delete();在线演示:https://syl22-00.github.io/pocketsphinx.js/live-demo-chinese.html
评论