@euirim/microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 2.69 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/NoMatchDetails.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AAE1H;;;GAGG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,UAAU,CAAgB;IAElC;;;;OAIG;IACH,OAAO;IAIP;;;;;;;;OAQG;WACW,UAAU,CAAC,MAAM,EAAE,uBAAuB,GAAG,uBAAuB,GAAG,4BAA4B,GAAG,cAAc;IAoBlI;;;;;;OAMG;aACQ,MAAM,EAAI,aAAa;CAGrC","file":"NoMatchDetails.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { RecognitionStatus, SimpleSpeechPhrase } from \"../../src/common.speech/Exports\";\nimport { IntentRecognitionResult, NoMatchReason, SpeechRecognitionResult, TranslationRecognitionResult } from \"./Exports\";\n\n/**\n * Contains detailed information for NoMatch recognition results.\n * @class NoMatchDetails\n */\nexport class NoMatchDetails {\n private privReason: NoMatchReason;\n\n /**\n * Creates and initializes an instance of this class.\n * @constructor\n * @param {NoMatchReason} reason - The no-match reason.\n */\n private constructor(reason: NoMatchReason) {\n this.privReason = reason;\n }\n\n /**\n * Creates an instance of NoMatchDetails object for the NoMatch SpeechRecognitionResults.\n * @member NoMatchDetails.fromResult\n * @function\n * @public\n * @param {SpeechRecognitionResult | IntentRecognitionResult | TranslationRecognitionResult}\n * result - The recognition result that was not recognized.\n * @returns {NoMatchDetails} The no match details object being created.\n */\n public static fromResult(result: SpeechRecognitionResult | IntentRecognitionResult | TranslationRecognitionResult): NoMatchDetails {\n const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json);\n\n let reason: NoMatchReason = NoMatchReason.NotRecognized;\n\n switch (simpleSpeech.RecognitionStatus) {\n case RecognitionStatus.BabbleTimeout:\n reason = NoMatchReason.InitialBabbleTimeout;\n break;\n case RecognitionStatus.InitialSilenceTimeout:\n reason = NoMatchReason.InitialSilenceTimeout;\n break;\n default:\n reason = NoMatchReason.NotRecognized;\n break;\n }\n\n return new NoMatchDetails(reason);\n }\n\n /**\n * The reason the recognition was canceled.\n * @member NoMatchDetails.prototype.reason\n * @function\n * @public\n * @returns {NoMatchReason} Specifies the reason canceled.\n */\n public get reason(): NoMatchReason {\n return this.privReason;\n }\n}\n"]}