31 lines
No EOL
888 B
JavaScript
31 lines
No EOL
888 B
JavaScript
"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
|