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 // TermFieldStatistics 00015 // 00016 // 4 February 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_TERMFIELDSTATISTICS_HPP 00020 #define INDRI_TERMFIELDSTATISTICS_HPP 00021 00022 #include "lemur-compat.hpp" 00023 00024 namespace indri { 00025 namespace index { 00026 struct TermFieldStatistics { 00027 TermFieldStatistics() : totalCount(0), documentCount(0), lastDocument(0), lastCount(0) {} 00028 00030 INT64 totalCount; 00031 00033 unsigned int documentCount; 00034 00036 unsigned int lastDocument; 00037 00039 unsigned int lastCount; 00040 00041 void addOccurrence( int documentID ) { 00042 if( lastDocument != documentID ) { 00043 lastDocument = documentID; 00044 lastCount = 0; 00045 documentCount++; 00046 } 00047 00048 totalCount++; 00049 lastCount++; 00050 } 00051 }; 00052 } 00053 } 00054 00055 #endif // INDRI_TERMFIELDSTATISTICS_HPP 00056