#ifndef FILTER_HPP #define FILTER_HPP #include #include #include // C++ maps don't allow specifying default value struct DoubleDefaultedToHalf { double value = 0.5; }; struct ReportData { double spam_precision; double spam_recall; double ham_precision; double ham_recall; double spam_f_score; double ham_f_score; double accuracy; }; struct SMSMessage { SMSMessage(bool given_type, std::string given_message); bool is_ham; std::string message; bool is_ham_filter; }; class SMSMessageFilter { public: SMSMessageFilter(void) = default; ~SMSMessageFilter(void) = default; bool is_generator_defined = false; bool is_input_defined = false; void GenerateProbability(); void Prepare(); void Filter(void); void Report(void); void ReadArguments(int argc, char* argv[]); private: double sentence_probability_ham = 0.2; // Sentence is spam if < this value std::map probability_dictionary; std::string generation_file_path; std::string filter_file_path; std::vector filtered_messages; ReportData GenerateReport(void); void PrintReport(ReportData report); }; std::string SanitizeToken(std::string token); void PrintHelp(void); #endif // !FILTER_HPP