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 protected:
00026 int prunethresh;
00027 double beta;
00028 public:
00029 shiftone(char* ngtfile,int depth=0,int prunefreq=0,TABLETYPE tt=SHIFTBETA_B);
00030 int train();
00031 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00032 ~shiftone(){}
00033 };
00034
00035
00036 class shiftbeta: public mdiadaptlm{
00037 protected:
00038 int prunethresh;
00039 double* beta;
00040
00041 public:
00042 shiftbeta(char* ngtfile,int depth=0,int prunefreq=0,double beta=-1,TABLETYPE tt=SHIFTBETA_B);
00043 int train();
00044 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00045 ~shiftbeta(){delete [] beta;}
00046
00047 };
00048
00049
00050 class symshiftbeta: public shiftbeta{
00051 public:
00052 symshiftbeta(char* ngtfile,int depth=0,int prunefreq=0,double beta=-1):
00053 shiftbeta(ngtfile,depth,prunefreq,beta){}
00054 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00055 };
00056
00057
00058 class mshiftbeta: public mdiadaptlm{
00059 protected:
00060 int prunethresh;
00061 double beta[3][MAX_NGRAM];
00062 ngramtable* tb[MAX_NGRAM];
00063
00064 double oovsum;
00065
00066 public:
00067 mshiftbeta(char* ngtfile,int depth=0,int prunefreq=0,TABLETYPE tt=MSHIFTBETA_B);
00068 int train();
00069 int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);
00070
00071 ~mshiftbeta(){}
00072
00073 int mfreq(ngram& ng,int l){return (l<lmsize()?getfreq(ng.link,ng.pinfo,1):ng.freq);}
00074
00075 };
00076