00001 /****************************************************************************** 00002 IrstLM: IRST Language Model Toolkit 00003 Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 ******************************************************************************/ 00020 00021 // Normalization factors cache 00022 00023 class normcache{ 00024 dictionary* dict; 00025 ngramtable *ngt; 00026 double* cache[2]; 00027 int cachesize[2]; 00028 int maxcache[2]; 00029 int hit; 00030 int miss; 00031 00032 public: 00033 normcache(dictionary* d); 00034 ~normcache(){ 00035 delete [] cache[0];delete [] cache[1]; delete ngt;} 00036 00037 void expand(int i); 00038 double get(ngram ng,int size,double& value); 00039 double put(ngram ng,int size,double value); 00040 void stat(); 00041 };
1.5.9