"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PredictionProcessor = exports.Intent = void 0;
var Intent = /** @class */ (function () {
    function Intent(label, confidence) {
        this.label = label;
        this.confidence = confidence;
    }
    return Intent;
}());
exports.Intent = Intent;
var PredictionProcessor = /** @class */ (function () {
    function PredictionProcessor(classes) {
        this.classes = classes;
    }
    PredictionProcessor.prototype.process = function (prediction) {
        var confidences = prediction.arraySync()[0];
        var intents = this.createIntents(confidences);
        return this.sortIntentsByConfidence(intents);
    };
    PredictionProcessor.prototype.createIntents = function (confidences) {
        var _this = this;
        return confidences.map(function (confidence, idx) { return new Intent(_this.classes[idx], confidence); });
    };
    PredictionProcessor.prototype.sortIntentsByConfidence = function (intents) {
        return intents.sort(function (a, b) { return (a.confidence > b.confidence ? -1 : 1); });
    };
    return PredictionProcessor;
}());
exports.PredictionProcessor = PredictionProcessor;
//# sourceMappingURL=prediction-processor.js.map