bayes/ScoredWord.h

00001 /*----------------------------------------------------------------
00002  * project ....: bayes-irc
00003  * authors ....: shino
00004  * creation ...: 2004-10-26
00005  * revision ...: $Id: ScoredWord.h 13 2006-10-07 12:30:53Z shin0 $
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 } // namespace Bayes
00067 #endif

Generated on Sat Feb 10 21:32:39 2007 for bayes-irc by  doxygen 1.5.1