Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

FieldStatistics.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2004 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010 */
00011 
00012 
00013 //
00014 // FieldStatistics
00015 //
00016 // 4 February 2004 -- tds
00017 //
00018 
00019 #ifndef INDRI_FIELDSTATISTICS_HPP
00020 #define INDRI_FIELDSTATISTICS_HPP
00021 
00022 namespace indri {
00023   namespace index {
00024     struct FieldStatistics {
00025       FieldStatistics( const std::string& _name, bool numeric )
00026         :
00027         name(_name),
00028         isNumeric(numeric),
00029         totalCount(0),
00030         documentCount(0),
00031         lastDocument(0),
00032         lastCount(0)
00033       {
00034       }
00035 
00036       FieldStatistics( const std::string& _name, bool numeric, INT64 _totalCount, int _documentCount )
00037         :
00038         name(_name),
00039         isNumeric(numeric),
00040         totalCount(_totalCount),
00041         documentCount(_documentCount),
00042         lastDocument(0),
00043         lastCount(0) {
00044       }
00045 
00046       void addOccurrence( int documentID ) {
00047         if( documentID != lastDocument ) {
00048           lastCount = 0;
00049           lastDocument = documentID;
00050           documentCount++;
00051         }
00052 
00053         totalCount++;
00054         lastCount++;
00055       }
00056       
00057       std::string name;
00058       bool isNumeric;
00059       INT64 totalCount;
00060       int documentCount;
00061 
00062       int lastDocument;
00063       int lastCount;
00064     };
00065   }
00066 }
00067 
00068 #endif // INDRI_FIELDSTATISTICS_HPP
00069 

Generated on Wed Nov 3 12:58:55 2004 for Lemur Toolkit by doxygen1.2.18