UNPKG

botbuilder-core

Version:

Core components for Microsoft Bot Builder. Components in this library can run either in a browser or on the server.

31 lines 888 B
"use strict"; /** * @module botbuilder */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getTopScoringIntent = void 0; const getTopScoringIntent = (result) => { var _a; if (!result || !result.intents) { throw new Error('result is empty'); } let topIntent = ''; let topScore = -1; for (const [intentName, intent] of Object.entries(result.intents)) { const score = (_a = intent.score) !== null && _a !== void 0 ? _a : -1; if (!topIntent || score > topScore) { topIntent = intentName; topScore = score; } } return { intent: topIntent, score: topScore, }; }; exports.getTopScoringIntent = getTopScoringIntent; //# sourceMappingURL=recognizerResult.js.map