00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SCOREDWORD_HPP__
00009 #define SCOREDWORD_HPP__
00010
00011 #include <utility>
00012 #include <cmath>
00013 #include <string>
00014
00015 using namespace std;
00016
00017 namespace Bayes {
00018
00024 class ScoredWord {
00025 public:
00026
00030 ScoredWord(void) {};
00031
00038 ScoredWord(const char* text, double s = 0.0) : word(text), score(s) {};
00039
00047 ScoredWord(const string& text, double s = 0.0) : word(text), score(s) {};
00048
00057 inline bool operator<(const ScoredWord& w) const {
00058 return (abs(0.5 - score) < abs(0.5 - w.score));
00059 }
00060
00061 public:
00062 string word;
00063 double score;
00064 };
00065
00066 }
00067 #endif