00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 class shiftone: public mdiadaptlm
00025 {
00026 protected:
00027 int prunethresh;
00028 double beta;
00029 public:
00030 shiftone(char* ngtfile,int depth=0,int prunefreq=0,TABLETYPE tt=SHIFTBETA_B);
00031 int train();
00032 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00033 ~shiftone() {}
00034 };
00035
00036
00037 class shiftbeta: public mdiadaptlm
00038 {
00039 protected:
00040 int prunethresh;
00041 double* beta;
00042
00043 public:
00044 shiftbeta(char* ngtfile,int depth=0,int prunefreq=0,double beta=-1,TABLETYPE tt=SHIFTBETA_B);
00045 int train();
00046 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00047 ~shiftbeta() {
00048 delete [] beta;
00049 }
00050
00051 };
00052
00053
00054 class symshiftbeta: public shiftbeta
00055 {
00056 public:
00057 symshiftbeta(char* ngtfile,int depth=0,int prunefreq=0,double beta=-1):
00058 shiftbeta(ngtfile,depth,prunefreq,beta) {}
00059 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00060 };
00061
00062
00063 class mshiftbeta: public mdiadaptlm
00064 {
00065 protected:
00066 int prunethresh;
00067 double beta[3][MAX_NGRAM];
00068 ngramtable* tb[MAX_NGRAM];
00069
00070 double oovsum;
00071
00072 public:
00073 mshiftbeta(char* ngtfile,int depth=0,int prunefreq=0,TABLETYPE tt=MSHIFTBETA_B);
00074 int train();
00075 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00076
00077 ~mshiftbeta() {}
00078
00079 int mfreq(ngram& ng,int l) {
00080 return (l<lmsize()?getfreq(ng.link,ng.pinfo,1):ng.freq);
00081 }
00082
00083 };
00084