55d4c104ea2a6cf695fb6eb02205e3c5aedf762feab9902fcaf16db947ce2a93.json 12 KB

1
  1. {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SpeakerRecognitionCancellationDetails = exports.SpeakerRecognitionResult = exports.SpeakerRecognitionResultType = void 0;\n/* eslint-disable max-classes-per-file */\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\nvar SpeakerRecognitionResultType;\n(function (SpeakerRecognitionResultType) {\n SpeakerRecognitionResultType[SpeakerRecognitionResultType[\"Verify\"] = 0] = \"Verify\";\n SpeakerRecognitionResultType[SpeakerRecognitionResultType[\"Identify\"] = 1] = \"Identify\";\n})(SpeakerRecognitionResultType = exports.SpeakerRecognitionResultType || (exports.SpeakerRecognitionResultType = {}));\n/**\n * Output format\n * @class SpeakerRecognitionResult\n */\nclass SpeakerRecognitionResult {\n constructor(response, resultReason = Exports_js_2.ResultReason.RecognizedSpeaker, cancellationErrorCode = Exports_js_2.CancellationErrorCode.NoError, errorDetails = \"\") {\n this.privProperties = new Exports_js_2.PropertyCollection();\n const resultType = response.scenario === \"TextIndependentIdentification\" ? SpeakerRecognitionResultType.Identify : SpeakerRecognitionResultType.Verify;\n this.privReason = resultReason;\n if (this.privReason !== Exports_js_2.ResultReason.Canceled) {\n if (resultType === SpeakerRecognitionResultType.Identify) {\n this.privProfileId = response.identificationResult.identifiedProfile.profileId;\n this.privScore = response.identificationResult.identifiedProfile.score;\n this.privReason = Exports_js_2.ResultReason.RecognizedSpeakers;\n } else {\n this.privScore = response.verificationResult.score;\n if (response.verificationResult.recognitionResult.toLowerCase() !== \"accept\") {\n this.privReason = Exports_js_2.ResultReason.NoMatch;\n }\n if (response.verificationResult.profileId !== undefined && response.verificationResult.profileId !== \"\") {\n this.privProfileId = response.verificationResult.profileId;\n }\n }\n } else {\n this.privErrorDetails = errorDetails;\n this.privProperties.setProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[cancellationErrorCode]);\n }\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceResponse_JsonResult, JSON.stringify(response));\n }\n get properties() {\n return this.privProperties;\n }\n get reason() {\n return this.privReason;\n }\n get profileId() {\n return this.privProfileId;\n }\n get errorDetails() {\n return this.privErrorDetails;\n }\n get score() {\n return this.privScore;\n }\n}\nexports.SpeakerRecognitionResult = SpeakerRecognitionResult;\n/**\n * @class SpeakerRecognitionCancellationDetails\n */\nclass SpeakerRecognitionCancellationDetails extends Exports_js_2.CancellationDetailsBase {\n constructor(reason, errorDetails, errorCode) {\n super(reason, errorDetails, errorCode);\n }\n /**\n * Creates an instance of SpeakerRecognitionCancellationDetails object for the canceled SpeakerRecognitionResult\n * @member SpeakerRecognitionCancellationDetails.fromResult\n * @function\n * @public\n * @param {SpeakerRecognitionResult} result - The result that was canceled.\n * @returns {SpeakerRecognitionCancellationDetails} The cancellation details object being created.\n */\n static fromResult(result) {\n const reason = Exports_js_2.CancellationReason.Error;\n let errorCode = Exports_js_2.CancellationErrorCode.NoError;\n if (!!result.properties) {\n errorCode = Exports_js_2.CancellationErrorCode[result.properties.getProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[Exports_js_2.CancellationErrorCode.NoError])];\n }\n return new SpeakerRecognitionCancellationDetails(reason, result.errorDetails, errorCode);\n }\n}\nexports.SpeakerRecognitionCancellationDetails = SpeakerRecognitionCancellationDetails;","map":{"version":3,"names":["Object","defineProperty","exports","value","SpeakerRecognitionCancellationDetails","SpeakerRecognitionResult","SpeakerRecognitionResultType","Exports_js_1","require","Exports_js_2","constructor","response","resultReason","ResultReason","RecognizedSpeaker","cancellationErrorCode","CancellationErrorCode","NoError","errorDetails","privProperties","PropertyCollection","resultType","scenario","Identify","Verify","privReason","Canceled","privProfileId","identificationResult","identifiedProfile","profileId","privScore","score","RecognizedSpeakers","verificationResult","recognitionResult","toLowerCase","NoMatch","undefined","privErrorDetails","setProperty","CancellationErrorCodePropertyName","PropertyId","SpeechServiceResponse_JsonResult","JSON","stringify","properties","reason","CancellationDetailsBase","errorCode","fromResult","result","CancellationReason","Error","getProperty"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/SpeakerRecognitionResult.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.SpeakerRecognitionCancellationDetails = exports.SpeakerRecognitionResult = exports.SpeakerRecognitionResultType = void 0;\n/* eslint-disable max-classes-per-file */\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\nvar SpeakerRecognitionResultType;\n(function (SpeakerRecognitionResultType) {\n SpeakerRecognitionResultType[SpeakerRecognitionResultType[\"Verify\"] = 0] = \"Verify\";\n SpeakerRecognitionResultType[SpeakerRecognitionResultType[\"Identify\"] = 1] = \"Identify\";\n})(SpeakerRecognitionResultType = exports.SpeakerRecognitionResultType || (exports.SpeakerRecognitionResultType = {}));\n/**\n * Output format\n * @class SpeakerRecognitionResult\n */\nclass SpeakerRecognitionResult {\n constructor(response, resultReason = Exports_js_2.ResultReason.RecognizedSpeaker, cancellationErrorCode = Exports_js_2.CancellationErrorCode.NoError, errorDetails = \"\") {\n this.privProperties = new Exports_js_2.PropertyCollection();\n const resultType = response.scenario === \"TextIndependentIdentification\" ? SpeakerRecognitionResultType.Identify : SpeakerRecognitionResultType.Verify;\n this.privReason = resultReason;\n if (this.privReason !== Exports_js_2.ResultReason.Canceled) {\n if (resultType === SpeakerRecognitionResultType.Identify) {\n this.privProfileId = response.identificationResult.identifiedProfile.profileId;\n this.privScore = response.identificationResult.identifiedProfile.score;\n this.privReason = Exports_js_2.ResultReason.RecognizedSpeakers;\n }\n else {\n this.privScore = response.verificationResult.score;\n if (response.verificationResult.recognitionResult.toLowerCase() !== \"accept\") {\n this.privReason = Exports_js_2.ResultReason.NoMatch;\n }\n if (response.verificationResult.profileId !== undefined && response.verificationResult.profileId !== \"\") {\n this.privProfileId = response.verificationResult.profileId;\n }\n }\n }\n else {\n this.privErrorDetails = errorDetails;\n this.privProperties.setProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[cancellationErrorCode]);\n }\n this.privProperties.setProperty(Exports_js_2.PropertyId.SpeechServiceResponse_JsonResult, JSON.stringify(response));\n }\n get properties() {\n return this.privProperties;\n }\n get reason() {\n return this.privReason;\n }\n get profileId() {\n return this.privProfileId;\n }\n get errorDetails() {\n return this.privErrorDetails;\n }\n get score() {\n return this.privScore;\n }\n}\nexports.SpeakerRecognitionResult = SpeakerRecognitionResult;\n/**\n * @class SpeakerRecognitionCancellationDetails\n */\nclass SpeakerRecognitionCancellationDetails extends Exports_js_2.CancellationDetailsBase {\n constructor(reason, errorDetails, errorCode) {\n super(reason, errorDetails, errorCode);\n }\n /**\n * Creates an instance of SpeakerRecognitionCancellationDetails object for the canceled SpeakerRecognitionResult\n * @member SpeakerRecognitionCancellationDetails.fromResult\n * @function\n * @public\n * @param {SpeakerRecognitionResult} result - The result that was canceled.\n * @returns {SpeakerRecognitionCancellationDetails} The cancellation details object being created.\n */\n static fromResult(result) {\n const reason = Exports_js_2.CancellationReason.Error;\n let errorCode = Exports_js_2.CancellationErrorCode.NoError;\n if (!!result.properties) {\n errorCode = Exports_js_2.CancellationErrorCode[result.properties.getProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[Exports_js_2.CancellationErrorCode.NoError])];\n }\n return new SpeakerRecognitionCancellationDetails(reason, result.errorDetails, errorCode);\n }\n}\nexports.SpeakerRecognitionCancellationDetails = SpeakerRecognitionCancellationDetails;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAAC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