2023-11-11 15:29:31 -06:00
|
|
|
#ifndef FILTER_HPP
|
|
|
|
#define FILTER_HPP
|
|
|
|
|
2023-11-11 21:05:36 -06:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
enum MessageType {
|
|
|
|
kSpam = 0,
|
|
|
|
kHam = 1,
|
|
|
|
kUnknown = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SMSMessage {
|
|
|
|
SMSMessage(MessageType given_type, std::string given_message);
|
|
|
|
MessageType actual_type;
|
|
|
|
std::string message;
|
|
|
|
MessageType filter_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SMSMessageFilter {
|
2023-11-11 15:29:31 -06:00
|
|
|
public:
|
2023-11-11 21:05:36 -06:00
|
|
|
SMSMessageFilter(void) = default;
|
|
|
|
~SMSMessageFilter(void) = default;
|
|
|
|
void GenerateProbability(std::string file_name);
|
|
|
|
void Filter(std::string file_name);
|
|
|
|
void PrintReport(void);
|
2023-11-11 15:29:31 -06:00
|
|
|
|
|
|
|
private:
|
2023-11-11 21:05:36 -06:00
|
|
|
double sentence_probability_ham = 0.5; // Spam is 1 - sentence_probability_ham
|
|
|
|
std::map<std::string, double> probability_dictionary;
|
|
|
|
std::vector<SMSMessage> filtered_messages;
|
2023-11-11 15:29:31 -06:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !FILTER_HPP
|