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

TermCache.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2003 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 // TermCache
00015 //
00016 // 19 September 2003 - tds
00017 //
00018 
00019 #ifndef _LEMUR_TERMCACHE_HPP
00020 #define _LEMUR_TERMCACHE_HPP
00021 
00022 #define TERMCACHE_MAX_TERM_LENGTH 12
00023 #define TERMCACHE_SIZE    (64 * 1024 * 1024)
00024 #define TERMCACHE_BUCKETS (TERMCACHE_SIZE/16)
00027 class TermCache {
00028 public:
00029   TermCache();
00031   void add( const char* term, int termID );
00033   int find( const char* term ) const;
00035   void clear();
00036 
00037 private:
00038   int _hashFunction( const char* term ) const;
00039 
00040   struct cache_entry {
00041     char term[TERMCACHE_MAX_TERM_LENGTH];
00042     int id;
00043   };
00044 
00045   struct cache_entry _termCache[ TERMCACHE_SIZE / sizeof (struct cache_entry) ];
00046 };
00047 
00048 #endif // _LEMUR_TERMCACHE_HPP

Generated on Wed Nov 3 12:59:05 2004 for Lemur Toolkit by doxygen1.2.18