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.PronunciationAssessmentResult = exports.ContentAssessmentResult = void 0;\n/* eslint-disable max-classes-per-file */\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst Exports_js_1 = require(\"./Exports.js\");\nclass ContentAssessmentResult {\n /**\n * @Internal\n * Do not use externally.\n */\n constructor(detailResult) {\n this.privPronJson = detailResult;\n }\n /**\n * Correctness in using grammar and variety of sentence patterns.\n * Grammatical errors are jointly evaluated by lexical accuracy,\n * grammatical accuracy and diversity of sentence structures.\n * @member ContentAssessmentResult.prototype.grammarScore\n * @function\n * @public\n * @returns {number} Grammar score.\n */\n get grammarScore() {\n return this.privPronJson.ContentAssessment.GrammarScore;\n }\n /**\n * Proficiency in lexical usage. It evaluates the speaker's effective usage\n * of words and their appropriateness within the given context to express\n * ideas accurately, as well as level of lexical complexity.\n * @member ContentAssessmentResult.prototype.vocabularyScore\n * @function\n * @public\n * @returns {number} Vocabulary score.\n */\n get vocabularyScore() {\n return this.privPronJson.ContentAssessment.VocabularyScore;\n }\n /**\n * Level of understanding and engagement with the topic, which provides\n * insights into the speaker’s ability to express their thoughts and ideas\n * effectively and the ability to engage with the topic.\n * @member ContentAssessmentResult.prototype.topicScore\n * @function\n * @public\n * @returns {number} Topic score.\n */\n get topicScore() {\n return this.privPronJson.ContentAssessment.TopicScore;\n }\n}\nexports.ContentAssessmentResult = ContentAssessmentResult;\n/**\n * Pronunciation assessment results.\n * @class PronunciationAssessmentResult\n * Added in version 1.15.0.\n */\nclass PronunciationAssessmentResult {\n constructor(jsonString) {\n const j = JSON.parse(jsonString);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(j.NBest[0], \"NBest\");\n this.privPronJson = j.NBest[0];\n }\n /**\n * @member PronunciationAssessmentResult.fromResult\n * @function\n * @public\n * @param {RecognitionResult} result The recognition result.\n * @return {PronunciationAssessmentConfig} Instance of PronunciationAssessmentConfig\n * @summary Creates an instance of the PronunciationAssessmentResult from recognition result.\n */\n static fromResult(result) {\n Contracts_js_1.Contracts.throwIfNullOrUndefined(result, \"result\");\n const json = result.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_JsonResult);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(json, \"json\");\n return new PronunciationAssessmentResult(json);\n }\n /**\n * Gets the detail result of pronunciation assessment.\n * @member PronunciationAssessmentConfig.prototype.detailResult\n * @function\n * @public\n * @returns {DetailResult} detail result.\n */\n get detailResult() {\n return this.privPronJson;\n }\n /**\n * The score indicating the pronunciation accuracy of the given speech, which indicates\n * how closely the phonemes match a native speaker's pronunciation.\n * @member PronunciationAssessmentResult.prototype.accuracyScore\n * @function\n * @public\n * @returns {number} Accuracy score.\n */\n get accuracyScore() {\n var _this$detailResult$Pr;\n return (_this$detailResult$Pr = this.detailResult.PronunciationAssessment) === null || _this$detailResult$Pr === void 0 ? void 0 : _this$detailResult$Pr.AccuracyScore;\n }\n /**\n * The overall score indicating the pronunciation quality of the given speech.\n * This is calculated from AccuracyScore, FluencyScore and CompletenessScore with weight.\n * @member PronunciationAssessmentResult.prototype.pronunciationScore\n * @function\n * @public\n * @returns {number} Pronunciation score.\n */\n get pronunciationScore() {\n var _this$detailResult$Pr2;\n return (_this$detailResult$Pr2 = this.detailResult.PronunciationAssessment) === null || _this$detailResult$Pr2 === void 0 ? void 0 : _this$detailResult$Pr2.PronScore;\n }\n /**\n * The score indicating the completeness of the given speech by calculating the ratio of pronounced words towards entire input.\n * @member PronunciationAssessmentResult.prototype.completenessScore\n * @function\n * @public\n * @returns {number} Completeness score.\n */\n get completenessScore() {\n var _this$detailResult$Pr3;\n return (_this$detailResult$Pr3 = this.detailResult.PronunciationAssessment) === null || _this$detailResult$Pr3 === void 0 ? void 0 : _this$detailResult$Pr3.CompletenessScore;\n }\n /**\n * The score indicating the fluency of the given speech.\n * @member PronunciationAssessmentResult.prototype.fluencyScore\n * @function\n * @public\n * @returns {number} Fluency score.\n */\n get fluencyScore() {\n var _this$detailResult$Pr4;\n return (_this$detailResult$Pr4 = this.detailResult.PronunciationAssessment) === null || _this$detailResult$Pr4 === void 0 ? void 0 : _this$detailResult$Pr4.FluencyScore;\n }\n /**\n * The prosody score, which indicates how nature of the given speech, including stress, intonation, speaking speed and rhythm.\n * @member PronunciationAssessmentResult.prototype.prosodyScore\n * @function\n * @public\n * @returns {number} Prosody score.\n */\n get prosodyScore() {\n var _this$detailResult$Pr5;\n return (_this$detailResult$Pr5 = this.detailResult.PronunciationAssessment) === null || _this$detailResult$Pr5 === void 0 ? void 0 : _this$detailResult$Pr5.ProsodyScore;\n }\n /**\n * The concent assessment result.\n * Only available when content assessment is enabled.\n * @member PronunciationAssessmentResult.prototype.contentAssessmentResult\n * @function\n * @public\n * @returns {ContentAssessmentResult} Content assessment result.\n */\n get contentAssessmentResult() {\n if (this.detailResult.ContentAssessment === undefined) {\n return undefined;\n }\n return new ContentAssessmentResult(this.detailResult);\n }\n}\nexports.PronunciationAssessmentResult = PronunciationAssessmentResult;","map":{"version":3,"names":["Object","defineProperty","exports","value","PronunciationAssessmentResult","ContentAssessmentResult","Contracts_js_1","require","Exports_js_1","constructor","detailResult","privPronJson","grammarScore","ContentAssessment","GrammarScore","vocabularyScore","VocabularyScore","topicScore","TopicScore","jsonString","j","JSON","parse","Contracts","throwIfNullOrUndefined","NBest","fromResult","result","json","properties","getProperty","PropertyId","SpeechServiceResponse_JsonResult","accuracyScore","_this$detailResult$Pr","PronunciationAssessment","AccuracyScore","pronunciationScore","_this$detailResult$Pr2","PronScore","completenessScore","_this$detailResult$Pr3","CompletenessScore","fluencyScore","_this$detailResult$Pr4","FluencyScore","prosodyScore","_this$detailResult$Pr5","ProsodyScore","contentAssessmentResult","undefined"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/PronunciationAssessmentResult.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.PronunciationAssessmentResult = exports.ContentAssessmentResult = void 0;\n/* eslint-disable max-classes-per-file */\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst Exports_js_1 = require(\"./Exports.js\");\nclass ContentAssessmentResult {\n /**\n * @Internal\n * Do not use externally.\n */\n constructor(detailResult) {\n this.privPronJson = detailResult;\n }\n /**\n * Correctness in using grammar and variety of sentence patterns.\n * Grammatical errors are jointly evaluated by lexical accuracy,\n * grammatical accuracy and diversity of sentence structures.\n * @member ContentAssessmentResult.prototype.grammarScore\n * @function\n * @public\n * @returns {number} Grammar score.\n */\n get grammarScore() {\n return this.privPronJson.ContentAssessment.GrammarScore;\n }\n /**\n * Proficiency in lexical usage. It evaluates the speaker's effective usage\n * of words and their appropriateness within the given context to express\n * ideas accurately, as well as level of lexical complexity.\n * @member ContentAssessmentResult.prototype.vocabularyScore\n * @function\n * @public\n * @returns {number} Vocabulary score.\n */\n get vocabularyScore() {\n return this.privPronJson.ContentAssessment.VocabularyScore;\n }\n /**\n * Level of understanding and engagement with the topic, which provides\n * insights into the speaker’s ability to express their thoughts and ideas\n * effectively and the ability to engage with the topic.\n * @member ContentAssessmentResult.prototype.topicScore\n * @function\n * @public\n * @returns {number} Topic score.\n */\n get topicScore() {\n return this.privPronJson.ContentAssessment.TopicScore;\n }\n}\nexports.ContentAssessmentResult = ContentAssessmentResult;\n/**\n * Pronunciation assessment results.\n * @class PronunciationAssessmentResult\n * Added in version 1.15.0.\n */\nclass PronunciationAssessmentResult {\n constructor(jsonString) {\n const j = JSON.parse(jsonString);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(j.NBest[0], \"NBest\");\n this.privPronJson = j.NBest[0];\n }\n /**\n * @member PronunciationAssessmentResult.fromResult\n * @function\n * @public\n * @param {RecognitionResult} result The recognition result.\n * @return {PronunciationAssessmentConfig} Instance of PronunciationAssessmentConfig\n * @summary Creates an instance of the PronunciationAssessmentResult from recognition result.\n */\n static fromResult(result) {\n Contracts_js_1.Contracts.throwIfNullOrUndefined(result, \"result\");\n const json = result.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_JsonResult);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(json, \"json\");\n return new PronunciationAssessmentResult(json);\n }\n /**\n * Gets the detail result of pronunciation assessment.\n * @member PronunciationAssessmentConfig.prototype.detailResult\n * @function\n * @public\n * @returns {DetailResult} detail result.\n */\n get detailResult() {\n return this.privPronJson;\n }\n /**\n * The score indicating the pronunciation accuracy of the given speech, which indicates\n * how closely the phonemes match a native speaker's pronunciation.\n * @member PronunciationAssessmentResult.prototype.accuracyScore\n * @function\n * @public\n * @returns {number} Accuracy score.\n */\n get accuracyScore() {\n return this.detailResult.PronunciationAssessment?.AccuracyScore;\n }\n /**\n * The overall score indicating the pronunciation quality of the given speech.\n * This is calculated from AccuracyScore, FluencyScore and CompletenessScore with weight.\n * @member PronunciationAssessmentResult.prototype.pronunciationScore\n * @function\n * @public\n * @returns {number} Pronunciation score.\n */\n get pronunciationScore() {\n return this.detailResult.PronunciationAssessment?.PronScore;\n }\n /**\n * The score indicating the completeness of the given speech by calculating the ratio of pronounced words towards entire input.\n * @member PronunciationAssessmentResult.prototype.completenessScore\n * @function\n * @public\n * @returns {number} Completeness score.\n */\n get completenessScore() {\n return this.detailResult.PronunciationAssessment?.CompletenessScore;\n }\n /**\n * The score indicating the fluency of the given speech.\n * @member PronunciationAssessmentResult.prototype.fluencyScore\n * @function\n * @public\n * @returns {number} Fluency score.\n */\n get fluencyScore() {\n return this.detailResult.PronunciationAssessment?.FluencyScore;\n }\n /**\n * The prosody score, which indicates how nature of the given speech, including stress, intonation, speaking speed and rhythm.\n * @member PronunciationAssessmentResult.prototype.prosodyScore\n * @function\n * @public\n * @returns {number} Prosody score.\n */\n get prosodyScore() {\n return this.detailResult.PronunciationAssessment?.ProsodyScore;\n }\n /**\n * The concent assessment result.\n * Only available when content assessment is enabled.\n * @member PronunciationAssessmentResult.prototype.contentAssessmentResult\n * @function\n * @public\n * @returns {ContentAssessmentResult} Content assessment result.\n */\n get contentAssessmentResult() {\n if (this.detailResult.ContentAssessment === undefined) {\n return undefined;\n }\n return new ContentAssessmentResult(this.detailResult);\n }\n}\nexports.PronunciationAssessmentResult = PronunciationAssessmentResult;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,6BAA6B,GAAGF,OAAO,CAACG,uBAAuB,GAAG,KAAK,CAAC;AAChF;AACA,MAAMC,cAAc,GAAGC,OAAO,CAAC,gBAAgB,CAAC;AAChD,MAAMC,YAAY,GAAGD,OAAO,CAAC,cAAc,CAAC;AAC5C,MAAMF,uBAAuB,CAAC;EAC1B;AACJ;AACA;AACA;EACII,WAAWA,CAACC,YAAY,EAAE;IACtB,IAAI,CAACC,YAAY,GAAGD,YAAY;EACpC;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,IAAIE,YAAYA,CAAA,EAAG;IACf,OAAO,IAAI,CAACD,YAAY,CAACE,iBAAiB,CAACC,YAAY;EAC3D;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,IAAIC,eAAeA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACJ,YAAY,CAACE,iBAAiB,CAACG,eAAe;EAC9D;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,IAAIC,UAAUA,CAAA,EAAG;IACb,OAAO,IAAI,CAACN,YAAY,CAACE,iBAAiB,CAACK,UAAU;EACzD;AACJ;AACAhB,OAAO,CAACG,uBAAuB,GAAGA,uBAAuB;AACzD;AACA;AACA;AACA;AACA;AACA,MAAMD,6BAA6B,CAAC;EAChCK,WAAWA,CAACU,U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BAAA;IACpB,QAAAA,sBAAA,GAAO,IAAI,CAAC/B,YAAY,CAACyB,uBAAuB,cAAAM,sBAAA,uBAAzCA,sBAAA,CAA2CC,iBAAiB;EACvE;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,IAAIC,YAAYA,CAAA,EAAG;IAAA,IAAAC,sBAAA;IACf,QAAAA,sBAAA,GAAO,IAAI,CAAClC,YAAY,CAACyB,uBAAuB,cAAAS,sBAAA,uBAAzCA,sBAAA,CAA2CC,YAAY;EAClE;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,IAAIC,YAAYA,CAAA,EAAG;IAAA,IAAAC,sBAAA;IACf,QAAAA,sBAAA,GAAO,IAAI,CAACrC,YAAY,CAACyB,uBAAuB,cAAAY,sBAAA,uBAAzCA,sBAAA,CAA2CC,YAAY;EAClE;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACI,IAAIC,uBAAuBA,CAAA,EAAG;IAC1B,IAAI,IAAI,CAACvC,YAAY,CAACG,iBAAiB,KAAKqC,SAAS,EAAE;MACnD,OAAOA,SAAS;IACpB;IACA,OAAO,IAAI7C,uBAAuB,CAAC,IAAI,CAACK,YAAY,CAAC;EACzD;AACJ;AACAR,OAAO,CAACE,6BAA6B,GAAGA,6BAA6B","ignoreList":[]},"metadata":{},"sourceType":"script","externalDependencies":[]}
|