/usr/include/irstlm/interplm.h is in libirstlm-dev 5.80.03-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | /******************************************************************************
IrstLM: IRST Language Model Toolkit
Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
******************************************************************************/
// Basic Interpolated LM class
#ifndef MF_INTERPLM_H
#define MF_INTERPLM_H
#define SHIFT_BETA 1
#define SHIFT_ONE 2
#define SHIFT_ZERO 3
#define SHIFT_ONE_BETA 4
#define LINEAR_WB 5
#define LINEAR_GT 6
#define MIXTURE 7
#define MOD_SHIFT_BETA 8
class interplm:public ngramtable
{
int lms;
double epsilon; //Bayes smoothing
int unismooth; //0 Bayes, 1 Witten Bell
int prune_singletons;
int prune_top_singletons;
public:
int backoff; //0 interpolation, 1 Back-off
interplm(char* ngtfile,int depth=0,TABLETYPE tt=FULL);
int prunesingletons(int flag=-1) {
return (flag==-1?prune_singletons:prune_singletons=flag);
}
int prunetopsingletons(int flag=-1) {
return (flag==-1?prune_top_singletons:prune_top_singletons=flag);
}
void gencorrcounts();
void gensuccstat();
virtual int dub() {
return dict->dub();
}
virtual int dub(int value) {
return dict->dub(value);
}
int setusmooth(int v=0) {
return unismooth=v;
}
double setepsilon(double v=1.0) {
return epsilon=v;
}
ngramtable *unitbl;
void trainunigr();
double unigr(ngram ng);
double zerofreq(int lev);
inline int lmsize() {
return lms;
}
inline int obswrd() {
return dict->size();
}
virtual int train() {
return 0;
}
virtual void adapt(char* /* unused parameter: ngtfile */, double /* unused parameter: w */) {}
virtual double prob(ngram /* unused parameter: ng */,int /* unused parameter: size */) {
return 0.0;
}
virtual double boprob(ngram /* unused parameter: ng */,int /* unused parameter: size */) {
return 0.0;
}
void test_ngt(ngramtable& ngt,int sz=0,int backoff=0,int checkpr=0);
void test_txt(char *filename,int sz=0,int backoff=0,int checkpr=0,char* outpr=NULL);
void test(char* filename,int sz,int backoff=0,int checkpr=0,char* outpr=NULL);
virtual int discount(ngram /* unused parameter: ng */,int /* unused parameter: size */,double& /* unused parameter: fstar */ ,double& /* unused parameter: lambda */,int /* unused parameter: cv*/=0) {
return 0;
}
virtual int savebin(char* /* unused parameter: filename */,int /* unused parameter: lmsize=2 */) {
return 0;
}
virtual int netsize() {
return 0;
}
void lmstat(int level) {
stat(level);
}
virtual ~interplm() {}
};
#endif
|