/usr/include/irstlm/cplsa.h is in libirstlm-dev 6.00.05-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 | /******************************************************************************
IrstLM: IRST Language Model Toolkit, compile LM
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
******************************************************************************/
#ifndef MF_CPLSA_H
#define MF_CPLSA_H
namespace irstlm {
class plsa {
dictionary* dict; //dictionary
int topics; //number of topics
doc* trset; //training/inference set
double **T; //support matrix (keep double precision here!)
float **W; //word - topic matrix
float *H; //document-topic: matrix (memory mapped)
char Hfname[100]; //temporary and unique filename for H
char *tmpdir;
bool memorymap; //use or not memory mapping
//private info shared among threads
int threads;
int bucket; //parallel inference
int maxiter; //maximum iterations for inference
struct task {
void *ctx;
void *argv;
};
public:
plsa(dictionary* dict,int topics,char* workdir,int threads,bool mm);
~plsa();
int saveW(char* fname);
int saveWtxt(char* fname,int tw=10);
int loadW(char* fname);
int initW(char* modelfile, float noise,int spectopic); int freeW();
int initH();int freeH();
int initT();int freeT();
void expected_counts(void *argv);
static void *expected_counts_helper(void *argv){
task t=*(task *)argv;
((plsa *)t.ctx)->expected_counts(t.argv);return NULL;
};
static void *single_inference_helper(void *argv){
task t=*(task *)argv;
((plsa *)t.ctx)->single_inference(t.argv);return NULL;
};
int train(char *trainfile,char* modelfile, int maxiter, float noiseW,int spectopic=0);
int inference(char *trainfile, char* modelfile, int maxiter, char* topicfeatfile,char* wordfeatfile);
void single_inference(void *argv);
int saveWordFeatures(char* fname, long long d);
};
} //namespace irstlm
#endif
|