1 line
2.0 KiB
JavaScript
1 line
2.0 KiB
JavaScript
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var r in t){var i=t[r];i.configurable=!0,i.value&&(i.writable=!0)}Object.defineProperties(e,t)}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),r=function p(e,t,r){var i=Object.getOwnPropertyDescriptor(e,t);if(void 0===i){var n=Object.getPrototypeOf(e);return null===n?void 0:p(n,t,r)}if("value"in i&&i.writable)return i.value;var a=i.get;if(void 0!==a)return a.call(r)},i=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=e(require("uuid")),s=e(require("./asr-vars")),u=e(require("./resource-base")),o=require("events").EventEmitter,c=function(e){function o(e){n(this,o),r(Object.getPrototypeOf(o.prototype),"constructor",this).call(this),this.name=a.v4(),e=e||{},this.bargein=e.bargein||!0,this.incremental=e.incremental||!1,this.timeout=0,this.authenticateSpeaker=e.authenticateSpeaker||"",this.speakerId=!0,this.nbest=e.nbest||1,e.path?this.path=u+e.path:this.path=u+"nuance_curlmulti";var t=this.path.split("/");this.name=t[t.length-1]+"-"+this.name,s.idToRecognizer[this.name]=this}return i(o,e),t(o,{setPath:{value:function(e){this.path=u+e}},toString:{value:function(){return this.pack()}},pack:{value:function(){var e={name:this.name,path:this.path,bargein:this.bargein,nbest:this.nbest,speaker_name:this.authenticateSpeaker,speaker_id:this.speakerId,incremental:this.incremental};return e=JSON.stringify(e)}},onResult:{value:function(e){if(e.utterances&&e.utterances.length>0){var t={speaker_ids:e.speaker_ids,speaker_idstatus:e.speaker_idstatus};this.emit("result",e.utterances[0],t)}else{var t={speaker_ids:e.speaker_ids,speaker_idstatus:e.speaker_idstatus};this.emit("result","",t)}}}}),o}(o);module.exports=c; |