Spaces:
Sleeping
Sleeping
File size: 800 Bytes
8540cd1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
#ifndef SENTIMENT_ANALYZER_HPP
#define SENTIMENT_ANALYZER_HPP
#include <string>
#include <vector>
#include <map>
#include <string_view>
class SentimentAnalyzer {
public:
SentimentAnalyzer();
/**
* @brief Analyzes the sentiment of the given text.
*
* @param text The input text to analyze.
* @return double A score between -1.0 (negative) and 1.0 (positive).
*/
double analyze(std::string_view text) const;
/**
* @brief Tokenizes the input text into words.
*
* @param text The input text.
* @return std::vector<std::string> List of tokens.
*/
std::vector<std::string> tokenize(std::string_view text) const;
private:
std::map<std::string, double> lexicon;
void loadLexicon();
};
#endif // SENTIMENT_ANALYZER_HPP
|