Spaces:
Sleeping
Sleeping
| 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(); | |
| }; | |