UNPKG

@euirim/microsoft-cognitiveservices-speech-sdk

Version:
33 lines (31 loc) 1.21 kB
"use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", { value: true }); /** * Represents the JSON used in the speech.context message sent to the speech service. * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object. */ var SpeechContext = /** @class */ (function () { function SpeechContext(dynamicGrammar) { this.privContext = {}; this.privDynamicGrammar = dynamicGrammar; } /** * Adds a section to the speech.context object. * @param sectionName Name of the section to add. * @param value JSON serializeable object that represents the value. */ SpeechContext.prototype.setSection = function (sectionName, value) { this.privContext[sectionName] = value; }; SpeechContext.prototype.toJSON = function () { var dgi = this.privDynamicGrammar.generateGrammarObject(); this.setSection("dgi", dgi); var ret = JSON.stringify(this.privContext); return ret; }; return SpeechContext; }()); exports.SpeechContext = SpeechContext; //# sourceMappingURL=SpeechContext.js.map