我想知道是否可以在node.js中运行Web Speech API?由于节点是基于Javascript的,我假设它可以使用,但我找不到在节点中本地使用它的方法。是否有办法在node.js脚本中“包含”此Web语音库以使用它?
谢谢
答案 0 :(得分:4)
虽然您无法在Node中使用WebSpeechAPI(因为它是内置的浏览器功能),但您可以使用Google Cloud Speech或具有Node SDK的许多其他云识别器之一。
如果您正在寻找处理所有音频编码并支持离线热门词检测的超轻量级实现,我建议Sonus。
免责声明:这是我的项目
答案 1 :(得分:0)
您可以尝试WSNR npm module,但这需要运行Chrome浏览器。
答案 2 :(得分:-2)
<强> Demo.JS 强>
angular.module('PubNubAngularApp', ["pubnub.angular.service"])
.controller('MySpeechCtrl', function($rootScope, $scope, Pubnub) {
$scope.theText = "Don't just stand there, say something!";
$scope.dictateIt = function () {
$scope.theText = "";
var recognition = new webkitSpeechRecognition();
recognition.onresult = function (event) {
$scope.$apply(function() {
for (var i = event.resultIndex; i < event.results.length; i++) {
if (event.results[i].isFinal) {
$scope.theText += event.results[i][0].transcript;
}
}
});
};
recognition.start();
};
});
指向codepen.io演示的链接
Here是您的完整套餐。