052235c8647b3316aebfabb49d143913404a6f4407f5841b2782da53bed396bf.json 8.0 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.SynthesisContext = void 0;\nconst Exports_js_1 = require(\"../sdk/Exports.js\");\n/**\n * Represents the JSON used in the synthesis.context message sent to the speech service.\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\n */\nclass SynthesisContext {\n constructor() {\n this.privContext = {};\n }\n /**\n * Adds a section to the synthesis.context object.\n * @param sectionName Name of the section to add.\n * @param value JSON serializable object that represents the value.\n */\n setSection(sectionName, value) {\n this.privContext[sectionName] = value;\n }\n /**\n * Sets the audio output format for synthesis context generation.\n * @param format {AudioOutputFormatImpl} the output format\n */\n set audioOutputFormat(format) {\n this.privAudioOutputFormat = format;\n }\n toJSON() {\n return JSON.stringify(this.privContext);\n }\n setSynthesisSection(speechSynthesizer) {\n const synthesisSection = this.buildSynthesisContext(speechSynthesizer);\n this.setSection(\"synthesis\", synthesisSection);\n }\n buildSynthesisContext(speechSynthesizer) {\n return {\n audio: {\n metadataOptions: {\n bookmarkEnabled: !!(speechSynthesizer !== null && speechSynthesizer !== void 0 && speechSynthesizer.bookmarkReached),\n punctuationBoundaryEnabled: speechSynthesizer === null || speechSynthesizer === void 0 ? void 0 : speechSynthesizer.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_RequestPunctuationBoundary, !!(speechSynthesizer !== null && speechSynthesizer !== void 0 && speechSynthesizer.wordBoundary)),\n sentenceBoundaryEnabled: speechSynthesizer === null || speechSynthesizer === void 0 ? void 0 : speechSynthesizer.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_RequestSentenceBoundary, false),\n sessionEndEnabled: true,\n visemeEnabled: !!(speechSynthesizer !== null && speechSynthesizer !== void 0 && speechSynthesizer.visemeReceived),\n wordBoundaryEnabled: speechSynthesizer === null || speechSynthesizer === void 0 ? void 0 : speechSynthesizer.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_RequestWordBoundary, !!(speechSynthesizer !== null && speechSynthesizer !== void 0 && speechSynthesizer.wordBoundary))\n },\n outputFormat: this.privAudioOutputFormat.requestAudioFormatString\n },\n language: {\n autoDetection: speechSynthesizer === null || speechSynthesizer === void 0 ? void 0 : speechSynthesizer.autoDetectSourceLanguage\n }\n };\n }\n}\nexports.SynthesisContext = SynthesisContext;","map":{"version":3,"names":["Object","defineProperty","exports","value","SynthesisContext","Exports_js_1","require","constructor","privContext","setSection","sectionName","audioOutputFormat","format","privAudioOutputFormat","toJSON","JSON","stringify","setSynthesisSection","speechSynthesizer","synthesisSection","buildSynthesisContext","audio","metadataOptions","bookmarkEnabled","bookmarkReached","punctuationBoundaryEnabled","properties","getProperty","PropertyId","SpeechServiceResponse_RequestPunctuationBoundary","wordBoundary","sentenceBoundaryEnabled","SpeechServiceResponse_RequestSentenceBoundary","sessionEndEnabled","visemeEnabled","visemeReceived","wordBoundaryEnabled","SpeechServiceResponse_RequestWordBoundary","outputFormat","requestAudioFormatString","language","autoDetection","autoDetectSourceLanguage"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/SynthesisContext.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.SynthesisContext = void 0;\nconst Exports_js_1 = require(\"../sdk/Exports.js\");\n/**\n * Represents the JSON used in the synthesis.context message sent to the speech service.\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\n */\nclass SynthesisContext {\n constructor() {\n this.privContext = {};\n }\n /**\n * Adds a section to the synthesis.context object.\n * @param sectionName Name of the section to add.\n * @param value JSON serializable object that represents the value.\n */\n setSection(sectionName, value) {\n this.privContext[sectionName] = value;\n }\n /**\n * Sets the audio output format for synthesis context generation.\n * @param format {AudioOutputFormatImpl} the output format\n */\n set audioOutputFormat(format) {\n this.privAudioOutputFormat = format;\n }\n toJSON() {\n return JSON.stringify(this.privContext);\n }\n setSynthesisSection(speechSynthesizer) {\n const synthesisSection = this.buildSynthesisContext(speechSynthesizer);\n this.setSection(\"synthesis\", synthesisSection);\n }\n buildSynthesisContext(speechSynthesizer) {\n return {\n audio: {\n metadataOptions: {\n bookmarkEnabled: (!!speechSynthesizer?.bookmarkReached),\n punctuationBoundaryEnabled: speechSynthesizer?.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_RequestPunctuationBoundary, (!!speechSynthesizer?.wordBoundary)),\n sentenceBoundaryEnabled: speechSynthesizer?.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_RequestSentenceBoundary, false),\n sessionEndEnabled: true,\n visemeEnabled: (!!speechSynthesizer?.visemeReceived),\n wordBoundaryEnabled: speechSynthesizer?.properties.getProperty(Exports_js_1.PropertyId.SpeechServiceResponse_RequestWordBoundary, (!!speechSynthesizer?.wordBoundary)),\n },\n outputFormat: this.privAudioOutputFormat.requestAudioFormatString,\n },\n language: {\n autoDetection: speechSynthesizer?.autoDetectSourceLanguage\n }\n };\n }\n}\nexports.SynthesisContext = SynthesisContext;\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,gBAAgB,GAAG,KAAK,CAAC;AACjC,MAAMC,YAAY,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AACjD;AACA;AACA;AACA;AACA,MAAMF,gBAAgB,CAAC;EACnBG,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,WAAW,GAAG,CAAC,CAAC;EACzB;EACA;AACJ;AACA;AACA;AACA;EACIC,UAAUA,CAACC,WAAW,EAAEP,KAAK,EAAE;IAC3B,IAAI,CAACK,WAAW,CAACE,WAA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