1 |
- {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar _asyncToGenerator = require(\"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SpeakerRecognizer = void 0;\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\n/**\n * Defines SpeakerRecognizer class for Speaker Recognition\n * Handles operations from user for Voice Profile operations (e.g. createProfile, deleteProfile)\n * @class SpeakerRecognizer\n */\nclass SpeakerRecognizer extends Exports_js_2.Recognizer {\n /**\n * Initializes an instance of the SpeakerRecognizer.\n * @constructor\n * @param {SpeechConfig} speechConfig - The set of configuration properties.\n * @param {AudioConfig} audioConfig - An optional audio input config associated with the recognizer\n */\n constructor(speechConfig, audioConfig) {\n Contracts_js_1.Contracts.throwIfNullOrUndefined(speechConfig, \"speechConfig\");\n const configImpl = speechConfig;\n Contracts_js_1.Contracts.throwIfNullOrUndefined(configImpl, \"speechConfig\");\n super(audioConfig, configImpl.properties, new Exports_js_1.SpeakerRecognitionConnectionFactory());\n this.privAudioConfigImpl = audioConfig;\n Contracts_js_1.Contracts.throwIfNull(this.privAudioConfigImpl, \"audioConfig\");\n this.privDisposedSpeakerRecognizer = false;\n this.privProperties = configImpl.properties;\n }\n /**\n * Gets the authorization token used to communicate with the service.\n * @member SpeakerRecognizer.prototype.authorizationToken\n * @function\n * @public\n * @returns {string} Authorization token.\n */\n get authorizationToken() {\n return this.properties.getProperty(Exports_js_2.PropertyId.SpeechServiceAuthorization_Token);\n }\n /**\n * Gets/Sets the authorization token used to communicate with the service.\n * @member SpeakerRecognizer.prototype.authorizationToken\n * @function\n * @public\n * @param {string} token - Authorization token.\n */\n set authorizationToken(token) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceAuthorization_Token, token);\n }\n /**\n * The collection of properties and their values defined for this SpeakerRecognizer.\n * @member SpeakerRecognizer.prototype.properties\n * @function\n * @public\n * @returns {PropertyCollection} The collection of properties and their values defined for this SpeakerRecognizer.\n */\n get properties() {\n return this.privProperties;\n }\n /**\n * Get recognition result for model using given audio\n * @member SpeakerRecognizer.prototype.recognizeOnceAsync\n * @function\n * @public\n * @async\n * @param {SpeakerIdentificationModel | SpeakerVerificationModel} model Model containing Voice Profiles to be identified\n * @param cb - Callback invoked once result is returned.\n * @param err - Callback invoked in case of an error.\n */\n recognizeOnceAsync(model) {\n var _this = this;\n return _asyncToGenerator(function* () {\n Contracts_js_1.Contracts.throwIfDisposed(_this.privDisposedSpeakerRecognizer);\n return _this.recognizeSpeakerOnceAsyncImpl(model);\n })();\n }\n /**\n * Included for compatibility\n * @member SpeakerRecognizer.prototype.close\n * @function\n * @public\n * @async\n */\n close() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n Contracts_js_1.Contracts.throwIfDisposed(_this2.privDisposedSpeakerRecognizer);\n yield _this2.dispose(true);\n })();\n }\n recognizeSpeakerOnceAsyncImpl(model) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n Contracts_js_1.Contracts.throwIfDisposed(_this3.privDisposedSpeakerRecognizer);\n yield _this3.implRecognizerStop();\n const result = yield _this3.privReco.recognizeSpeaker(model);\n yield _this3.implRecognizerStop();\n return result;\n })();\n }\n implRecognizerStop() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n if (_this4.privReco) {\n yield _this4.privReco.stopRecognizing();\n }\n return;\n })();\n }\n createRecognizerConfig(speechConfig) {\n return new Exports_js_1.RecognizerConfig(speechConfig, this.privProperties);\n }\n createServiceRecognizer(authentication, connectionFactory, audioConfig, recognizerConfig) {\n const audioImpl = audioConfig;\n return new Exports_js_1.SpeakerServiceRecognizer(authentication, connectionFactory, audioImpl, recognizerConfig, this);\n }\n dispose(disposing) {\n var _superprop_getDispose = () => super.dispose,\n _this5 = this;\n return _asyncToGenerator(function* () {\n if (_this5.privDisposedSpeakerRecognizer) {\n return;\n }\n if (disposing) {\n _this5.privDisposedSpeakerRecognizer = true;\n yield _superprop_getDispose().call(_this5, disposing);\n }\n })();\n }\n}\nexports.SpeakerRecognizer = SpeakerRecognizer;","map":{"version":3,"names":["_asyncToGenerator","require","default","Object","defineProperty","exports","value","SpeakerRecognizer","Exports_js_1","Contracts_js_1","Exports_js_2","Recognizer","constructor","speechConfig","audioConfig","Contracts","throwIfNullOrUndefined","configImpl","properties","SpeakerRecognitionConnectionFactory","privAudioConfigImpl","throwIfNull","privDisposedSpeakerRecognizer","privProperties","authorizationToken","getProperty","PropertyId","SpeechServiceAuthorization_Token","token","throwIfNullOrWhitespace","setProperty","recognizeOnceAsync","model","_this","throwIfDisposed","recognizeSpeakerOnceAsyncImpl","close","_this2","dispose","_this3","implRecognizerStop","result","privReco","recognizeSpeaker","_this4","stopRecognizing","createRecognizerConfig","RecognizerConfig","createServiceRecognizer","authentication","connectionFactory","recognizerConfig","audioImpl","SpeakerServiceRecognizer","disposing","_superprop_getDispose","_this5","call"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/SpeakerRecognizer.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SpeakerRecognizer = void 0;\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\n/**\n * Defines SpeakerRecognizer class for Speaker Recognition\n * Handles operations from user for Voice Profile operations (e.g. createProfile, deleteProfile)\n * @class SpeakerRecognizer\n */\nclass SpeakerRecognizer extends Exports_js_2.Recognizer {\n /**\n * Initializes an instance of the SpeakerRecognizer.\n * @constructor\n * @param {SpeechConfig} speechConfig - The set of configuration properties.\n * @param {AudioConfig} audioConfig - An optional audio input config associated with the recognizer\n */\n constructor(speechConfig, audioConfig) {\n Contracts_js_1.Contracts.throwIfNullOrUndefined(speechConfig, \"speechConfig\");\n const configImpl = speechConfig;\n Contracts_js_1.Contracts.throwIfNullOrUndefined(configImpl, \"speechConfig\");\n super(audioConfig, configImpl.properties, new Exports_js_1.SpeakerRecognitionConnectionFactory());\n this.privAudioConfigImpl = audioConfig;\n Contracts_js_1.Contracts.throwIfNull(this.privAudioConfigImpl, \"audioConfig\");\n this.privDisposedSpeakerRecognizer = false;\n this.privProperties = configImpl.properties;\n }\n /**\n * Gets the authorization token used to communicate with the service.\n * @member SpeakerRecognizer.prototype.authorizationToken\n * @function\n * @public\n * @returns {string} Authorization token.\n */\n get authorizationToken() {\n return this.properties.getProperty(Exports_js_2.PropertyId.SpeechServiceAuthorization_Token);\n }\n /**\n * Gets/Sets the authorization token used to communicate with the service.\n * @member SpeakerRecognizer.prototype.authorizationToken\n * @function\n * @public\n * @param {string} token - Authorization token.\n */\n set authorizationToken(token) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.properties.setProperty(Exports_js_2.PropertyId.SpeechServiceAuthorization_Token, token);\n }\n /**\n * The collection of properties and their values defined for this SpeakerRecognizer.\n * @member SpeakerRecognizer.prototype.properties\n * @function\n * @public\n * @returns {PropertyCollection} The collection of properties and their values defined for this SpeakerRecognizer.\n */\n get properties() {\n return this.privProperties;\n }\n /**\n * Get recognition result for model using given audio\n * @member SpeakerRecognizer.prototype.recognizeOnceAsync\n * @function\n * @public\n * @async\n * @param {SpeakerIdentificationModel | SpeakerVerificationModel} model Model containing Voice Profiles to be identified\n * @param cb - Callback invoked once result is returned.\n * @param err - Callback invoked in case of an error.\n */\n async recognizeOnceAsync(model) {\n Contracts_js_1.Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer);\n return this.recognizeSpeakerOnceAsyncImpl(model);\n }\n /**\n * Included for compatibility\n * @member SpeakerRecognizer.prototype.close\n * @function\n * @public\n * @async\n */\n async close() {\n Contracts_js_1.Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer);\n await this.dispose(true);\n }\n async recognizeSpeakerOnceAsyncImpl(model) {\n Contracts_js_1.Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer);\n await this.implRecognizerStop();\n const result = await this.privReco.recognizeSpeaker(model);\n await this.implRecognizerStop();\n return result;\n }\n async implRecognizerStop() {\n if (this.privReco) {\n await this.privReco.stopRecognizing();\n }\n return;\n }\n createRecognizerConfig(speechConfig) {\n return new Exports_js_1.RecognizerConfig(speechConfig, this.privProperties);\n }\n createServiceRecognizer(authentication, connectionFactory, audioConfig, recognizerConfig) {\n const audioImpl = audioConfig;\n return new Exports_js_1.SpeakerServiceRecognizer(authentication, connectionFactory, audioImpl, recognizerConfig, this);\n }\n async dispose(disposing) {\n if (this.privDisposedSpeakerRecognizer) {\n return;\n }\n if (disposing) {\n this.privDisposedSpeakerRecognizer = true;\n await super.dispose(disposing);\n }\n }\n}\nexports.SpeakerRecognizer = SpeakerRecognizer;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AAAA,IAAAA,iBAAA,GAAAC,OAAA,qGAAAC,OAAA;AACAC,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,iBAAiB,GAAG,KAAK,CAAC;AAClC,MAAMC,YAAY,GAAGP,OAAO,CAAC,6BAA6B,CAAC;AAC3D,MAAMQ,cAAc,GAAGR,OAAO,CAAC,gBAAgB,CAAC;AAChD,MAAMS,YAAY,GAAGT,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA,MAAMM,iBAAiB,SAASG,YAAY,CAACC,UAAU,CAAC;EACpD;AACJ;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,YAAY,EAAEC,WAAW,EAAE;IACnCL,cAA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