{"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.DetailedSpeechPhrase = void 0;\nconst Exports_js_1 = require(\"../Exports.js\");\nclass DetailedSpeechPhrase {\n constructor(json) {\n this.privDetailedSpeechPhrase = JSON.parse(json);\n this.privDetailedSpeechPhrase.RecognitionStatus = Exports_js_1.RecognitionStatus[this.privDetailedSpeechPhrase.RecognitionStatus];\n }\n static fromJSON(json) {\n return new DetailedSpeechPhrase(json);\n }\n getJsonWithCorrectedOffsets(baseOffset) {\n if (!!this.privDetailedSpeechPhrase.NBest) {\n let firstWordOffset;\n for (const phrase of this.privDetailedSpeechPhrase.NBest) {\n if (!!phrase.Words && !!phrase.Words[0]) {\n firstWordOffset = phrase.Words[0].Offset;\n break;\n }\n }\n if (!!firstWordOffset && firstWordOffset < baseOffset) {\n const offset = baseOffset - firstWordOffset;\n for (const details of this.privDetailedSpeechPhrase.NBest) {\n if (!!details.Words) {\n for (const word of details.Words) {\n word.Offset += offset;\n }\n }\n if (!!details.DisplayWords) {\n for (const word of details.DisplayWords) {\n word.Offset += offset;\n }\n }\n }\n }\n }\n return JSON.stringify(this.privDetailedSpeechPhrase);\n }\n get RecognitionStatus() {\n return this.privDetailedSpeechPhrase.RecognitionStatus;\n }\n get NBest() {\n return this.privDetailedSpeechPhrase.NBest;\n }\n get Duration() {\n return this.privDetailedSpeechPhrase.Duration;\n }\n get Offset() {\n return this.privDetailedSpeechPhrase.Offset;\n }\n get Language() {\n return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Language;\n }\n get LanguageDetectionConfidence() {\n return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence;\n }\n get Text() {\n if (!!this.privDetailedSpeechPhrase.NBest && this.privDetailedSpeechPhrase.NBest[0]) {\n return this.privDetailedSpeechPhrase.NBest[0].Display || this.privDetailedSpeechPhrase.NBest[0].DisplayText;\n }\n return this.privDetailedSpeechPhrase.DisplayText;\n }\n get SpeakerId() {\n return this.privDetailedSpeechPhrase.SpeakerId;\n }\n}\nexports.DetailedSpeechPhrase = DetailedSpeechPhrase;","map":{"version":3,"names":["Object","defineProperty","exports","value","DetailedSpeechPhrase","Exports_js_1","require","constructor","json","privDetailedSpeechPhrase","JSON","parse","RecognitionStatus","fromJSON","getJsonWithCorrectedOffsets","baseOffset","NBest","firstWordOffset","phrase","Words","Offset","offset","details","word","DisplayWords","stringify","Duration","Language","PrimaryLanguage","undefined","LanguageDetectionConfidence","Confidence","Text","Display","DisplayText","SpeakerId"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/DetailedSpeechPhrase.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.DetailedSpeechPhrase = void 0;\nconst Exports_js_1 = require(\"../Exports.js\");\nclass DetailedSpeechPhrase {\n constructor(json) {\n this.privDetailedSpeechPhrase = JSON.parse(json);\n this.privDetailedSpeechPhrase.RecognitionStatus = Exports_js_1.RecognitionStatus[this.privDetailedSpeechPhrase.RecognitionStatus];\n }\n static fromJSON(json) {\n return new DetailedSpeechPhrase(json);\n }\n getJsonWithCorrectedOffsets(baseOffset) {\n if (!!this.privDetailedSpeechPhrase.NBest) {\n let firstWordOffset;\n for (const phrase of this.privDetailedSpeechPhrase.NBest) {\n if (!!phrase.Words && !!phrase.Words[0]) {\n firstWordOffset = phrase.Words[0].Offset;\n break;\n }\n }\n if (!!firstWordOffset && firstWordOffset < baseOffset) {\n const offset = baseOffset - firstWordOffset;\n for (const details of this.privDetailedSpeechPhrase.NBest) {\n if (!!details.Words) {\n for (const word of details.Words) {\n word.Offset += offset;\n }\n }\n if (!!details.DisplayWords) {\n for (const word of details.DisplayWords) {\n word.Offset += offset;\n }\n }\n }\n }\n }\n return JSON.stringify(this.privDetailedSpeechPhrase);\n }\n get RecognitionStatus() {\n return this.privDetailedSpeechPhrase.RecognitionStatus;\n }\n get NBest() {\n return this.privDetailedSpeechPhrase.NBest;\n }\n get Duration() {\n return this.privDetailedSpeechPhrase.Duration;\n }\n get Offset() {\n return this.privDetailedSpeechPhrase.Offset;\n }\n get Language() {\n return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Language;\n }\n get LanguageDetectionConfidence() {\n return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence;\n }\n get Text() {\n if (!!this.privDetailedSpeechPhrase.NBest && this.privDetailedSpeechPhrase.NBest[0]) {\n return this.privDetailedSpeechPhrase.NBest[0].Display || this.privDetailedSpeechPhrase.NBest[0].DisplayText;\n }\n return this.privDetailedSpeechPhrase.DisplayText;\n }\n get SpeakerId() {\n return this.privDetailedSpeechPhrase.SpeakerId;\n }\n}\nexports.DetailedSpeechPhrase = DetailedSpeechPhrase;\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,oBAAoB,GAAG,KAAK,CAAC;AACrC,MAAMC,YAAY,GAAGC,OAAO,CAAC,eAAe,CAAC;AAC7C,MAAMF,oBAAoB,CAAC;EACvBG,WAAWA,CAACC,IAAI,EAAE;IACd,IAAI,CAACC,wBAAwB,GAAGC,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;IAChD,IAAI,CAACC,wBAAwB,CAACG,iBAAiB,GAAGP,YAAY,CAACO,iBAAiB,CAAC,IAAI,CAACH,wBAAwB,CAACG,iBAAiB,CAAC;EACrI;EACA,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