00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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