"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sentiment = void 0;
// @ts-ignore
const sentiment_1 = __importDefault(require("sentiment"));
class Sentiment {
    constructor() {
        this.analyzer = new sentiment_1.default();
    }
    analyze(text) {
        const result = this.analyzer.analyze(text);
        return {
            score: result.score,
            comparative: result.comparative,
            positive: result.positive,
            negative: result.negative,
            tokens: result.tokens,
            words: result.words,
        };
    }
    getSentimentLabel(text) {
        const result = this.analyze(text);
        if (result.score > 0)
            return 'positive';
        if (result.score < 0)
            return 'negative';
        return 'neutral';
    }
    getScore(text) {
        return this.analyze(text).score;
    }
    summarize(text) {
        const result = this.analyze(text);
        return {
            sentiment: this.getSentimentLabel(text),
            score: result.score,
            comparative: result.comparative,
            positiveWords: result.positive,
            negativeWords: result.negative,
        };
    }
}
exports.Sentiment = Sentiment;
