00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 class plsa
00022 {
00023 int topics;
00024 int maxdocs;
00025
00026 dictionary* dict;
00027 double **T;
00028 double **W;
00029 double *H;
00030
00031 char *tfname;
00032 char *wfname;
00033 char *hinfname;
00034 char *houtfname;
00035 char *basefname;
00036 char *featfname;
00037
00038 public:
00039 plsa(dictionary* dictfile,int top,
00040 char* baseFile, char* featFile,char* hfile,char* wfile,char* tfile);
00041
00042 ~plsa() {
00043
00044 for (int i=0; i<dict->size(); i++) {
00045 delete W[i];
00046 delete T[i];
00047 }
00048 delete [] W;
00049 delete [] H;
00050 delete [] T;
00051 }
00052
00053 int saveW(char* fname);
00054 int saveT(char* fname);
00055 int combineT(char* tlist);
00056 int saveWtxt(char* fname);
00057 int loadW(char* fname);
00058
00059 int initW(double noise,int spectopic);
00060 int initH(double noise,int maxdoc);
00061
00062 int train(char *trainfile,int maxiter,double noiseH,int flagW=0,double noiseW=0,int spectopic=0);
00063
00064 int saveFeat(char* fname);
00065
00066 };
00067
00068