00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00041 #ifndef _CDOCUMENTFREQUENCYELEMENT
00042 #define _CDOCUMENTFREQUENCYELEMENT
00043 #include "libGIFTAcInvertedFile/include/uses-declarations.h"
00044 #include <iostream>
00045 #include <functional>
00046 #include "libMRML/include/TID.h"
00047
00049 class CDocumentFrequencyElement{
00050 struct{
00052 TID mID;
00054 float mDocumentFrequency;
00055 } mContent;
00056 public:
00064 CDocumentFrequencyElement();
00065
00073 CDocumentFrequencyElement(TID inID,
00074 float inDocumentFrequency);
00075
00081 CDocumentFrequencyElement(istream& inStream);
00082
00088 CDocumentFrequencyElement(const CDocumentFrequencyElement& inElement);
00089
00096
00099
00101 bool input(istream& inStream);
00102
00108 bool output(ostream& outStream)const;
00109
00115 bool writeBinary(ostream& outStream)const;
00116
00118
00126 TID getID()const;
00127
00133 unsigned int getIntegerDocumentFrequency()const;
00134
00140 float getDocumentFrequency()const;
00141
00147 void setDocumentFrequency(float);
00148
00154 void divideDocumentFrequency(float);
00155
00157
00158 };
00159
00160
00169 class CSortByID_DFE:
00170 public binary_function
00171 <CDocumentFrequencyElement,CDocumentFrequencyElement,bool>{
00172 public:
00174 inline bool operator()(const CDocumentFrequencyElement& l,
00175 const CDocumentFrequencyElement& t){
00176 return l.getID()<t.getID();
00177 }
00178 };
00179
00180
00181
00189 class CSortByDocumentFrequency_DFE:
00190 public binary_function
00191 <CDocumentFrequencyElement,CDocumentFrequencyElement,bool>{
00192 public:
00194 inline bool operator()(const CDocumentFrequencyElement& l,
00195 const CDocumentFrequencyElement& t){
00196 return t.getDocumentFrequency()<l.getDocumentFrequency();
00197 }
00198 };
00199
00200 #endif
00201
00202